--- a/creator/creator.pro Fri May 14 15:15:12 2010 +0300
+++ b/creator/creator.pro Fri May 14 16:10:39 2010 +0300
@@ -1,19 +1,3 @@
-#
-# 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:
-#
-
TEMPLATE = app
TARGET = Creator
@@ -71,7 +55,7 @@
engine/inc/creator_std.h \
engine/inc/creator_traces.h \
engine/inc/creator_wepsecuritysettings.h \
- engine/inc/randomData.txt \
+ engine/inc/randomdata.txt \
inc/engine.h \
inc/enginewrapper.h
--- a/creator/engine/inc/creator_accesspoint.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_accesspoint.h Fri May 14 16:10:39 2010 +0300
@@ -28,11 +28,11 @@
#include <e32base.h>
#include <commdb.h>
-#include <apselect.h>
-#include <apdatahandler.h>
-#include <apaccesspointitem.h>
-#include <aputils.h>
-#include <apengineconsts.h>
+#include <ApSelect.h>
+#include <ApDataHandler.h>
+#include <ApAccessPointItem.h>
+#include <ApUtils.h>
+#include <ApEngineConsts.h>
#include <msvapi.h>
#include <mtclreg.h>
#include <mmsclient.h>
@@ -57,8 +57,8 @@
void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+
TInt CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters);
TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse );
--- a/creator/engine/inc/creator_browser.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_browser.h Fri May 14 16:10:39 2010 +0300
@@ -26,9 +26,9 @@
#include "creator_modulebase.h"
#include <e32base.h>
-#include <favouritesitem.h>
-#include <favouritesdb.h>
-#include <favouritesfile.h>
+#include <FavouritesItem.h>
+#include <FavouritesDb.h>
+#include <FavouritesFile.h>
@@ -36,7 +36,7 @@
class CBrowserParameters;
-class CCreatorBrowser : public CBase, public MCreatorModuleBase
+class CCreatorBrowser : public CCreatorModuleBase
{
public:
static CCreatorBrowser* NewL(CCreatorEngine* aEngine);
@@ -48,7 +48,8 @@
void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+
TInt CreateBookmarkEntryL(CBrowserParameters *aParameters);
TInt CreateBookmarkFolderEntryL(CBrowserParameters *aParameters);
TInt CreateSavedDeckEntryL(CBrowserParameters *aParameters);
--- a/creator/engine/inc/creator_calendar.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_calendar.h Fri May 14 16:10:39 2010 +0300
@@ -46,6 +46,16 @@
class CCreatorInterimCalendar : public CCreatorCalendarBase, public MCalProgressCallBack
{
+enum TCreatorCalendarStatus{
+ ECreatorCalendarDelete = 0,
+ ECreatorCalendarStart,
+ ECreatorCalendarGetWeeklyEntries,
+ ECreatorCalendarGetAttendies,
+ ECreatorCalendarGetStartDate,
+ ECreatorCalendarGetEndDate,
+ ECreatorCalendarAddDefaultAlarm
+};
+
public:
static CCreatorInterimCalendar* NewL(CCreatorEngine* aEngine);
static CCreatorInterimCalendar* NewLC(CCreatorEngine* aEngine);
@@ -63,8 +73,9 @@
void SetOrganizerL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters );
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+ void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
+
TInt CreateAppointmentEntryL(CCreatorModuleBaseParameters *aParameters);
TInt CreateEventEntryL(CCreatorModuleBaseParameters *aParameters);
TInt CreateAnniversaryEntryL(CCreatorModuleBaseParameters *aParameters);
--- a/creator/engine/inc/creator_calendarbase.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_calendarbase.h Fri May 14 16:10:39 2010 +0300
@@ -25,7 +25,7 @@
class CCreatorModuleBaseParameters;
-class CCreatorCalendarBase : public CBase, public MCreatorModuleBase{
+class CCreatorCalendarBase : public CCreatorModuleBase{
public:
--- a/creator/engine/inc/creator_connectionmethod.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_connectionmethod.h Fri May 14 16:10:39 2010 +0300
@@ -55,7 +55,7 @@
void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
TInt CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters);
TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse );
--- a/creator/engine/inc/creator_connectionmethodbase.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_connectionmethodbase.h Fri May 14 16:10:39 2010 +0300
@@ -27,7 +27,7 @@
const TUint KRandomBearerType = 0xEEEEEEEE;
-class CCreatorConnectionSettingsBase : public CBase, public MCreatorModuleBase
+class CCreatorConnectionSettingsBase : public CCreatorModuleBase
{
public:
--- a/creator/engine/inc/creator_contactsetcache.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_contactsetcache.h Fri May 14 16:10:39 2010 +0300
@@ -22,15 +22,22 @@
#define CREATORCONTACTSETCACHE_H_
#include <e32base.h>
+#include <qtcontacts.h>
// Forward declarations
class CContactLinkCacheImp;
+QTM_USE_NAMESPACE
class CCreatorContactSet : public CBase
{
public:
static CCreatorContactSet* NewL(TInt aLinkId, TInt aNumOfExistingContacts);
virtual ~CCreatorContactSet();
+ void AppendL(QContactLocalId);
+ TInt NumberOfExistingContacts() const;
+ RArray<QContactLocalId> ContactLinks();
+ const RArray<QContactLocalId> ContactLinks() const;
+
TInt LinkId() const;
private:
@@ -38,12 +45,15 @@
//void ConstructL();
TInt iLinkId;
TInt iNumOfExistingContacts;
+ RArray<QContactLocalId> iContactLinks;
};
class MContactLinkCache
{
public:
virtual void AppendL(CCreatorContactSet* aContactSet) = 0;
+ virtual RArray<QContactLocalId> ContactLinks(TInt aLinkId) = 0;
+ virtual const RArray<QContactLocalId> ContactLinks(TInt aLinkId) const = 0;
virtual RPointerArray<CCreatorContactSet>& ContactSets() = 0;
virtual const RPointerArray<CCreatorContactSet>& ContactSets() const = 0;
virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const = 0;
--- a/creator/engine/inc/creator_file.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_file.h Fri May 14 16:10:39 2010 +0300
@@ -38,7 +38,7 @@
class CDRMPermission;
class CDRMConstraint;
-class CCreatorFiles : public CBase, public MCreatorModuleBase
+class CCreatorFiles : public CCreatorModuleBase
{
public:
static CCreatorFiles* NewL(CCreatorEngine* aEngine);
@@ -50,7 +50,9 @@
void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+// void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
+ void QueryDialogClosedL(TBool, TInt){/*TODO: DialogClosed*/};
TInt CreateFileEntryL(CFilesParameters *aParameters, TInt aCommand);
void DeleteAllL();
void DeleteAllCreatedByCreatorL();
--- a/creator/engine/inc/creator_landmark.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_landmark.h Fri May 14 16:10:39 2010 +0300
@@ -25,7 +25,7 @@
#include "creator_modulebase.h"
#include <e32base.h>
-#include <epos_landmarks.h>
+#include <EPos_Landmarks.h>
class CLandmarkParameters;
class CPosLandmarkDatabase;
@@ -33,7 +33,7 @@
static const TInt KLandmarkFieldLength = 256;
-class CCreatorLandmarks : public CBase, public MCreatorModuleBase
+class CCreatorLandmarks : public CCreatorModuleBase
{
public:
static CCreatorLandmarks* NewL(CCreatorEngine* aEngine);
@@ -46,7 +46,8 @@
TPosLmItemId GetCategoryIdL( TPosLmGlobalCategory aGlobalCategoryID );
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+
TInt CreateLandmarkEntryL(CLandmarkParameters *aParameters);
static TPosLmGlobalCategory GetCategoryIdL(const TDesC& aCategoryStr);
void DeleteAllL();
--- a/creator/engine/inc/creator_log.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_log.h Fri May 14 16:10:39 2010 +0300
@@ -39,8 +39,13 @@
class CLogsParameters;
-class CCreatorLogs : public CActive, public MCreatorModuleBase
+class CCreatorLogs : public CActive, public MCreatorModuleBase, public MUIObserver
{
+enum TCreatorLogsStatus{
+ ECreatorLogsDelete = 0,
+ ECreatorLogsStart
+};
+
public:
static CCreatorLogs* NewL(CCreatorEngine* aEngine);
static CCreatorLogs* NewLC(CCreatorEngine* aEngine);
@@ -54,8 +59,9 @@
void DoCancel(); // from CActive
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+ void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);
+
TInt CreateMissedCallEntryL(CLogsParameters *aParameters);
TInt CreateReceivedCallEntryL(CLogsParameters *aParameters);
TInt CreateDialledNumberEntryL(CLogsParameters *aParameters);
@@ -63,6 +69,11 @@
void DeleteAllCreatedByCreatorL();
private:
+ CCreatorEngine* iEngine;
+ TInt iCommand;
+ TInt iEntriesToBeCreated;
+ TInt iDummy;
+
CLogClient* iLogClient;
CLogEvent* iLogEvent;
CActiveSchedulerWait iLogWriteWait;
--- a/creator/engine/inc/creator_mailbox.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_mailbox.h Fri May 14 16:10:39 2010 +0300
@@ -28,11 +28,11 @@
#include <e32base.h>
#include <SenduiMtmUids.h>
-#include <SMTPSET.h>
+#include <smtpset.h>
#include <imapset.h>
-#include <POP3SET.h>
+#include <pop3set.h>
#include <mtmuibas.h>
-#include <IAPPrefs.h>
+#include <iapprefs.h>
#include <cemailaccounts.h>
class CCreatorEngine;
@@ -46,7 +46,7 @@
EMailboxIMAP4
};
-class CCreatorMailboxes : public CBase, public MCreatorModuleBase, public MMsvSessionObserver
+class CCreatorMailboxes : public CCreatorModuleBase, public MMsvSessionObserver
{
public:
static CCreatorMailboxes* NewL(CCreatorEngine* aEngine);
@@ -81,7 +81,8 @@
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+
TInt CreateMailboxEntryL(CMailboxesParameters *aParameters);
void DeleteAllL();
void DeleteAllCreatedByCreatorL();
--- a/creator/engine/inc/creator_mailboxelement.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_mailboxelement.h Fri May 14 16:10:39 2010 +0300
@@ -23,6 +23,8 @@
#include "creator_scriptelement.h"
+class CMailboxesParameters;
+
namespace creatormailbox
{
_LIT(Kmailbox, "mailbox");
--- a/creator/engine/inc/creator_message.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_message.h Fri May 14 16:10:39 2010 +0300
@@ -89,8 +89,18 @@
HBufC* iEmailAddress;
};
-class CCreatorMessages : public CBase, public MCreatorModuleBase, public MMsvSessionObserver
+class CCreatorMessages : public CCreatorModuleBase, public MMsvSessionObserver
{
+enum TCreatorMessagesStatus{
+ ECreatorMessagesDelete = 0,
+ ECreatorMessagesStart,
+ ECreatorMessagesMessageType,
+ ECreatorMessagesFolderType,
+ ECreatorMessagesMessageStatus,
+ ECreatorMessagesCharsInBody,
+ ECreatorMessagesAttachment,
+};
+
public:
static CCreatorMessages* NewL(CCreatorEngine* aEngine);
static CCreatorMessages* NewLC(CCreatorEngine* aEngine);
@@ -130,8 +140,9 @@
void DeleteAllFromFolderL( const TMsvId aContext, CMsvSession* aSession, CSmsClientMtm* aClientMtm, TBool aOnlyCreatedWithCreator = EFalse );
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+ void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
+
TInt CreateMessageEntryL(CMessagesParameters *aParameters, TBool aTakeUserGivenParameters=EFalse);
TInt CreateRandomMessageEntryL(TInt aCommand);
void DeleteAllL();
--- a/creator/engine/inc/creator_modulebase.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_modulebase.h Fri May 14 16:10:39 2010 +0300
@@ -16,13 +16,14 @@
*/
-
-
#ifndef __CREATOR_MODULEBASE_H__
#define __CREATOR_MODULEBASE_H__
#include <e32base.h>
+#include "engine.h"
+#include "creator_traces.h"
+
// 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.
@@ -46,30 +47,97 @@
class MCreatorModuleBaseParameters;
class CCommandParser;
+_LIT(KSavingText, "Saving");
+
class MCreatorModuleBase
{
public:
private:
// constructs the module, add "iEngine = aEngine" and other construction stuff to the body
- virtual void ConstructL(CCreatorEngine* aEngine) = 0;
+ 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 TBool AskDataFromUserL( TInt aCommand ) = 0;
virtual void DeleteAllL() = 0;
virtual void DeleteAllCreatedByCreatorL() = 0;
+ };
+
+
+class CCreatorModuleBase : public CBase, public MCreatorModuleBase, public MUIObserver
+ {
public:
- CCreatorEngine* iEngine;
+ enum TCreatorModuleStatus
+ {
+ ECreatorModuleDelete = 0,
+ ECreatorModuleStart
+ };
+
+ CCreatorModuleBase(){ }
+
+ virtual TBool AskDataFromUserL(TInt aCommand)
+ {
+ iCommand = aCommand;
+ return EFalse;// will finish user interaction and engine will shutdown modules
+ }
+
+ virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+ {
+ LOGSTRING("Creator: CCreatorModuleBase::QueryDialogClosedL");
+
+ if( aPositiveAction == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ return;
+ }
+
+ TBool finished(EFalse);
+ TBool retval(ETrue);
+ switch(aUserData)
+ {
+ case ECreatorModuleDelete:
+ iEntriesToBeCreated = 1;
+ finished = ETrue;
+ break;
+ case ECreatorModuleStart:
+ finished = ETrue;
+ break;
+ default:
+ //some error
+ retval = EFalse;
+ break;
+ }
+ if( retval == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ }
+ else if( finished )
+ {
+ // add this command to command array
+ iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+ // started exucuting commands
+ iEngine->ExecuteFirstCommandL( KSavingText );
+ }
+ }
-private:
-
+protected:
+ // constructs the module, add "iEngine = aEngine" and other construction stuff to the body
+ virtual void ConstructL(CCreatorEngine* aEngine)
+ {
+ iEngine = aEngine;
+ };
+
+protected:
+ CCreatorEngine* iEngine;
+ TInt iCommand;
+ TInt iEntriesToBeCreated;
+ TInt iDummy;
};
-
class MCreatorModuleBaseParameters
{
// a base class for the parameters, no default implementation
@@ -112,4 +180,4 @@
#endif // __CREATOR_MODULEBASE_H__
-
\ No newline at end of file
+
--- a/creator/engine/inc/creator_note.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_note.h Fri May 14 16:10:39 2010 +0300
@@ -39,7 +39,7 @@
class CNotepadParameters;
-class CCreatorNotepad : public CBase, public MCreatorModuleBase
+class CCreatorNotepad : public CCreatorModuleBase
{
public:
static CCreatorNotepad* NewL(CCreatorEngine* aEngine);
@@ -51,7 +51,8 @@
void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
public:
- TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+ TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+
TInt CreateNoteEntryL(CNotepadParameters *aParameters);
void DeleteAllL();
void DeleteAllCreatedByCreatorL();
--- a/creator/engine/inc/creator_phonebook.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_phonebook.h Fri May 14 16:10:39 2010 +0300
@@ -22,7 +22,6 @@
#ifndef __CREATORPHONEBOOK_H__
#define __CREATORPHONEBOOK_H__
-#include "engine.h"
#include "creator_phonebookbase.h"
#include "creator_randomdatafield.h"
@@ -90,7 +89,6 @@
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);
@@ -104,7 +102,7 @@
private:
void InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/);
- TBool IsContactGroupL(/*const MVPbkContactLink& aLink*/); //modify
+ TBool IsContactGroupL( QContactLocalId& aLink );
void StoreLinksForDeleteL( RArray<TUint32>& aLinks, TUid aStoreUid ); //modify
void DeleteContactsL( QList<QContactLocalId>& contacts /*MVPbkContactLinkArray* aContacts, TBool aGroup*/ ); //modify
void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
@@ -123,7 +121,6 @@
static QString iPhoneNumberFields[];
static TInt iUrlFields[];
static TInt iEmailFields[];
- TBool iAddAllFields;
//QList<QContactLocalId>
RArray<TUint32> iContactLinkArray;//CVPbkContactLinkArray* iContactLinkArray; //modify
RArray<TUint32> iContactsToDelete; //CVPbkContactLinkArray* iContactsToDelete; //modify
@@ -151,7 +148,7 @@
};
/**
- * Virtual phonebook parameters
+ * phonebook parameters
*/
@@ -182,5 +179,17 @@
};
+class CCreatorContactField : public CBase//, public MCreatorRandomDataField
+ {
+public:
+ static CCreatorContactField* NewL();
+ QContactDetail CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TInt aRand = KErrNotFound );
+ QContactDetail CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TPtrC aData );
+ void AddFieldToParam( CPhonebookParameters* aParam, QContactDetail aDetail);
+ ~CCreatorContactField();
+private:
+ CCreatorContactField();
+ void ConstructL();
+ };
#endif // __CREATORPHONEBOOK_H__
--- a/creator/engine/inc/creator_phonebookbase.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_phonebookbase.h Fri May 14 16:10:39 2010 +0300
@@ -28,13 +28,27 @@
class CCreatorModuleBaseParameters;
-class CCreatorPhonebookBase : public CBase, public MCreatorModuleBase{
+class CCreatorPhonebookBase : public CCreatorModuleBase
+{
+enum TCreatorPhonebookStatus{
+ ECreatorPhonebookDelete = 0,
+ ECreatorPhonebookStart,
+ ECreatorPhonebookGetContactFields,
+ ECreatorPhonebookGetPhoneNumbersCount,
+ ECreatorPhonebookGetUrlsCount,
+ ECreatorPhonebookGetEmailsCount,
+ ECreatorPhonebookGetGroupFields,
+ ECreatorPhonebookGetContactsInGroup
+};
+
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 AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+ virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
+
// virtual TBool IsActive() = 0;
// virtual void CancelOperation() = 0;
virtual void DeleteAllGroupsL() = 0;
@@ -48,6 +62,7 @@
TInt iNumberOfEmailAddressFields;
TInt iContactsInGroup;
TBool iDefaultFieldsSelected;
+ TBool iAddAllFields;
};
--- a/creator/engine/inc/creator_scriptentry.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_scriptentry.h Fri May 14 16:10:39 2010 +0300
@@ -23,13 +23,11 @@
#define __FILEUTILS_H__
-#include "engine.h"
-
#include <e32base.h>
#include <f32file.h>
#include <badesca.h>
-#include <aknglobalnote.h>
-#include <akniconarray.h>
+#include <AknGlobalNote.h>
+#include <AknIconArray.h>
#include <aknmemorycardui.mbg>
#include <msvapi.h>
@@ -43,8 +41,13 @@
static TInt FindFilesRecursiveL(CDesCArrayFlat* aFileArray, const TDesC& aFileName, const TDesC& aPath);
};
-class CCommandParser : public CBase, public MMsvSessionObserver
+class CCommandParser : public CBase, public MMsvSessionObserver, MUIObserver
{
+enum TCommandParserStatus{
+ EGetingScript,
+ EGetingRandomDataFile
+};
+
public:
static CCommandParser* NewL(CCreatorEngine* aEngine);
static CCommandParser* NewLC(CCreatorEngine* aEngine);
@@ -65,19 +68,32 @@
void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver
public:
+ /**
+ * Called when some dialog in UI is closed
+ *
+ * @since S60 10.1
+ * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+ * @param aUserData number that was passed to UI before dialog was opened
+ * @return None.
+ */
+ virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);
+
+public:
void OpenScriptL();
- TBool OpenScriptL(RFile& aScriptFile);
+ TBool OpenScriptL(MCommandParserObserver* aObserver);
TBool GetRandomDataFilenameL(TDes& aFilename);
private:
CCreatorEngine* iEngine;
CDesCArrayFlat* iSearchArray;
-
+ TInt iSelectedItem;
+
TInt iParserPosition;
TInt iParserOldPosition;
HBufC8* iReadBuf;
+ MCommandParserObserver* iObserver;
};
--- a/creator/engine/inc/creator_virtualphonebook.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_virtualphonebook.h Fri May 14 16:10:39 2010 +0300
@@ -70,7 +70,6 @@
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);
@@ -136,7 +135,6 @@
static TInt iPhoneNumberFields[];
static TInt iUrlFields[];
static TInt iEmailFields[];
- TBool iAddAllFields;
CVPbkContactLinkArray* iContactLinkArray;
CVPbkContactLinkArray* iContactsToDelete;
CVPbkContactLinkArray* iContactGroupsToDelete;
--- a/creator/engine/inc/creator_wepsecuritysettings.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/inc/creator_wepsecuritysettings.h Fri May 14 16:10:39 2010 +0300
@@ -72,7 +72,7 @@
private:
CCreatorWEPSecuritySettings();
- void ConstructL(); // from MCreatorModuleBase
+ void ConstructL();
public:
--- a/creator/engine/src/creator_accesspoint.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_accesspoint.cpp Fri May 14 16:10:39 2010 +0300
@@ -20,8 +20,8 @@
#include "creator_accesspoint.h"
#include "creator_traces.h"
-#include <aplistitemlist.h>
-#include <aplistitem.h>
+#include <ApListItemList.h>
+#include <ApListItem.h>
#include "enginewrapper.h"
static const TInt KAccessPointsFieldLength = 128;
@@ -188,20 +188,22 @@
//----------------------------------------------------------------------------
-TBool CCreatorAccessPoints::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorAccessPoints::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorAccessPoints::AskDataFromUserL");
-
+
+ CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+
if( aCommand == ECmdDeleteIAPs )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points?"), this, ECreatorModuleDelete );
}
else if( aCommand == ECmdDeleteCreatorIAPs )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points created with Creator?"), this, ECreatorModuleDelete );
}
- return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
}
--- a/creator/engine/src/creator_browser.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_browser.cpp Fri May 14 16:10:39 2010 +0300
@@ -16,7 +16,7 @@
*/
-#include <favouriteswapap.h>
+#include <FavouritesWapAp.h>
#include "engine.h"
#include "enginewrapper.h"
@@ -124,56 +124,58 @@
//----------------------------------------------------------------------------
-TBool CCreatorBrowser::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorBrowser::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorBrowser::AskDataFromUserL");
+ CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+
TBool result( EFalse );
switch ( aCommand )
{
case ECmdDeleteBrowserBookmarks:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks?"), this, ECreatorModuleDelete );
break;
}
case ECmdDeleteCreatorBrowserBookmarks:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks created with Creator?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks created with Creator?"), this, ECreatorModuleDelete );
break;
}
case ECmdDeleteBrowserBookmarkFolders:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders?"), this, ECreatorModuleDelete );
break;
}
case ECmdDeleteCreatorBrowserBookmarkFolders:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders created with Creator?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders created with Creator?"), this, ECreatorModuleDelete );
break;
}
case ECmdDeleteBrowserSavedPages:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages?"), this, ECreatorModuleDelete );
break;
}
case ECmdDeleteCreatorBrowserSavedPages:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages created with Creator?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages created with Creator?"), this, ECreatorModuleDelete );
break;
}
case ECmdDeleteBrowserSavedPageFolders:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders?"), this, ECreatorModuleDelete );
break;
}
case ECmdDeleteCreatorBrowserSavedPageFolders:
{
- result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders created with Creator?") );
+ result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders created with Creator?"), this, ECreatorModuleDelete );
break;
}
default:
{
- result = iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+ result = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
break;
}
}
--- a/creator/engine/src/creator_calendar.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_calendar.cpp Fri May 14 16:10:39 2010 +0300
@@ -330,63 +330,105 @@
//----------------------------------------------------------------------------
-TBool CCreatorInterimCalendar::AskDataFromUserL (TInt aCommand,
- TInt& aNumberOfEntries )
+void CCreatorInterimCalendar::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+ {
+ LOGSTRING("Creator: CCreatorInterimCalendar::QueryDialogClosedL");
+
+ if( aPositiveAction == EFalse && aUserData != ECreatorCalendarAddDefaultAlarm )
+ {
+ iEngine->ShutDownEnginesL();
+ return;
+ }
+
+ TBool finished(EFalse);
+ TBool retval(ETrue);
+ switch(aUserData)
+ {
+ case ECreatorCalendarDelete:
+ iEntriesToBeCreated = 1;
+ finished = ETrue;
+ break;
+ case ECreatorCalendarStart:
+ if( iCommand == ECmdCreateCalendarEntryEvents || iCommand == ECmdCreateCalendarEntryAppointments )
+ {
+ _LIT(KRepeatingNum, "How many repeating (weekly) entries");
+ retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberRepeatingEntries, KRepeatingNum, ETrue, this, ECreatorCalendarGetWeeklyEntries);
+ }
+ else
+ {
+ _LIT(KStartPeriodDate, "Start date of creation period");// \n dd/mm/yyyy
+ retval = iEngine->GetEngineWrapper()->TimeQueryDialog(&iRandomModeStartTime, KStartPeriodDate, this, ECreatorCalendarGetStartDate); // ask start date
+ }
+ break;
+ case ECreatorCalendarGetWeeklyEntries:
+ _LIT(KAttendeesNum, "How many attendees to create");
+ retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfAttendees, KAttendeesNum, ETrue, this, ECreatorCalendarGetAttendies);
+ break;
+ case ECreatorCalendarGetAttendies:
+ {
+ // ask start date
+ _LIT(KStartPeriodDate, "Start date of creation period");
+ retval = iEngine->GetEngineWrapper()->TimeQueryDialog(&iRandomModeStartTime, KStartPeriodDate, this, ECreatorCalendarGetStartDate );
+ }
+ break;
+ case ECreatorCalendarGetStartDate:
+ {
+ _LIT(KEndPeriodDate, "End date of creation period\n dd/mm/yyyy");
+ iEngine->GetEngineWrapper()->TimeQueryDialog (&iRandomModeEndTime, KEndPeriodDate, this, ECreatorCalendarGetEndDate ); // ask end date
+ }
+ break;
+ case ECreatorCalendarGetEndDate:
+ if (iRandomModeStartTime > iRandomModeEndTime ) // check end date is ok
+ {
+ iEngine->GetEngineWrapper()->ShowNote(_L("End date must be after start date") );
+ retval = EFalse;
+ }
+ else
+ {
+ retval = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add default alarm?"), this, ECreatorCalendarAddDefaultAlarm);
+ }
+ break;
+ case ECreatorCalendarAddDefaultAlarm:
+ iSetAlarm = aPositiveAction;
+ finished = ETrue;
+ break;
+ default:
+ //some error
+ retval = EFalse;
+ break;
+ }
+ if( retval == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ }
+ else if( finished )
+ {
+ // add this command to command array
+ iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+ // started exucuting commands
+ iEngine->ExecuteFirstCommandL( KSavingText );
+ }
+ }
+
+//----------------------------------------------------------------------------
+
+TBool CCreatorInterimCalendar::AskDataFromUserL( TInt aCommand )
{
LOGSTRING("Creator: CCreatorInterimCalendar::AskDataFromUserL");
-
+
+ CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+
if( aCommand == ECmdDeleteCalendarEntries )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries?"), this, ECreatorCalendarDelete );
}
if( aCommand == ECmdDeleteCreatorCalendarEntries )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries created with Creator?"), this, ECreatorCalendarDelete );
}
// display queries
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog (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->GetEngineWrapper()->EntriesQueryDialog(iNumberRepeatingEntries, KRepeatingNum, ETrue))
- {
- return EFalse;
- }
- _LIT(KAttendeesNum, "How many attendees to create");
- if( !iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberOfAttendees, KAttendeesNum, ETrue))
- {
- return EFalse;
- }
- }
- if (iEngine->GetEngineWrapper()->TimeQueryDialog(iRandomModeStartTime, _L("Start date of creation period\n dd/mm/yyyy") ) ) // ask start date
- {
- if (iEngine->GetEngineWrapper()->TimeQueryDialog (iRandomModeEndTime, _L("End date of creation period\n dd/mm/yyyy") ) ) // ask end date
- {
- if (iRandomModeStartTime > iRandomModeEndTime ) // check end date is ok
- {
- iEngine->GetEngineWrapper()->ShowNote(_L("End date must be after start date") );
- return EFalse;
- }
- else
- {
- if( iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add default alarm?")))
- {
- iSetAlarm = ETrue;
- }
- }
- return ETrue;
- }
- else
- return EFalse;
- }
- else
- return EFalse;
- }
- else
- return EFalse;
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorCalendarStart ); // ask number of entries to create
}
//----------------------------------------------------------------------------
--- a/creator/engine/src/creator_cmdscriptrun.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_cmdscriptrun.cpp Fri May 14 16:10:39 2010 +0300
@@ -16,8 +16,8 @@
*/
-#include <EIKENV.H>
-#include <COEAUI.H>
+#include <eikenv.h>
+#include <coeaui.h>
#include <pathinfo.h>
#include "creator_cmdscriptrun.h"
#include "engine.h"
--- a/creator/engine/src/creator_connectionmethod.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_connectionmethod.cpp Fri May 14 16:10:39 2010 +0300
@@ -148,21 +148,23 @@
//----------------------------------------------------------------------------
-TBool CCreatorConnectionSettings::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorConnectionSettings::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorConnectionSettings::AskDataFromUserL");
-
+
+ CCreatorModuleBase::AskDataFromUserL( aCommand );
+
if( aCommand == ECmdDeleteIAPs )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods?"), this, ECreatorModuleDelete );
}
else if( aCommand == ECmdDeleteCreatorIAPs )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods created with Creator?"), this, ECreatorModuleDelete );
}
else
{
- return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
}
}
--- a/creator/engine/src/creator_contactelement.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_contactelement.cpp Fri May 14 16:10:39 2010 +0300
@@ -19,9 +19,11 @@
#include "creator_contactelement.h"
#include "creator_traces.h"
+#include "creator_phonebook.h"
#include "creator_factory.h"
#include "creator_contactsetcache.h"
#include <xml/documentparameters.h>
+#include <qtcontacts.h>
using namespace Xml;
using namespace creatorcontact;
@@ -40,9 +42,102 @@
{
public:
TPtrC iElementName;
- TInt iFieldCode;
+ QString iDetail;
+ QString iContext;
+ QString iFieldCode;
TContactFieldDataType iDataType;
};
+//*********************************************************************************
+FieldMapping fieldMappingTbl[] = {
+ {TPtrC(KFirstname), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldFirstName).operator QString() /*R_VPBK_FIELD_TYPE_FIRSTNAME*/, EDataTypeText},
+ {TPtrC(KLastname), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldLastName).operator QString() /*R_VPBK_FIELD_TYPE_LASTNAME*/, EDataTypeText},
+ {TPtrC(KPrefix), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldPrefix).operator QString()/*R_VPBK_FIELD_TYPE_PREFIX*/, EDataTypeText},
+ {TPtrC(KSuffix), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldSuffix).operator QString()/*R_VPBK_FIELD_TYPE_SUFFIX*/, EDataTypeText},
+ {TPtrC(KSecondname), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldMiddleName).operator QString()/*R_VPBK_FIELD_TYPE_SECONDNAME*/, EDataTypeText},
+ {TPtrC(KLandphoneHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeLandline).operator QString()/*R_VPBK_FIELD_TYPE_LANDPHONEHOME*/, EDataTypeText},
+
+ {TPtrC(KMobilephoneHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeMobile).operator QString()/*R_VPBK_FIELD_TYPE_MOBILEPHONEHOME*/, EDataTypeText},
+ {TPtrC(KVideonumberHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeVideo).operator QString()/*R_VPBK_FIELD_TYPE_VIDEONUMBERHOME*/, EDataTypeText},
+ {TPtrC(KFaxnumberHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeFacsimile).operator QString()/*R_VPBK_FIELD_TYPE_FAXNUMBERHOME*/, EDataTypeText},
+ //{TPtrC(KVoipHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubType).operator QString()/*R_VPBK_FIELD_TYPE_VOIPHOME*/, EDataTypeText},
+ {TPtrC(KEmailHome), (QContactEmailAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),""/*R_VPBK_FIELD_TYPE_EMAILHOME*/, EDataTypeText},
+ {TPtrC(KUrlHome), (QContactUrl::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactUrl::SubTypeHomePage).operator QString()/*R_VPBK_FIELD_TYPE_URLHOME*/, EDataTypeText},
+ //{TPtrC(KAddrlabelHome), R_VPBK_FIELD_TYPE_ADDRLABELHOME, EDataTypeText},
+ {TPtrC(KAddrpoHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOHOME*/, EDataTypeText},
+
+ // {TPtrC(KAddrextHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::Field).operator QString()/*R_VPBK_FIELD_TYPE_ADDREXTHOME*/, EDataTypeText},
+ {TPtrC(KAddrstreetHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldStreet).operator QString()/*R_VPBK_FIELD_TYPE_ADDRSTREETHOME*/, EDataTypeText},
+ {TPtrC(KAddrlocalHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldLocality).operator QString()/*R_VPBK_FIELD_TYPE_ADDRLOCALHOME*/, EDataTypeText},
+ {TPtrC(KAddrregionHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldRegion).operator QString()/*R_VPBK_FIELD_TYPE_ADDRREGIONHOME*/, EDataTypeText},
+ {TPtrC(KAddrpostcodeHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldPostcode).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOSTCODEHOME*/, EDataTypeText},
+ {TPtrC(KAddrcountryHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldCountry).operator QString()/*R_VPBK_FIELD_TYPE_ADDRCOUNTRYHOME*/, EDataTypeText},
+ {TPtrC(KJobtitle), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldTitle).operator QString()/*R_VPBK_FIELD_TYPE_JOBTITLE*/, EDataTypeText},
+ {TPtrC(KCompanyname), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldName).operator QString()/*R_VPBK_FIELD_TYPE_COMPANYNAME*/, EDataTypeText},
+
+ {TPtrC(KLandphoneWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeLandline).operator QString()/*R_VPBK_FIELD_TYPE_LANDPHONEWORK*/, EDataTypeText},
+ {TPtrC(KMobilephoneWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeMobile).operator QString()/*R_VPBK_FIELD_TYPE_MOBILEPHONEWORK*/, EDataTypeText},
+ {TPtrC(KVideonumberWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeVideo).operator QString()/*R_VPBK_FIELD_TYPE_VIDEONUMBERWORK*/, EDataTypeText},
+ {TPtrC(KFaxnumberWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeFacsimile).operator QString()/*R_VPBK_FIELD_TYPE_FAXNUMBERWORK*/, EDataTypeText},
+ //{TPtrC(KVoipWork), R_VPBK_FIELD_TYPE_VOIPWORK, EDataTypeText},
+ {TPtrC(KEmailWork), (QContactEmailAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),""/*R_VPBK_FIELD_TYPE_EMAILWORK*/, EDataTypeText},
+ {TPtrC(KUrlWork), (QContactUrl::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactUrl::SubTypeHomePage).operator QString()/*R_VPBK_FIELD_TYPE_URLWORK*/, EDataTypeText},
+ //{TPtrC(KAddrlabelWork), R_VPBK_FIELD_TYPE_ADDRLABELWORK, EDataTypeText},
+
+ {TPtrC(KAddrpoWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOWORK*/, EDataTypeText},
+ //{TPtrC(KAddrextWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDREXTWORK*/, EDataTypeText},
+ {TPtrC(KAddrstreetWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldStreet).operator QString()/*R_VPBK_FIELD_TYPE_ADDRSTREETWORK*/, EDataTypeText},
+ {TPtrC(KAddrlocalWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldLocality).operator QString()/*R_VPBK_FIELD_TYPE_ADDRLOCALWORK*/, EDataTypeText},
+ {TPtrC(KAddrregionWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldRegion).operator QString()/*R_VPBK_FIELD_TYPE_ADDRREGIONWORK*/, EDataTypeText},
+ {TPtrC(KAddrpostcodeWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldPostcode).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOSTCODEWORK*/, EDataTypeText},
+ {TPtrC(KAddrcountryWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldCountry).operator QString()/*R_VPBK_FIELD_TYPE_ADDRCOUNTRYWORK*/, EDataTypeText},
+
+ {TPtrC(KLandphoneGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeLandline).operator QString(), EDataTypeText},
+ {TPtrC(KMobilephoneGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeMobile).operator QString(), EDataTypeText},
+ {TPtrC(KVideonumberGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeVideo).operator QString(), EDataTypeText},
+ {TPtrC(KFaxnumberGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeFacsimile).operator QString(), 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), (QContactEmailAddress::DefinitionName).operator QString(), "","", EDataTypeText},
+
+ {TPtrC(KUrlGen), (QContactUrl::DefinitionName).operator QString(), "","", EDataTypeText},
+ // {TPtrC(KAddrlabelGen), R_VPBK_FIELD_TYPE_ADDRLABELGEN, EDataTypeText},
+ {TPtrC(KAddrpoGen), (QContactAddress::DefinitionName).operator QString(), "",(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOGEN*/, EDataTypeText},
+ // {TPtrC(KAddrextGen), R_VPBK_FIELD_TYPE_ADDREXTGEN, EDataTypeText},
+ {TPtrC(KAddrstreetGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldStreet).operator QString()/*R_VPBK_FIELD_TYPE_ADDRSTREETGEN*/, EDataTypeText},
+ {TPtrC(KAddrlocalGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldLocality).operator QString()/*R_VPBK_FIELD_TYPE_ADDRLOCALGEN*/, EDataTypeText},
+ {TPtrC(KAddrregionGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldRegion).operator QString()/*R_VPBK_FIELD_TYPE_ADDRREGIONGEN*/, EDataTypeText},
+ {TPtrC(KAddrpostcodeGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldPostcode).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOSTCODEGEN*/, EDataTypeText},
+ {TPtrC(KAddrcountryGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldCountry).operator QString()/*R_VPBK_FIELD_TYPE_ADDRCOUNTRYGEN*/, EDataTypeText},
+
+ {TPtrC(KPagerNumber),(QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypePager).operator QString()/* R_VPBK_FIELD_TYPE_PAGERNUMBER*/, EDataTypeText},
+ {TPtrC(KDtmfString), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeDtmfMenu).operator QString()/* R_VPBK_FIELD_TYPE_DTMFSTRING*/, EDataTypeText},
+ // {TPtrC(KWvAddress), R_VPBK_FIELD_TYPE_WVADDRESS, EDataTypeText},
+ {TPtrC(KDate), (QContactBirthday::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactBirthday::FieldBirthday).operator QString()/* R_VPBK_FIELD_TYPE_DATE*/, EDataTypeDateTime},
+ {TPtrC(KNote), (QContactNote::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactNote::FieldNote).operator QString()/* R_VPBK_FIELD_TYPE_NOTE*/, EDataTypeText},
+ {TPtrC(KThumbnailPath), (QContactAvatar::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAvatar::SubTypeImage).operator QString()/* 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), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldMiddleName).operator QString()/*R_VPBK_FIELD_TYPE_MIDDLENAME*/, EDataTypeText},
+ {TPtrC(KDepartment), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldDepartment).operator QString()/*R_VPBK_FIELD_TYPE_DEPARTMENT*/, EDataTypeText},
+ {TPtrC(KAsstname), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldAssistantName).operator QString()/*R_VPBK_FIELD_TYPE_ASSTNAME*/, EDataTypeText},
+ {TPtrC(KSpouse), (QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactFamily::FieldSpouse).operator QString()/* R_VPBK_FIELD_TYPE_SPOUSE*/, EDataTypeText},
+ {TPtrC(KChildren), (QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactFamily::FieldChildren).operator QString()/*R_VPBK_FIELD_TYPE_CHILDREN, EDataTypeText},
+ {TPtrC(KAsstphone), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeAssistant).operator QString()/* R_VPBK_FIELD_TYPE_ASSTPHONE*/, EDataTypeText},
+
+ {TPtrC(KCarphone), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeCar).operator QString()/* R_VPBK_FIELD_TYPE_CARPHONE*/, EDataTypeText},
+ {TPtrC(KAnniversary), (QContactAnniversary::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAnniversary::SubTypeEmployment).operator QString()/*R_VPBK_FIELD_TYPE_ANNIVERSARY*/, EDataTypeDateTime},
+ // {TPtrC(KSyncclass), R_VPBK_FIELD_TYPE_SYNCCLASS, EDataTypeText},
+ // {TPtrC(KLocPrivacy), R_VPBK_FIELD_TYPE_LOCPRIVACY, EDataTypeText},
+ {TPtrC(KGenlabel), (QContactDisplayLabel::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactDisplayLabel::FieldLabel).operator QString()/*R_VPBK_FIELD_TYPE_GENLABEL*/, EDataTypeText}
+};
+
+//*********************************************************************************
CCreatorContactElementBase* CCreatorContactElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
{
@@ -74,8 +169,117 @@
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 )
+ {
+ CPhonebookParameters* param = (CPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();
+ CleanupStack::PushL(param);
+ // Loop all the field elements
+ if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+ {
+
+ const RPointerArray<CCreatorScriptElement>& fieldList = fieldsElement->SubElements();
+
+ if( fieldList.Count() == 0 )
+ {
+
+ }
+ for( TInt i = 0; i < fieldList.Count(); ++i )
+ {
+ TPtrC fieldName = fieldList[i]->Name();
+ CCreatorContactField* field = 0;
+ field = CCreatorContactField::NewL();
+
+ 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() );
+ }
+ 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) )
+ {
+ // random
+ CleanupStack::PushL( field );
+ QContactDetail cntDetail = field->CreateContactDetail(iEngine,param,mapping.iDetail,mapping.iContext,mapping.iFieldCode, KErrNotFound );
+ if(!cntDetail.isEmpty())
+ {
+ field->AddFieldToParam( param, cntDetail ); //it will do "param->iContactFields.AppendL(field);"
+ }
+ CleanupStack::Pop( field );
+ }
+ else
+ {
+ CleanupStack::PushL( field );
+ QContactDetail cntDetail = field->CreateContactDetail(iEngine,param,mapping.iDetail,mapping.iContext,mapping.iFieldCode, content );
+ if(!cntDetail.isEmpty())
+ {
+ field->AddFieldToParam( param, cntDetail ); //it will do "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 = CCreatorContactField::NewL();
+ CleanupStack::PushL( field );
+ QContactDetail cntDetail = field->CreateContactDetail(iEngine,param,fieldMappingTbl[i].iDetail,fieldMappingTbl[i].iContext,fieldMappingTbl[i].iFieldCode, KErrNotFound );
+ if(!cntDetail.isEmpty())
+ {
+ field->AddFieldToParam( param, cntDetail ); //it will do "param->iContactFields.AppendL(field);"
+ }
+ CleanupStack::Pop( field );
+ }
+ }
+ iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryContacts, param);
+ iParameters.AppendL(param); // Save the pointer to the parametes.
+ CleanupStack::Pop(param);
+ }
+ }
+
+
+/*
+void CCreatorContactElement::ExecuteCommandL()
{}
-
+*/
CCreatorContactSetElement* CCreatorContactSetElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
{
LOGSTRING("Creator: CCreatorContactSetElement::NewL");
@@ -147,8 +351,55 @@
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 )
+ {
+ CPhonebookParameters* param = (CPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();
+ CleanupStack::PushL(param);
+
+ // Links to contact-sets:
+ const RPointerArray<CCreatorScriptElement>& linkList = membersElement->SubElements();
+ if( linkList.Count() > 0 )
+ {
+ for( TInt i = 0; i < linkList.Count(); ++i )
+ {
+ AppendContactSetReferenceL(*linkList[i], param->iLinkIds);
+ }
+ }
+
+ if( groupNameAttr )
+ {
+ param ->iGroupName = QString::fromUtf16(groupNameAttr->Value().Ptr(), groupNameAttr->Value().Length()); //param->iGroupName->Des().Copy( groupNameAttr->Value() );
+ }
+ else
+ {
+ param->iGroupName = QString::fromUtf16( iEngine->RandomString(CCreatorEngine::EGroupName).Ptr(), iEngine->RandomString(CCreatorEngine::EGroupName).Length()); //->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) );
+ }
+ iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryGroups, param);
+ CleanupStack::Pop(param);
+ }
+ }
+ }
+
+/*
+void CCreatorContactGroupElement::ExecuteCommandL()
{}
-
+*/
CCreatorContactFieldElement* CCreatorContactFieldElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
{
LOGSTRING("Creator: CCreatorContactFieldElement::NewL");
--- a/creator/engine/src/creator_contactsetcache.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_contactsetcache.cpp Fri May 14 16:10:39 2010 +0300
@@ -32,9 +32,31 @@
return iLinkId;
}
+void CCreatorContactSet::AppendL(QContactLocalId aContactLink)
+ {
+ iContactLinks.AppendL(aContactLink);
+ }
+
+RArray<QContactLocalId> CCreatorContactSet::ContactLinks()
+ {
+ return iContactLinks;
+ }
+
+const RArray<QContactLocalId> CCreatorContactSet::ContactLinks() const
+ {
+ return iContactLinks;
+ }
+
+
+TInt CCreatorContactSet::NumberOfExistingContacts() const
+ {
+ return iNumOfExistingContacts;
+ }
CCreatorContactSet::~CCreatorContactSet()
{
+ iContactLinks.Reset();
+ iContactLinks.Close();
}
@@ -50,6 +72,10 @@
static CContactLinkCacheImp* NewL();
virtual ~CContactLinkCacheImp();
virtual void AppendL(CCreatorContactSet* aContactSet);
+
+ virtual RArray<QContactLocalId> ContactLinks(TInt aLinkId);
+ virtual const RArray<QContactLocalId> ContactLinks(TInt aLinkId) const;
+
virtual RPointerArray<CCreatorContactSet>& ContactSets();
virtual const RPointerArray<CCreatorContactSet>& ContactSets() const;
virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const;
@@ -58,6 +84,9 @@
private:
void ConstructL();
CContactLinkCacheImp();
+
+ RArray<QContactLocalId> iEmptyLinks;
+
RPointerArray<CCreatorContactSet> iContactSets;
CCreatorContactSet* iDummyContactSet;
};
@@ -83,6 +112,9 @@
CContactLinkCacheImp::~CContactLinkCacheImp()
{
+ iEmptyLinks.Reset();// just in case...
+ iEmptyLinks.Close();
+
iContactSets.ResetAndDestroy();
iContactSets.Close();
delete iDummyContactSet;
@@ -91,6 +123,30 @@
{
iContactSets.AppendL(aContactSet);
}
+RArray<QContactLocalId> CContactLinkCacheImp::ContactLinks(TInt aLinkId)
+ {
+ for( TInt i = 0; i < iContactSets.Count(); ++i )
+ {
+ if( iContactSets[i]->LinkId() == aLinkId )
+ {
+ return iContactSets[i]->ContactLinks();
+ }
+ }
+ return iEmptyLinks;
+ }
+
+const RArray<QContactLocalId> CContactLinkCacheImp::ContactLinks(TInt aLinkId) const
+ {
+ for( TInt i = 0; i < iContactSets.Count(); ++i )
+ {
+ if( iContactSets[i]->LinkId() == aLinkId )
+ {
+ return iContactSets[i]->ContactLinks();
+ }
+ }
+ return iEmptyLinks;
+ }
+
const CCreatorContactSet& CContactLinkCacheImp::ContactSet(TInt aLinkId) const
{
--- a/creator/engine/src/creator_factory.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_factory.cpp Fri May 14 16:10:39 2010 +0300
@@ -19,7 +19,7 @@
#include "engine.h"
#include "creator_factory.h"
-#include "creator_accessPoint.h"
+#include "creator_accesspoint.h"
#include "creator_phonebook.h"
CCreatorPhonebookBase* TCreatorFactory::CreatePhoneBookL(CCreatorEngine* aEngine)
@@ -29,8 +29,7 @@
CCreatorModuleBaseParameters* TCreatorFactory::CreatePhoneBookParametersL()
{
- //return new(ELeave) CVirtualPhonebookParameters;
- return NULL;
+ return new(ELeave) CPhonebookParameters;
}
CCreatorConnectionSettingsBase* TCreatorFactory::CreateConnectionSettingsL(CCreatorEngine* aEngine)
--- a/creator/engine/src/creator_file.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_file.cpp Fri May 14 16:10:39 2010 +0300
@@ -16,7 +16,7 @@
*/
-#include <drmrights.h>
+#include <DRMRights.h>
#include "engine.h"
#include "enginewrapper.h"
@@ -129,10 +129,12 @@
//----------------------------------------------------------------------------
-TBool CCreatorFiles::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorFiles::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorFiles::AskDataFromUserL");
+ CCreatorModuleBase::AskDataFromUserL( aCommand );
+
if ( aCommand == ECmdDeleteCreatorFiles )
{
return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all files created with Creator?") );
@@ -144,7 +146,7 @@
iDirectoryQueriedFromUser->Des().Copy( KNullDesC );
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?")))
+ if (iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?")))
{
// set a default directory (eg. c:\Nokia\Images\)
TFileName directory;
@@ -580,7 +582,7 @@
//encDlg->ListBox()->SetCurrentItemIndexAndDraw( 0 );
// create a popup list
- if ( iEngine->GetEngineWrapper()->PopupListDialog(_L("Encryption"), items, encIndex) )
+ if ( iEngine->GetEngineWrapper()->PopupListDialog(_L("Encryption"), items, &encIndex, this, 1) )
{
if ( encIndex > 0 )
{
@@ -612,8 +614,8 @@
TBool CCreatorFiles::AskDRMCDDataFromUserL()
{
LOGSTRING("Creator: CCreatorFiles::AskDRMCDDataFromUserL");
- TInt count( 0 );
- if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( count, _L("How many counts\r\n(0=unlimited)?"), ETrue ) )
+ TInt count(0);
+ if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( &iDummy, _L("How many counts\r\n(0=unlimited)?"), ETrue ) )
{
if ( count > 0 )
{
@@ -680,7 +682,7 @@
*/
TInt minutes( 0 );
- if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( minutes, _L("How many minutes until expire (0=unlimited)?"), ETrue ) )
+ if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( &iDummy, _L("How many minutes until expire (0=unlimited)?"), ETrue ) )
{
if ( minutes > 0 )
{
--- a/creator/engine/src/creator_fileelement.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_fileelement.cpp Fri May 14 16:10:39 2010 +0300
@@ -18,8 +18,8 @@
#include "creator_fileelement.h"
-#include <drmpermission.h>
-#include <drmconstraint.h>
+#include <DrmPermission.h>
+#include <DrmConstraint.h>
#include "creator_traces.h"
#include "creator_file.h"
--- a/creator/engine/src/creator_landmark.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_landmark.cpp Fri May 14 16:10:39 2010 +0300
@@ -16,8 +16,8 @@
*/
-#include <epos_cposlandmarkdatabase.h>
-#include <epos_cposlmcategorymanager.h>
+#include <EPos_CPosLandmarkDatabase.h>
+#include <EPos_CPosLmCategoryManager.h>
#include <lbsposition.h>
#include "engine.h"
@@ -353,18 +353,21 @@
/**
*
*/
-TBool CCreatorLandmarks::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorLandmarks::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorLandmarks::AskDataFromUserL");
+
+ CCreatorModuleBase::AskDataFromUserL( aCommand );
+
if ( aCommand == ECmdDeleteLandmarks )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks?"), this, ECreatorModuleDelete );
}
else if ( aCommand == ECmdDeleteCreatorLandmarks )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks created with Creator?"), this, ECreatorModuleDelete );
}
- return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many landmarks to create?"));
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many landmarks to create?"), EFalse, this, ECreatorModuleStart );
}
/**
--- a/creator/engine/src/creator_log.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_log.cpp Fri May 14 16:10:39 2010 +0300
@@ -105,18 +105,62 @@
//----------------------------------------------------------------------------
-TBool CCreatorLogs::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+void CCreatorLogs::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+ {
+ LOGSTRING("Creator: CCreatorModuleBase::QueryDialogClosedL");
+
+ if( aPositiveAction == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ return;
+ }
+
+ TBool finished(EFalse);
+ TBool retval(ETrue);
+ switch(aUserData)
+ {
+ case ECreatorLogsDelete:
+ iEntriesToBeCreated = 1;
+ finished = ETrue;
+ break;
+ case ECreatorLogsStart:
+ finished = ETrue;
+ break;
+ default:
+ //some error
+ retval = EFalse;
+ break;
+ }
+ if( retval == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ }
+ else if( finished )
+ {
+ // add this command to command array
+ iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+ // started exucuting commands
+ iEngine->ExecuteFirstCommandL( KSavingText );
+ }
+ }
+
+//----------------------------------------------------------------------------
+
+TBool CCreatorLogs::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorLogs::AskDataFromUserL");
+
+ iCommand = aCommand;
+
if ( aCommand == ECmdDeleteLogs )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries?"), this, ECreatorLogsDelete );
}
else if ( aCommand == ECmdDeleteCreatorLogs )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries created with Creator?"), this, ECreatorLogsDelete );
}
- return iEngine->GetEngineWrapper()->EntriesQueryDialog( aNumberOfEntries, _L("How many entries to create?") );
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorLogsStart );
}
//----------------------------------------------------------------------------
--- a/creator/engine/src/creator_mailbox.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_mailbox.cpp Fri May 14 16:10:39 2010 +0300
@@ -134,18 +134,21 @@
//----------------------------------------------------------------------------
-TBool CCreatorMailboxes::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorMailboxes::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorMailboxes::AskDataFromUserL");
+
+ CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+
if ( aCommand == ECmdDeleteMailboxes )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes?"), this, ECreatorModuleDelete );
}
else if ( aCommand == ECmdDeleteCreatorMailboxes )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes created with Creator?"), this, ECreatorModuleDelete );
}
- return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
}
--- a/creator/engine/src/creator_message.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_message.cpp Fri May 14 16:10:39 2010 +0300
@@ -123,187 +123,129 @@
//----------------------------------------------------------------------------
-TBool CCreatorMessages::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+void CCreatorMessages::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+ {
+ LOGSTRING("Creator: CCreatorMessages::QueryDialogClosedL");
+
+ if( aPositiveAction == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ return;
+ }
+
+ TBool finished(EFalse);
+ TBool retval(ETrue);
+ switch(aUserData)
+ {
+ case ECreatorMessagesDelete:
+ iEntriesToBeCreated = 1;
+ finished = ETrue;
+ break;
+ case ECreatorMessagesStart:
+ // message type query
+ retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message type"), R_MESSAGE_TYPE_QUERY, (TInt*) &iMessageType, this, ECreatorMessagesMessageType);
+ break;
+ case ECreatorMessagesMessageType:
+ retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Folder type"), R_FOLDER_TYPE_QUERY, (TInt*) &iFolderType, this, ECreatorMessagesFolderType);
+ break;
+ case ECreatorMessagesFolderType:
+ // query create as unread
+ retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message status"), R_UNREAD_QUERY, (TInt*)&iCreateAsUnread, this, ECreatorMessagesMessageStatus);
+ break;
+ case ECreatorMessagesMessageStatus:
+ if( iMessageType == ESMS || iMessageType == EMMS || iMessageType == EEmail )
+ {
+ iDefinedMessageLength = 100;
+ retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iDefinedMessageLength, _L("Amount of characters in message body?"), ETrue,
+ this, ECreatorMessagesCharsInBody
+ );
+ break;
+ }
+ else
+ {
+ iDefinedMessageLength = 0;
+ // goto query attachments ... :-) DO NOT break;
+ }
+ case ECreatorMessagesCharsInBody:
+ // query attachments
+ iAttachments->Reset();
+ if( iMessageType == EMMS || iMessageType == EEmail)
+ {
+ retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_MULTI_SELECTION_QUERY,
+ iAttachments, this, ECreatorMessagesAttachment
+ );
+ }
+ else if( iMessageType == EAMS )
+ {
+ iAttachments->AppendL( TInt(0) );
+ retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY,
+ &iAttachments->At(0), this, ECreatorMessagesAttachment
+ );
+ }
+ else if( iMessageType == EIrMessage || iMessageType == EBTMessage )
+ {
+ iAttachments->AppendL( TInt(0) );
+ retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_SINGLE_SELECTION_QUERY,
+ &iAttachments->At(0), this, ECreatorMessagesAttachment
+ );
+ }
+ else
+ {
+ finished = ETrue;
+ }
+ break;
+ case ECreatorMessagesAttachment:
+ finished = ETrue;
+ if(iMessageType== EMMS || iMessageType == EEmail)
+ {
+ // "none" is selected
+ if (iAttachments->At(0) == 0)
+ {
+ iAttachments->Reset();
+ }
+ else // otherwise fix indexes
+ {
+ for (TInt i=0; i<iAttachments->Count(); i++)
+ iAttachments->At(i)--; // decrease value by one
+
+ }
+ }
+ break;
+ default:
+ //some error
+ retval = EFalse;
+ break;
+ }
+ if( retval == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ }
+ else if( finished )
+ {
+ // add this command to command array
+ iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+ // started exucuting commands
+ iEngine->ExecuteFirstCommandL( KSavingText );
+ }
+ }
+//----------------------------------------------------------------------------
+
+TBool CCreatorMessages::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorMessages::AskDataFromUserL");
+ CCreatorModuleBase::AskDataFromUserL(aCommand);
+
if ( aCommand == ECmdDeleteMessages )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages?"), this, ECreatorMessagesDelete );
}
else if ( aCommand == ECmdDeleteCreatorMessages )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages created with Creator?"), this, ECreatorMessagesDelete );
}
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?")))
- {
-
- // message type query
- if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message type"), R_MESSAGE_TYPE_QUERY, (TInt&) iMessageType))
- {
- if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Folder type"), R_FOLDER_TYPE_QUERY, (TInt&) iFolderType))
- {
- /*
- 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; i<entrySelection->Count(); 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
- if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message status"), R_UNREAD_QUERY, (TInt&)iCreateAsUnread))
- {
- // query number of characters in msg body
- switch (iMessageType)
- {
- case ESMS:
- case EMMS:
- case EEmail:
- {
- iDefinedMessageLength = 100;
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(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:
- {
- if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_MULTI_SELECTION_QUERY, iAttachments))
- {
- // "none" is selected
- if (iAttachments->At(0) == 0)
- iAttachments->Reset();
- else // otherwise fix indexes
- {
- for (TInt i=0; i<iAttachments->Count(); i++)
- iAttachments->At(i)--; // decrease value by one
-
- }
- }
- else
- return EFalse;
-
- break;
- }
- case EAMS:
- {
- iAttachments->AppendL( TInt(0) );
- if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY, iAttachments->At(0)))
- {
- ;
- }
- else
- return EFalse;
-
- break;
- }
-
- case EIrMessage:
- case EBTMessage:
- {
- iAttachments->AppendL( TInt(0) );
- if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_SINGLE_SELECTION_QUERY, iAttachments->At(0)))
- {
- ;
- }
- else
- return EFalse;
-
- break;
- }
- default: break;
- }
-
- return ETrue; // all queries accepted
-
- }
- else
- return EFalse;
- }
- else
- return EFalse;
- }
- else
- return EFalse;
-
- }
- // else
- return EFalse;
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorMessagesStart );
}
//----------------------------------------------------------------------------
--- a/creator/engine/src/creator_note.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_note.cpp Fri May 14 16:10:39 2010 +0300
@@ -80,7 +80,8 @@
{
LOGSTRING("Creator: CCreatorNotepad::~CCreatorNotepad");
- delete iNotepadApi;
+ // TODO DELETE!!!
+ //delete iNotepadApi;
if (iParameters)
delete iParameters;
@@ -88,19 +89,21 @@
//----------------------------------------------------------------------------
-TBool CCreatorNotepad::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorNotepad::AskDataFromUserL(TInt aCommand)
{
LOGSTRING("Creator: CCreatorNotepad::AskDataFromUserL");
+ CCreatorModuleBase::AskDataFromUserL(aCommand);
+
if ( aCommand == ECmdDeleteNotes )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Notes?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Notes?"), this, ECreatorModuleDelete );
}
// By Creator not supported because
// note id is not available via Notepad API
- return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
}
--- a/creator/engine/src/creator_phonebook.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_phonebook.cpp Fri May 14 16:10:39 2010 +0300
@@ -18,6 +18,7 @@
#include "engine.h"
#include "enginewrapper.h"
+#include "creator_contactsetcache.h"
#include "creator_phonebook.h"
#include "creator_traces.h"
@@ -49,6 +50,11 @@
{ (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldRegion).operator QString(), (TInt) CCreatorEngine::EState},
{ (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldPostcode).operator QString(), (TInt) CCreatorEngine::EPostcode},
{ (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldCountry).operator QString(), (TInt) CCreatorEngine::ECountry},
+ { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldStreet).operator QString(), (TInt) CCreatorEngine::EAddress},
+ { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldLocality).operator QString(), (TInt) CCreatorEngine::ECity},
+ { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldRegion).operator QString(), (TInt) CCreatorEngine::EState},
+ { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldPostcode).operator QString(), (TInt) CCreatorEngine::EPostcode},
+ { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldCountry).operator QString(), (TInt) CCreatorEngine::ECountry},
{ (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldStreet).operator QString(), (TInt) CCreatorEngine::EAddress},
{ (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldLocality).operator QString(), (TInt) CCreatorEngine::ECity},
{ (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldRegion).operator QString(), (TInt) CCreatorEngine::EState},
@@ -64,48 +70,17 @@
{ (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldCustomLabel).operator QString(), (TInt) CCreatorEngine::EFirstName}
};
-/*TInt CreatorVPbkBinaryFields[] = {
- R_VPBK_FIELD_TYPE_CALLEROBJIMG//,
- //R_VPBK_FIELD_TYPE_THUMBNAILPATH
- };*/
-/*QString CreatorPbkDateTimeFields[] = {
- QContactAnniversary::DefinitionName//R_VPBK_FIELD_TYPE_ANNIVERSARY
- };*/
-
-//----------------------------------------------------------------------------
-
-/*
typedef struct{
QString iFieldContext;
QString iFieldString;
}PhoneNumInfo;
PhoneNumInfo CreatorPhoneNumberFields[] =
{
- { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeLandline},
- { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeLandline},
- { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeMobile},
- { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeMobile},
- { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeFacsimile},
- { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeFacsimile},
- { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypePager },
- { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeVideo },
- { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeVideo },
- { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeVoice },
- { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeVoice },
- { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeAssistant },
- { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeCar }
- };
-
-*/
-typedef struct{
-QString iFieldContext;
-QString iFieldString;
-}PhoneNumInfo;
-PhoneNumInfo CreatorPhoneNumberFields[] =
- {
+ { "", "Landline"},
{ "Home", "Landline"},
{ "Work", "Landline"},
+ { "","Mobile"},
{ "Home","Mobile"},
{ "Work", "Mobile"},
{ "Home", "Facsimile"},
@@ -118,25 +93,6 @@
};
-/*QString CCreatorPhonebook::iPhoneNumberFields[] =
- {
- {QContactPhoneNumber::SubTypeLandline},
- {QContactPhoneNumber::SubTypeMobile},
- {QContactPhoneNumber::SubTypeFacsimile},
- {QContactPhoneNumber::SubTypePager},
- {QContactPhoneNumber::SubTypeVideo},
- {QContactPhoneNumber::SubTypeVoice} ,
- {QContactPhoneNumber::SubTypeAssistant},
- {QContactPhoneNumber::SubTypeCar}
- };
-*/
-/*
-QStringList CreatorPbkContextFields =
- {
- QContactDetail::ContextHome,
- QContactDetail::ContextWork
- };
-*/
QString CreatorPbkEmailFields[] =
{
//R_VPBK_FIELD_TYPE_EMAILGEN,
@@ -240,38 +196,33 @@
//----------------------------------------------------------------------------
-TBool CCreatorPhonebook::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
- {
- LOGSTRING("Creator: CCreatorPhonebook::AskDataFromUserL");
-
- TBool ret = CCreatorPhonebookBase::AskDataFromUserL(aCommand, aNumberOfEntries);
-
- if(ret && aCommand == ECmdCreatePhoneBookEntryContacts && !iDefaultFieldsSelected)
- {
- iAddAllFields = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add all the other fields to contacts?"));
- }
- return ret;
- }
-
-
-//----------------------------------------------------------------------------
-
TInt CCreatorPhonebook::CreateContactEntryL(CCreatorModuleBaseParameters *aParameters)
{
- TInt err=0;
-
- InitializeContactParamsL();
+ TInt err = KErrNone;
+ delete iParameters;
+ iParameters = 0;
+ CPhonebookParameters* parameters = 0;
+ //InitializeContactParamsL();
+
+ if( aParameters == 0 )
+ {
+ InitializeContactParamsL();
+ parameters = iParameters;
+ }
+ else
+ {
+ parameters = (CPhonebookParameters*) aParameters;
+ }
+
bool success = false;
// create a new contact item
- //iStore = new QContact();
-
QContact iStore;
- int numberOfFields = iParameters->iContactFields.count();
+ int numberOfFields = parameters->iContactFields.count();
QString phone;
for(int i=0; i< numberOfFields; i++ )
{
- QContactDetail* cntdet = new QContactDetail(iParameters->iContactFields.at(i));
+ QContactDetail* cntdet = new QContactDetail(parameters->iContactFields.at(i));
success = iStore.saveDetail( cntdet );
delete cntdet;
}
@@ -279,7 +230,31 @@
iContactMngr->saveContact( &iStore );
iContactsToDelete.Append( (TUint32)iStore.localId() );
- //delete iStore;
+
+ // 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<CCreatorContactSet>& contactsets = ContactLinkCache::Instance()->ContactSets();
+ TBool setFound(EFalse);
+ for(TInt i = 0; i < contactsets.Count(); ++i )
+ {
+ if( contactsets[i]->LinkId() == parameters->ScriptLinkId() )
+ {
+ if( iStore.localId() )
+ {
+ contactsets[i]->AppendL( iStore.localId() );
+ iContactLinkArray.AppendL( (TUint32)iStore.localId() );
+ }
+ setFound = ETrue;
+ break;
+ }
+ }
+ if( !setFound )
+ {
+ LOGSTRING2("Error: Contact set id %d not found.", parameters->ScriptLinkId());
+ }
+ }
+
return err;
}
@@ -319,12 +294,7 @@
}
}
DeleteContactsL( groups );
-/*
- User::LeaveIfNull( iStore );
- MVPbkContactLinkArray* groups = iStore->ContactGroupsLC();
- DeleteContactsL( groups, ETrue );
- CleanupStack::PopAndDestroy(); // cannot use groups as parameter
- */
+
}
//----------------------------------------------------------------------------
@@ -339,7 +309,7 @@
{
//QList<QContactLocalId> contacts = iContactMngr->contactIds();
QMap<int, QContactManager::Error> errorMap;
- iContactMngr->removeContacts( &aContacts, &errorMap );
+ iContactMngr->removeContacts( aContacts, &errorMap );
}
//----------------------------------------------------------------------------
@@ -379,7 +349,7 @@
}
//----------------------------------------------------------------------------
-void CCreatorPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore )
+void CCreatorPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid /*aStoreUid*/, CDictionaryFileStore* /*aStore*/ )
{
}
@@ -399,7 +369,10 @@
if( aDetail == QContactPhoneNumber::DefinitionName)
{
QContactPhoneNumber phoneNumber;// = contactDetail;
- phoneNumber.setContexts(aFieldContext);
+ if(!aFieldContext.isEmpty())
+ {
+ phoneNumber.setContexts(aFieldContext);
+ }
phoneNumber.setSubTypes(aFieldString);
contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
QString number = QString::fromUtf16(contentData.Ptr(),contentData.Length());
@@ -491,12 +464,9 @@
}
if(aFieldString == QContactOrganization::FieldDepartment)
{
- //if(contactCompany.department().isEmpty())
- //{
QStringList depList = contactCompany.department();
depList.append(company);
contactCompany.setDepartment(depList);
- //}
}
if(aFieldString == QContactOrganization::FieldAssistantName)
{
@@ -636,7 +606,6 @@
QDate date;
TTime datetime = iEngine->RandomDate( CCreatorEngine::EDateFuture );
date.setDate( datetime.DateTime().Year(),(int) (datetime.DateTime().Month()+1), datetime.DateTime().Day() );
- //contactAnniversary.setEvent(QContactAnniversary::);
contactAnniversary.setOriginalDate( date );
return contactAnniversary;
}
@@ -711,41 +680,6 @@
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-/*TInt CCreatorPhonebook::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 CCreatorPhonebook::iUrlFields[] =
- {
- R_VPBK_FIELD_TYPE_URLGEN,
- R_VPBK_FIELD_TYPE_URLHOME,
- R_VPBK_FIELD_TYPE_URLWORK
- };*/
-
-/*TInt CCreatorPhonebook::iEmailFields[] =
- {
- R_VPBK_FIELD_TYPE_EMAILGEN,
- R_VPBK_FIELD_TYPE_EMAILHOME,
- R_VPBK_FIELD_TYPE_EMAILWORK
- };*/
void CCreatorPhonebook::InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/)
{
@@ -773,74 +707,40 @@
TInt textFieldCount = sizeof(CreatorPbkMiscTextFields) / sizeof(DetailFieldInfo);
for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
{
- QContactDetail field = CreateContactDetail( CreatorPbkMiscTextFields[tfIndex].iDetail, CreatorPbkMiscTextFields[tfIndex].iFieldContext, CreatorPbkMiscTextFields[tfIndex].iFieldString, CreatorPbkMiscTextFields[tfIndex].iRandomType );
- bool replace = false;
- for(int i = 0 ; i< iParameters->iContactFields.count() ; i++)
- {
- if( !field.isEmpty() && field.definitionName() == iParameters->iContactFields.at(i).definitionName() )
- {
- QString context = field.value(QContactDetail::FieldContext);
- bool isContextEmpty = context.isEmpty();
- if( isContextEmpty || ( field.value(QContactDetail::FieldContext) == iParameters->iContactFields.at(i).value(QContactDetail::FieldContext)) )
- {
- //replace
- iParameters->iContactFields.replace(i,field);
- replace = true;
- }
- }
- }
- if(!replace)
- {
- if(!field.isEmpty())
- {
- iParameters->iContactFields.append(field);
- }
- }
+// QContactDetail field = CreateContactDetail( CreatorPbkMiscTextFields[tfIndex].iDetail, CreatorPbkMiscTextFields[tfIndex].iFieldContext, CreatorPbkMiscTextFields[tfIndex].iFieldString, CreatorPbkMiscTextFields[tfIndex].iRandomType );
+
+ CCreatorContactField* field = CCreatorContactField::NewL();
+ CleanupStack::PushL( field );
+ QContactDetail cntDetail = field->CreateContactDetail(iEngine,iParameters,CreatorPbkMiscTextFields[tfIndex].iDetail, CreatorPbkMiscTextFields[tfIndex].iFieldContext, CreatorPbkMiscTextFields[tfIndex].iFieldString, CreatorPbkMiscTextFields[tfIndex].iRandomType );
+ if(!cntDetail.isEmpty())
+ {
+ field->AddFieldToParam( iParameters, cntDetail ); //it will do "param->iContactFields.AppendL(field);"
+ }
+ CleanupStack::Pop( field );
}
// Add binary fields:
- QContactDetail field = CreateContactDetail(QContactAvatar::DefinitionName,"","",0);
- iParameters->iContactFields.append(field);
+ TPtrC emptyData;
+ CCreatorContactField* fieldPicture = CCreatorContactField::NewL();
+ CleanupStack::PushL( fieldPicture );
+ QContactDetail cntDetail = fieldPicture->CreateContactDetail(iEngine,iParameters,QContactAvatar::DefinitionName,"","",emptyData );
+ if(!cntDetail.isEmpty())
+ {
+ fieldPicture->AddFieldToParam( iParameters, cntDetail ); //it will do "param->iContactFields.AppendL(field);"
+ }
+ CleanupStack::Pop( fieldPicture );
// Add date-time fields:
- QContactDetail fieldAnniv = CreateContactDetail(QContactAnniversary::DefinitionName,"","",0);
- iParameters->iContactFields.append(fieldAnniv);
- //***************************************************************************
- // Add text fields:
- /* TInt textFieldCount = sizeof(CreatorVPbkMiscTextFields) / sizeof(FieldInfo);
- for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
- {
- //QContactDetail field;
- 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));
- }
+ CCreatorContactField* fieldAnniv = CCreatorContactField::NewL();
+ CleanupStack::PushL( fieldAnniv );
+ QContactDetail cntDetAnniv = fieldAnniv->CreateContactDetail(iEngine,iParameters,QContactAnniversary::DefinitionName,"","",emptyData );
+ if(!cntDetAnniv .isEmpty())
+ {
+ fieldAnniv->AddFieldToParam( iParameters, cntDetAnniv ); //it will do "param->iContactFields.AppendL(field);"
+ }
+ CleanupStack::Pop( fieldAnniv );
- AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJIMG, KNullDesC8);
- AddFieldToParamsL(R_VPBK_FIELD_TYPE_THUMBNAILPIC, KNullDesC8);
- AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJTEXT, firstname);*/
//***************************************************************************
- //iParameters->iContactFields.append( name );
}
else
{
@@ -862,8 +762,10 @@
QContactPhoneNumber phoneNum;
TPtrC phoneNumber = iEngine->RandomString(CCreatorEngine::EPhoneNumber);
QString phone = QString::fromUtf16( phoneNumber.Ptr(), phoneNumber.Length() );
-
- phoneNum.setContexts(CreatorPhoneNumberFields[inc].iFieldContext);
+ if(!CreatorPhoneNumberFields[inc].iFieldContext.isEmpty())
+ {
+ phoneNum.setContexts(CreatorPhoneNumberFields[inc].iFieldContext);
+ }
phoneNum.setSubTypes(CreatorPhoneNumberFields[inc].iFieldString);
@@ -877,29 +779,29 @@
// URLs:
for( int i=0; i<iNumberOfURLFields; i++ )
- {
- QContactUrl contactUrl;
- HBufC16* url = iEngine->CreateHTTPUrlLC();
- QString urlAddress = QString::fromUtf16(url->Ptr(), url->Length() );
- contactUrl.setUrl( urlAddress );
- iParameters->iContactFields.append( contactUrl );
- CleanupStack::PopAndDestroy(url);
- }
+ {
+ CCreatorContactField* fieldUrl = CCreatorContactField::NewL();
+ CleanupStack::PushL( fieldUrl );
+ QContactDetail cntDetUrl = fieldUrl->CreateContactDetail(iEngine,iParameters,QContactUrl::DefinitionName,"","",KErrNotFound );
+ if(!cntDetUrl.isEmpty())
+ {
+ fieldUrl->AddFieldToParam( iParameters, cntDetUrl ); //it will do "param->iContactFields.AppendL(field);"
+ }
+ CleanupStack::Pop( fieldUrl );
+
+ }
// EMail addresses:
for( int i=0; i<iNumberOfEmailAddressFields; i++ )
{
- QContactEmailAddress emailAddr;
- HBufC16* addr= iEngine->CreateEmailAddressLC();;
- /*TPtrC comp = iEngine->RandomString(CCreatorEngine::ECompany);
- QString company = QString::fromUtf16( comp.Ptr(), comp.Length() );
- QString address = firstname+"@"+company+".com";*/
- //CreatorPbkEmailFields
- QString address = QString::fromUtf16(addr->Ptr(), addr->Length() );
- emailAddr.setEmailAddress( address );
- emailAddr.setContexts(CreatorPbkEmailFields[i%2]);
- iParameters->iContactFields.append( emailAddr );
- CleanupStack::PopAndDestroy(addr);
+ CCreatorContactField* fieldEmail = CCreatorContactField::NewL();
+ CleanupStack::PushL( fieldEmail );
+ QContactDetail cntDetEmail = fieldEmail->CreateContactDetail(iEngine,iParameters,QContactEmailAddress::DefinitionName,"","",KErrNotFound );
+ if(!cntDetEmail.isEmpty())
+ {
+ fieldEmail->AddFieldToParam( iParameters, cntDetEmail ); //it will do "param->iContactFields.AppendL(field);"
+ }
+ CleanupStack::Pop( fieldEmail );
}
}
@@ -907,8 +809,13 @@
// Checks if the link is a group or not
-TBool CCreatorPhonebook::IsContactGroupL()
+TBool CCreatorPhonebook::IsContactGroupL( QContactLocalId& aLink )
{
+ QContact group = iContactMngr->contact( aLink );
+ if( group.type() == QContactType::TypeGroup )
+ {
+ return ETrue;
+ }
return EFalse;
}
@@ -938,7 +845,7 @@
QContact newGroup;
newGroup.setType(QContactType::TypeGroup);
QContactName newGroupName;
- newGroupName.setCustomLabel( iParameters->iGroupName );
+ newGroupName.setCustomLabel( parameters->iGroupName );
newGroup.saveDetail(&newGroupName);
iContactMngr->saveContact(&newGroup);
QContactLocalId newGroupId = newGroup.localId();
@@ -958,10 +865,10 @@
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<MVPbkContactLink>& links = set.ContactLinks();
+ const RArray<QContactLocalId> links = set.ContactLinks();//ContactLinkCache::Instance()->ContactSets();//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;
@@ -973,23 +880,28 @@
for( TInt j = 0; j < links.Count() && addedMembers < maxAmount; ++j )
{
- MVPbkContactLink* link = links[j];
- if( link && IsContactGroupL(*link) == EFalse )
+ QContactLocalId link = links[j];
+ QContact contactLink = iContactMngr->contact( link );
+ if( link && IsContactGroupL( link ) == EFalse )
{
- TRAPD(err, newGroup->AddContactL(*link));
- if( err != KErrAlreadyExists )
- {
- // Ignore "allready exists" -error
- User::LeaveIfError(err);
- ++addedMembers;
- }
+ //QList<QContactRelationship> relationships = contactLink.relationships(QContactRelationship::HasMember);
+ if(/*!relationships.count() && */contactLink.type() == QContactType::TypeContact ) //just for contacts that are not in relationship - not in group yet
+ {
+ QContactRelationship* contactRel = new QContactRelationship();
+ contactRel->setRelationshipType(QContactRelationship::HasMember);
+ contactRel->setFirst(newGroup.id());
+ contactRel->setSecond( contactLink.id() );
+ iContactMngr->saveRelationship( contactRel );
+ delete contactRel;
+ ++addedMembers;
+ }
}
}
if( addedMembers < maxAmount )
{
// Add existing contacts, withing the limits set by maxAmount:
amountOfContactsToBeAdded += maxAmount - addedMembers;
- }*/
+ }
}
}
if( amountOfContactsToBeAdded > 0 )
@@ -1049,6 +961,383 @@
//----------------------------------------------------------------------------
+CCreatorContactField::CCreatorContactField()
+ {
+ }
+CCreatorContactField::~CCreatorContactField()
+ {
+ }
+
+CCreatorContactField* CCreatorContactField::NewL()
+ {
+ CCreatorContactField* self = new (ELeave) CCreatorContactField();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+void CCreatorContactField::ConstructL()
+ {
+ //pImpl = CCreatorContactTextField::NewL(aFieldType, aData);
+ }
+QContactDetail CCreatorContactField::CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TInt aRand )
+ {
+ QContactDetail emptyDet;
+ TPtrC contentData;
+ HBufC16* tempData = 0;
+ if(aRand == KErrNotFound)
+ {
+ TInt textFieldCount = sizeof(CreatorPbkMiscTextFields) / sizeof(DetailFieldInfo);
+ for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
+ {
+ if( CreatorPbkMiscTextFields[tfIndex].iDetail == aDetail && CreatorPbkMiscTextFields[tfIndex].iFieldContext == aFieldContext && CreatorPbkMiscTextFields[tfIndex].iFieldString == aFieldString)
+ {
+ aRand = CreatorPbkMiscTextFields[tfIndex].iRandomType;
+ }
+ }
+ }
+
+ if( aRand != KErrNotFound )
+ {
+ contentData.Set(aEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
+ }
+ else
+ {
+ if( aDetail == QContactPhoneNumber::DefinitionName )
+ {
+ contentData.Set(aEngine->RandomString(CCreatorEngine::EPhoneNumber));
+ }
+ else if( aDetail == QContactEmailAddress::DefinitionName )
+ {
+ tempData = aEngine->CreateEmailAddressLC();
+ contentData.Set( tempData->Des() );
+ }
+ else if( aDetail == QContactUrl::DefinitionName )
+ {
+ tempData = aEngine->CreateHTTPUrlLC();
+ contentData.Set( tempData->Des() );
+ }
+ else
+ {
+ return emptyDet;
+ }
+ }
+ emptyDet = CreateContactDetail( aEngine, aParameters, aDetail, aFieldContext, aFieldString, contentData );
+ if( tempData )
+ {
+ CleanupStack::PopAndDestroy( tempData );
+ }
+ return emptyDet;
+ }
+
+QContactDetail CCreatorContactField::CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TPtrC aData )
+ {
+ QContactDetail contactDetail;
+
+ if( aDetail == QContactPhoneNumber::DefinitionName)
+ {
+ QContactPhoneNumber phoneNumber;// = contactDetail;
+ if(!aFieldContext.isEmpty())
+ {
+ phoneNumber.setContexts(aFieldContext);
+ }
+ phoneNumber.setSubTypes(aFieldString);
+ QString number = QString::fromUtf16(aData.Ptr(),aData.Length());
+ phoneNumber.setNumber(number);
+ return phoneNumber;
+ }
+ else if( aDetail == QContactName::DefinitionName ) //--Contact NAME-----------------------------
+ {
+ QContactName contactName;
+ for(int i = 0 ; i < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+ {
+ if(aParameters->iContactFields.at(i).definitionName() == QContactName::DefinitionName )
+ {
+ contactName = aParameters->iContactFields.at(i);
+ }
+ }
+ QString name = QString::fromUtf16(aData.Ptr(),aData.Length());
+ if(aFieldString == QContactName::FieldFirstName)
+ {
+ if(contactName.firstName().isEmpty())
+ {
+ contactName.setFirstName( name );
+ }
+ }
+ else if(aFieldString == QContactName::FieldLastName)
+ {
+ if(contactName.lastName().isEmpty())
+ {
+ contactName.setLastName( name );
+ }
+ }
+ else if(aFieldString == QContactName::FieldMiddleName)
+ {
+ if(contactName.middleName().isEmpty())
+ {
+ contactName.setMiddleName( name );
+ }
+ }
+ else if(aFieldString == QContactName::FieldPrefix)
+ {
+ if(contactName.prefix().isEmpty())
+ {
+ contactName.setPrefix( name );
+ }
+ }
+ else if(aFieldString == QContactName::FieldSuffix)
+ {
+ if(contactName.suffix().isEmpty())
+ {
+ contactName.setSuffix( name );
+ }
+ }
+ else //QContactName::FieldCustomLabel:
+ {
+ if(contactName.customLabel().isEmpty())
+ {
+ contactName.setCustomLabel( name );
+ }
+ }
+ return contactName;
+ }
+ else if( aDetail == QContactOrganization::DefinitionName ) //--Contact Company-----------------------------
+ {
+ QContactOrganization contactCompany;
+
+ for(int i = 0 ; i < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+ {
+ if(aParameters->iContactFields.at(i).definitionName() == QContactOrganization::DefinitionName )
+ {
+ contactCompany = aParameters->iContactFields.at(i);
+ }
+ }
+
+ QString company = QString::fromUtf16(aData.Ptr(),aData.Length());
+ if(aFieldString == QContactOrganization::FieldName)
+ {
+ if(contactCompany.name().isEmpty())
+ {
+ contactCompany.setName( company );
+ }
+ }
+ if(aFieldString == QContactOrganization::FieldTitle)
+ {
+ if(contactCompany.title().isEmpty())
+ {
+ contactCompany.setTitle( company );
+ }
+ }
+ if(aFieldString == QContactOrganization::FieldDepartment)
+ {
+ QStringList depList = contactCompany.department();
+ depList.append(company);
+ contactCompany.setDepartment(depList);
+ }
+ if(aFieldString == QContactOrganization::FieldAssistantName)
+ {
+ if(contactCompany.assistantName().isEmpty())
+ {
+ contactCompany.setAssistantName( company );
+ }
+ }
+ return contactCompany;
+ }
+ else if( aDetail == QContactAddress::DefinitionName ) //--Contact Address-----------------------------
+ {
+ QContactAddress contactAddress;
+
+ for(int i = 0 ; i < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+ {
+ if(aParameters->iContactFields.at(i).definitionName() == QContactAddress::DefinitionName && aParameters->iContactFields.at(i).value(QContactDetail::FieldContext) == aFieldContext )
+ {
+ contactAddress = aParameters->iContactFields.at(i);
+ }
+ }
+ if( !aFieldContext.isEmpty() )
+ {
+ contactAddress.setContexts( aFieldContext );
+ }
+ QString address = QString::fromUtf16(aData.Ptr(),aData.Length());
+ if(aFieldString == QContactAddress::FieldStreet )
+ {
+ if( contactAddress.street().isEmpty() )
+ {
+ contactAddress.setStreet( address );
+ }
+ }
+ else if(aFieldString == QContactAddress::FieldLocality )
+ {
+ if( contactAddress.locality().isEmpty() )
+ {
+ contactAddress.setLocality( address );
+ }
+ }
+ else if(aFieldString == QContactAddress::FieldRegion )
+ {
+ if( contactAddress.region().isEmpty() )
+ {
+ contactAddress.setRegion( address );
+ }
+ }
+ else if(aFieldString == QContactAddress::FieldPostcode )
+ {
+ if( contactAddress.postcode().isEmpty() )
+ {
+ contactAddress.setPostcode( address );
+ }
+ }
+ else if(aFieldString == QContactAddress::FieldCountry )
+ {
+ if( contactAddress.country().isEmpty() )
+ {
+ contactAddress.setCountry( address );
+ }
+ }
+ else
+ {
+ return contactDetail;
+ }
+ return contactAddress;
+ }
+ else if( aDetail == QContactNote::DefinitionName ) //--Contact Note-----------------------------
+ {
+ QContactNote contactNote;
+ QString note = QString::fromUtf16(aData.Ptr(),aData.Length());
+ contactNote.setNote(note);
+ return contactNote;
+ }
+ else if( aDetail == QContactFamily::DefinitionName ) //--Contact Family-----------------------------
+ {
+ QContactFamily contactFamily;
+
+ for(int i = 0 ; i < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+ {
+ if(aParameters->iContactFields.at(i).definitionName() == QContactFamily::DefinitionName && aParameters->iContactFields.at(i).value(QContactDetail::FieldContext) == aFieldContext )
+ {
+ contactFamily = aParameters->iContactFields.at(i);
+ }
+ }
+
+ QString familyData = QString::fromUtf16(aData.Ptr(),aData.Length());
+ if(aFieldString == QContactFamily::FieldSpouse )
+ {
+ if( contactFamily.spouse().isEmpty() )
+ {
+ contactFamily.setSpouse( familyData );
+ }
+ }
+ if(aFieldString == QContactFamily::FieldChildren )
+ {
+ QStringList children = contactFamily.children();
+ children.append( familyData );
+ contactFamily.setChildren( children );
+ }
+
+ return contactFamily;
+ }
+
+ if( aDetail == QContactAvatar::DefinitionName) //--Contact Picture-----------------------------
+ {
+ RFs& fs = CCoeEnv::Static()->FsSession();
+ QContactAvatar contactAvatar;
+ TBuf<KMaxFileName> srcPath;
+ aEngine->RandomPictureFileL(srcPath);
+ TBuf<KMaxFileName> destPath(KTempPath);
+
+ if(!BaflUtils::FolderExists( fs, destPath ))
+ {
+ BaflUtils::EnsurePathExistsL( fs, destPath );
+ }
+
+ TInt err=BaflUtils::CopyFile( fs, srcPath, destPath );
+
+ TParse temp;
+ temp.Set( srcPath,NULL,NULL );
+ destPath.Append(temp.NameAndExt());
+
+ QString avatarFile = QString::fromUtf16( destPath.Ptr(),destPath.Length() );
+
+ QPixmap avatarPix(avatarFile);
+
+ contactAvatar.setAvatar(avatarFile);
+ contactAvatar.setPixmap(avatarPix);
+
+ return contactAvatar;
+ }
+ if( aDetail == QContactAnniversary::DefinitionName) //--Anniversary------------------------------
+ {
+ QContactAnniversary contactAnniversary;
+ QDate date;
+ TTime datetime = aEngine->RandomDate( CCreatorEngine::EDateFuture );
+ date.setDate( datetime.DateTime().Year(),(int) (datetime.DateTime().Month()+1), datetime.DateTime().Day() );
+ contactAnniversary.setOriginalDate( date );
+ return contactAnniversary;
+ }
+ if( aDetail == QContactEmailAddress::DefinitionName) //--Email------------------------------------
+ {
+ QContactEmailAddress email;
+ QString emailAddr = QString::fromUtf16(aData.Ptr(),aData.Length());
+ if( !aFieldContext.isEmpty() )
+ {
+ email.setContexts( aFieldContext );
+ }
+ email.setEmailAddress( emailAddr );
+ return email;
+ }
+ if( aDetail == QContactUrl::DefinitionName ) //--Url-------------------------------------------
+ {
+ QContactUrl url;
+ QString urlStr = QString::fromUtf16(aData.Ptr(),aData.Length());
+ if( !aFieldContext.isEmpty() )
+ {
+ url.setContexts( aFieldContext );
+ }
+ url.setUrl(urlStr);
+ return url;
+ }
+ if( aDetail == QContactBirthday::DefinitionName ) //--Birthday-----------------------------------
+ {
+ QContactBirthday birthday;
+ QDate date;
+ TTime datetime = aEngine->RandomDate( CCreatorEngine::EDatePast );
+ date.setDate( datetime.DateTime().Year(),(int) (datetime.DateTime().Month()+1), datetime.DateTime().Day() );
+ birthday.setDate( date );
+ return birthday;
+ }
+
+ return contactDetail;
+ }
+
+void CCreatorContactField::AddFieldToParam( CPhonebookParameters* aParam, QContactDetail aDetail)
+ {
+ bool replace = false;
+ for(int i = 0 ; i< aParam->iContactFields.count() ; i++) //go through
+ {
+ if( !aDetail.isEmpty() && aDetail.definitionName() == aParam->iContactFields.at(i).definitionName()
+ && aDetail.definitionName() != QContactPhoneNumber::DefinitionName
+ && aDetail.definitionName() != QContactEmailAddress::DefinitionName
+ && aDetail.definitionName() != QContactUrl::DefinitionName )
+ {
+ QString context = aDetail.value(QContactDetail::FieldContext);
+ bool isContextEmpty = context.isEmpty();
+ if( isContextEmpty || ( aDetail.value(QContactDetail::FieldContext) == aParam->iContactFields.at(i).value(QContactDetail::FieldContext)) )
+ {
+ //replace
+ aParam->iContactFields.replace(i,aDetail);
+ replace = true;
+ }
+ }
+ }
+ if(!replace)
+ {
+ if(!aDetail.isEmpty())
+ {
+ aParam->iContactFields.append(aDetail);
+ }
+ }
+
+ }
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
--- a/creator/engine/src/creator_phonebookbase.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_phonebookbase.cpp Fri May 14 16:10:39 2010 +0300
@@ -20,94 +20,122 @@
#include "creator_phonebookbase.h"
#include "creator_traces.h"
-TBool CCreatorPhonebookBase::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+void CCreatorPhonebookBase::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
{
- LOGSTRING("Creator: CCreatorPhonebook::AskDataFromUserL");
+ LOGSTRING("Creator: CCreatorPhonebookBase::QueryDialogClosedL");
+
+ if(aPositiveAction == EFalse && aUserData!=ECreatorPhonebookGetContactFields )
+ {
+ iEngine->ShutDownEnginesL();
+ return;
+ }
+
+ TBool finished(EFalse);
+ TBool retval(ETrue);
+ switch(aUserData)
+ {
+ case ECreatorPhonebookDelete:
+ finished = ETrue;
+ iEntriesToBeCreated = 1;
+ break;
+ case ECreatorPhonebookStart:
+ retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Fields in contact"), R_CONTACT_CREATION_TYPE_QUERY,
+ &iDummy, this, iCommand == ECmdCreatePhoneBookEntryContacts ? ECreatorPhonebookGetContactFields : ECreatorPhonebookGetGroupFields
+ );
+ break;
+ case ECreatorPhonebookGetContactFields:
+ if(!iDefaultFieldsSelected)
+ {
+ if(iDummy==0)// first item, use default fields
+
+ {
+ iDefaultFieldsSelected = ETrue;
+ retval = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add all the other fields to contacts?"), this, ECreatorPhonebookGetContactFields);
+ }
+ else
+ {
+ retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfPhoneNumberFields, _L("Amount of phone number fields in one contact?"),
+ ETrue, this, ECreatorPhonebookGetPhoneNumbersCount
+ );
+ }
+ }
+ else
+ {
+ iAddAllFields = aPositiveAction;
+ finished = ETrue;
+ }
+ break;
+ case ECreatorPhonebookGetPhoneNumbersCount:
+ retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfURLFields, _L("Amount of URL fields in one contact?"),
+ ETrue, this, ECreatorPhonebookGetUrlsCount
+ );
+ break;
+ case ECreatorPhonebookGetUrlsCount:
+ retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfEmailAddressFields, _L("Amount of email fields in one contact?"),
+ ETrue, this, ECreatorPhonebookGetEmailsCount
+ );
+ break;
+ case ECreatorPhonebookGetEmailsCount:
+ // finaly we have all informations from user, start engine
+ finished = ETrue;
+ break;
+ case ECreatorPhonebookGetGroupFields:
+ iContactsInGroup = KCreateRandomAmountOfGroups;
+ if(iDummy==0)// first item, use default fields
+ {
+ finished = ETrue;
+ }
+ else
+ {
+ retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iContactsInGroup, _L("Amount of contacts in one group?"),
+ ETrue, this, ECreatorPhonebookGetContactsInGroup);
+ }
+ break;
+ case ECreatorPhonebookGetContactsInGroup:
+ // finaly we have all informations from user, start engine
+ finished = ETrue;
+ break;
+ default:
+ //some error
+ retval = EFalse;
+ break;
+ }
+ if( retval == EFalse )
+ {
+ iEngine->ShutDownEnginesL();
+ }
+ else if( finished )
+ {
+ // add this command to command array
+ iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+ // started exucuting commands
+ iEngine->ExecuteFirstCommandL( KSavingText );
+ }
+ }
+
+TBool CCreatorPhonebookBase::AskDataFromUserL(TInt aCommand)
+ {
+ LOGSTRING("Creator: CCreatorPhonebookBase::AskDataFromUserL");
+ iCommand = aCommand;
if( aCommand == ECmdDeleteContacts )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts?"), this, ECreatorPhonebookDelete );
}
if( aCommand == ECmdDeleteCreatorContacts )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts created with Creator?"), this, ECreatorPhonebookDelete );
}
if( aCommand == ECmdDeleteContactGroups )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups?"), this, ECreatorPhonebookDelete );
}
if( aCommand == ECmdDeleteCreatorContactGroups )
{
- return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups created with Creator?") );
+ return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups created with Creator?"), this, ECreatorPhonebookDelete );
}
// display queries
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(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 (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Fields in contact"), R_CONTACT_CREATION_TYPE_QUERY, index))
- {
- if (index == 0) //first item
- {
- iDefaultFieldsSelected = ETrue;
- return ETrue;
- }
- else // detailed mode selected
- {
- iDefaultFieldsSelected = EFalse;
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberOfPhoneNumberFields, _L("Amount of phone number fields in one contact?"), ETrue))
- {
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberOfURLFields, _L("Amount of URL fields in one contact?"), ETrue))
- {
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(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 (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Fields in contact"), R_GROUP_CREATION_TYPE_QUERY, index))
- {
- if (index == 0) //first item
- {
- iContactsInGroup = KCreateRandomAmountOfGroups;
- return ETrue;
- }
- else
- {
- if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iContactsInGroup, _L("Amount of contacts in one group?"), ETrue))
- {
- return ETrue;
- }
- else
- return EFalse;
- }
- }
- else
- return EFalse;
- }
- else
- return ETrue;
- }
- else
- return EFalse;
+ return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorPhonebookStart); // ask number of entries to create
}
--- a/creator/engine/src/creator_scriptentry.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_scriptentry.cpp Fri May 14 16:10:39 2010 +0300
@@ -18,13 +18,14 @@
#include <aknlists.h>
-#include <aknsskininstance.h>
+#include <AknsSkinInstance.h>
#include <data_caging_path_literals.hrh>
#include "engine.h"
#include "enginewrapper.h"
#include "creator_traces.h"
#include "creator_factory.h"
+#include "creator_scriptentry.h"
@@ -68,24 +69,65 @@
{
LOGSTRING("Creator: CCommandParser::~CCommandParser");
- if (iSearchArray)
+ if (iSearchArray){
delete iSearchArray;
+ iSearchArray = NULL;
+ }
if (iReadBuf)
delete iReadBuf;
}
+// ---------------------------------------------------------------------------
+
+void CCommandParser::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+ {
+ User::LeaveIfNull(iSearchArray);
+
+ if( aUserData == EGetingScript && aPositiveAction && iSearchArray->Count() )
+ {
+ iObserver->FileChosenL( ETrue, iSearchArray->MdcaPoint(iSelectedItem) );
+ }
+ else if( aUserData == EGetingRandomDataFile && aPositiveAction && iSearchArray->Count() )
+ {
+ TFileName fileName;
+ if (iSelectedItem == (iSearchArray->Count() - 1))
+ {
+ // "default" (resource file) selected
+ fileName.Copy(KNullDesC);
+ }
+ else
+ {
+ // xml file selected
+ fileName.Copy(iSearchArray->MdcaPoint(iSelectedItem));
+ }
+ iObserver->FileChosenL( ETrue, fileName );
+ }
+ else
+ {
+ iObserver->FileChosenL( EFalse );
+ }
+ delete iSearchArray;
+ iSearchArray = NULL;
+ iObserver = NULL;
+ }
// ---------------------------------------------------------------------------
//#if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
void CCommandParser::OpenScriptL() {}
-TBool CCommandParser::OpenScriptL(RFile& aScriptFile)
+TBool CCommandParser::OpenScriptL(MCommandParserObserver* aObserver)
{
LOGSTRING("Creator: CCommandParser::OpenScriptL");
+
+ User::LeaveIfNull( aObserver );
+ iObserver = aObserver;
+ iSelectedItem = 0;
+
TBool ret = EFalse;
// init the search array
- iSearchArray = new(ELeave) CDesCArrayFlat(500);
+ delete iSearchArray;
+ iSearchArray = new(ELeave) CDesCArrayFlat(20);
// wait dialog
// TODO
@@ -154,70 +196,18 @@
fileNameArray->AppendL(filename.Name());
}
}
- CleanupStack::Pop(fileNameArray);
-
- // create a popup list
- int index = 0;
- TBool result = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select script"), fileNameArray, index);
- //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(index), EFileRead));
- if( err != KErrNone)
- {
- aScriptFile.Close();
- User::Leave(err);
- }
- ret = ETrue;
- }
- //CleanupStack::PopAndDestroy(); //listBox
+ ret = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select script"), fileNameArray, &iSelectedItem, this, EGetingScript);
+ CleanupStack::PopAndDestroy(fileNameArray);
}
else // no scripts found from the search paths
{
iEngine->GetEngineWrapper()->ShowNote(_L("No scripts found"));
+ delete iSearchArray;
+ iSearchArray = NULL;
}
- delete iSearchArray;
- iSearchArray = NULL;
+
return ret;
}
/*
@@ -476,72 +466,16 @@
// add "default" (resource file) to list
fileNameArray->AppendL(_L("Default"));
- CleanupStack::Pop(fileNameArray);
-
- // create a popup list
- int index = 0;
- TBool result = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select random data file"), fileNameArray, index);
- /*
- 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 (index == (fileNameArray->Count() - 1))
- {
- // "default" (resource file) selected
- aFilename.Copy(KNullDesC);
- }
- else
- {
- // xml file selected
- aFilename.Copy(iSearchArray->MdcaPoint(index));
- }
- ret = ETrue;
- }
- // CleanupStack::PopAndDestroy(); //listBox
+ ret = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select random data file"), fileNameArray, &iSelectedItem, this);
+ CleanupStack::PopAndDestroy(fileNameArray);
}
else // no random data files found from the search paths
{
iEngine->GetEngineWrapper()->ShowNote(_L("No random data files found"));
+ delete iSearchArray;
+ iSearchArray = NULL;
}
- delete iSearchArray;
- iSearchArray = NULL;
return ret;
}
--- a/creator/engine/src/creator_virtualphonebook.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_virtualphonebook.cpp Fri May 14 16:10:39 2010 +0300
@@ -297,19 +297,6 @@
}
//----------------------------------------------------------------------------
-TBool CCreatorVirtualPhonebook::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
- {
- LOGSTRING("Creator: CCreatorVirtualPhonebook::AskDataFromUserL");
- TBool ret = CCreatorPhonebookBase::AskDataFromUserL(aCommand, aNumberOfEntries);
-
- if(ret && aCommand == ECmdCreatePhoneBookEntryContacts && !iDefaultFieldsSelected)
- {
- iAddAllFields = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add all the other fields to contacts?"));
- }
- return ret;
- }
-
-//----------------------------------------------------------------------------
void CCreatorVirtualPhonebook::DeleteAllL()
{
LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllL");
--- a/creator/engine/src/creator_wepsecuritysettings.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/engine/src/creator_wepsecuritysettings.cpp Fri May 14 16:10:39 2010 +0300
@@ -21,7 +21,7 @@
#include "creator_wepsecuritysettings.h"
#include <commdb.h>
//#include <featmgr.h>
-#include <wlancdbcols.h>
+#include <WlanCdbCols.h>
//#include <commsdattypesv1_1.h>
//#include <cmmanagertablefields.h>
--- a/creator/inc/engine.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/inc/engine.h Fri May 14 16:10:39 2010 +0300
@@ -23,13 +23,14 @@
#include <e32std.h>
#include <e32base.h>
#include <f32file.h>
-#include <W32STD.H>
+#include <s32file.h>
+#include <s32mem.h>
+#include <w32std.h>
//#include <aknenv.h>
#include <coeutils.h>
#include <apparc.h>
#include <eikenv.h>
-//#include <aknprogressdialog.h>
//#include <eikprogi.h>
#include <bautils.h>
#include <commdb.h>
@@ -37,18 +38,6 @@
#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"
//class CCreatorAppUi;
@@ -63,11 +52,15 @@
class CCreatorFiles;
class CCreatorMessages;
class CCreatorLandmarks;
+class MCreatorModuleBase;
+class CCreatorPhonebookBase;
+class CCreatorModuleBaseParameters;
+class CCreatorConnectionSettingsBase;
class CDictionaryFileStore;
class CImageDecoder;
class CFbsBitmap;
class CBitmapScaler;
-
+class CCommandParser;
class EngineWrapper;
class CCreatorCmdScriptRun;
@@ -85,6 +78,42 @@
R_ATTACHMENT_SINGLE_SELECTION_QUERY
};
+/*
+ * Interface for UI dialogs
+ */
+class MUIObserver
+ {
+public:
+ /**
+ * Called when some dialog in UI is closed
+ *
+ * @since S60 10.1
+ * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+ * @param aUserData number that was passed to UI before dialog was opened
+ * @return None.
+ */
+ virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData) = 0;
+
+ };
+
+/*
+ * Interface for CCommandParser
+ */
+class MCommandParserObserver
+ {
+public:
+ /**
+ * Called when CCommandParser user has choosen some file(script file, random data file)
+ *
+ * @since S60 10.1
+ * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+ * @param aFileName filename chosen by user
+ * @return None.
+ */
+ virtual void FileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0;
+
+ };
+
/**
* Device memory information
*/
@@ -104,7 +133,7 @@
// Common constant for undefined integer value:
const TInt KUndef = KErrNotFound;
-class CCreatorEngine : public CActive
+class CCreatorEngine : public CActive, public MUIObserver, public MCommandParserObserver
{
public:
@@ -213,10 +242,8 @@
TInt RunError(TInt aError);
void DoCancel();
- void ExecuteFirstCommandL(const TDesC& aText);
void ExecuteCommand();
void StartEnginesL();
- void ShutDownEnginesL();
void CheckForMoreCommandsL();
TBool IsDeleteCommand( TInt aCommand );
@@ -228,11 +255,35 @@
void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName );
void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize );
+public: // from MUIObserver
+ /**
+ * Called when some dialog in UI is closed
+ *
+ * @since S60 10.1
+ * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+ * @param aUserData number that was passed to UI before dialog was opened
+ * @return ?description
+ */
+ virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);
+
+public: // from MCommandParserObserver
+ /**
+ * Called when CCommandParser user has choosen some file(script file, random data file)
+ *
+ * @since S60 10.1
+ * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+ * @param aFileName filename chosen by user
+ * @return None.
+ */
+ virtual void FileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC);
+
public:
void ExecuteOptionsMenuCommandL(TInt aCommand);
void RunScriptL();
TInt RunScriptL(const TDesC& aScriptFile);
-
+ void ShutDownEnginesL();
+ void ExecuteFirstCommandL(const TDesC& aText);
+
void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1);
TInt CommandArrayCount();
@@ -280,7 +331,7 @@
void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath);
- TBool GetRandomDataFilenameL(TDes& aFilename);
+ TBool GetRandomDataL();
TBool GetRandomDataFromFileL(const TDesC& aFilename);
void CancelComplete();
CDictionaryFileStore* FileStoreLC();
@@ -338,6 +389,7 @@
CCreatorMessages* iMessages;
CCreatorLandmarks* iLandmarks;
CCreatorCmdScriptRun* iCmdScriptRun;
+ CCommandParser* iCommandParser;
// options menu command home module
MCreatorModuleBase* iUsedOptionsMenuModule;
--- a/creator/inc/enginewrapper.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/inc/enginewrapper.h Fri May 14 16:10:39 2010 +0300
@@ -24,7 +24,7 @@
#include <badesca.h>
#include <engine.h>
- #include <QObject> // for iProgressNote signal connect
+#include <QObject> // for iProgressNote signal connect
class MainView;
@@ -32,6 +32,7 @@
class HbProgressDialog;
class HbPopup;
class HbCommonNote;
+class HbAction;
/**
@@ -102,22 +103,22 @@
/**
* Create entries query dialog
*/
- TBool EntriesQueryDialog(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero = EFalse);
+ TBool EntriesQueryDialog(TInt* aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero = EFalse, MUIObserver* aObserver = NULL, int userData = 0);
/**
* Create time query dialog
*/
- TBool TimeQueryDialog(TTime aTime, const TDesC& aPrompt);
+ TBool TimeQueryDialog(TTime* aTime, const TDesC& aPrompt, MUIObserver* aObserver = NULL, int userData = 0);
/**
* Create yes or no query dialog
*/
- TBool YesNoQueryDialog(const TDesC& aPrompt);
+ TBool YesNoQueryDialog(const TDesC& aPrompt, MUIObserver* aObserver = NULL, int userData = 0);
/**
* Popup list dialog for selecting item from dialog list
*/
- bool PopupListDialog(const TDesC& aPrompt, CDesCArray* aFileNameArray, TInt& aIndex);
+ TBool PopupListDialog(const TDesC& aPrompt, const CDesCArray* aFileNameArray, TInt* aIndex, MUIObserver* aObserver = NULL, TInt aUserData=0);
/**
* Directory query dialog
@@ -127,12 +128,12 @@
/**
* Create list query single-selection dialog
*/
- bool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt& aIndex);
+ TBool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt* aSeletedItem, MUIObserver* aObserver = NULL, TInt aUserData=0);
/**
* Create list query multi-selection dialog
*/
- bool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aIndexes);
+ TBool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* aObserver = NULL, TInt aUserData=0);
/**
@@ -145,7 +146,7 @@
/**
* progress dialog cancelled
*/
- void ProgressDialogCancelled();
+ void ProgressDialogCancelled();
private:
@@ -156,6 +157,7 @@
/* progress dialog that is shown */
HbProgressDialog* iProgressDialog;
+ MCreatorModuleBase *iModule;
};
#endif //ENGINEWRAPPER_H
--- a/creator/inc/notifications.h Fri May 14 15:15:12 2010 +0300
+++ b/creator/inc/notifications.h Fri May 14 16:10:39 2010 +0300
@@ -21,6 +21,11 @@
#include <hbmessagebox.h>
#include <hbselectiondialog.h>
+#include <hbinputdialog.h>
+
+#include "engine.h"
+
+#include <stdexcept>
class HbProgressDialog;
class HbPopup;
@@ -82,6 +87,84 @@
static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout = HbPopup::ConfirmationNoteTimeout);
};
+class CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorDialog)
+protected:
+ CreatorDialog(MUIObserver* observer, int userData) throw(std::exception) : mObserver(observer), mUserData(userData)
+ {
+ if(!mObserver)
+ throw std::invalid_argument("module cannot be the null!");
+ };
+protected:
+ virtual void NotifyObserver(TBool aPositiveAction)
+ {
+ TRAPD( err, mObserver->QueryDialogClosedL(aPositiveAction, mUserData) );
+ if(err)
+ {
+ Notifications::error( QString("Symbian Leave: %1 ").arg(err) );
+ }
+ }
+
+protected:
+ MUIObserver* mObserver;
+ int mUserData;
+};
+class CreatorYesNoDialog : public HbMessageBox, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorYesNoDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorYesNoDialog(MUIObserver* observer, int userData);
+protected slots:
+ void DialogClosed(HbAction*);
+};
+class CreatorInputDialog : public HbInputDialog, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorInputDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& label, int* value, bool acceptZero, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorInputDialog(int*value, MUIObserver* observer, int userData);
+protected slots:
+ void DialogClosed(HbAction*);
+private:
+ int *mValue;
+};
+
+class CreatorSelectionDialog : public HbSelectionDialog, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorSelectionDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& label, const QStringList& items, TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
+ static void launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorSelectionDialog(TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
+ CreatorSelectionDialog(CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
+protected slots:
+ void DialogClosed(HbAction*);
+private:
+ TInt* mSelectedItem;
+ CArrayFixFlat<TInt>* mSelectedItems;
+};
+
+class CreatorDateTimeDialog : public HbDialog, public CreatorDialog
+{
+ Q_DISABLE_COPY(CreatorDateTimeDialog)
+ Q_OBJECT
+public:
+ static void launch(const QString& label, TTime* value, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+ CreatorDateTimeDialog(TTime* value, MUIObserver* observer, int userData);
+protected slots:
+ void DialogClosed(HbAction*);
+private:
+ TTime *mValue;
+};
#endif // NOTIFICATIONS_H_
--- a/creator/src/engine.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/src/engine.cpp Fri May 14 16:10:39 2010 +0300
@@ -16,8 +16,8 @@
*/
-#include <EIKENV.H>
-#include <S32FILE.H>
+#include <eikenv.h>
+#include <s32file.h>
#include <coemain.h>
#include <datacreator.rsg>
@@ -29,13 +29,26 @@
#include <cntdb.h>//For Math
+#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_traces.h"
#include "creator_factory.h"
#include "creator_scriptparser.h"
#include "creator_file.h"
#include "creator_cmdscriptrun.h"
-
+#include "creator_contactsetcache.h"
#include <apparc.h>
#include <eikappui.h>
@@ -45,7 +58,7 @@
_LIT(KEDriveError, "Not available");
_LIT(KTempPathDrive, "d");
_LIT(KTempPath, ":\\Creator\\");
-_LIT(KSavingText, "Saving");
+//_LIT(KSavingText, "Saving");
_LIT(KDeletingText, "Deleting");
const TInt KRegisterDrive = EDriveC;
_LIT(KRegisterFileName, "creator_created_items.dat");
@@ -141,7 +154,9 @@
delete iBitmapData;
delete iCmdScriptRun;
- iCmdScriptRun = NULL;
+ iCmdScriptRun = NULL;
+
+ delete iCommandParser;
}
void CCreatorEngine::CopyFileL(const TFileName& aSourceFile, const TFileName& aTargetFile, TBool aOverwrite )
@@ -718,6 +733,7 @@
TRAP(err, iFiles = CCreatorFiles::NewL(this));
TRAP(err, iMessages = CCreatorMessages::NewL(this));
TRAP(err, iLandmarks = CCreatorLandmarks::NewL(this));
+ ContactLinkCache::InitializeL();
/*
#ifdef __PRESENCE
TRAP(err, iIMPS = CCreatorIMPS::NewL(this));
@@ -766,6 +782,7 @@
delete iLandmarks;
iLandmarks = NULL;
+ ContactLinkCache::DestroyL();
// now delete the command array
delete iCommandArray;
iCommandArray = NULL;
@@ -773,6 +790,13 @@
// delete parameter array
iParameterArray.ResetAndDestroy();
iParameterArray.Close();
+
+ if(iCommandParser)
+ {
+ delete iCommandParser;
+ iCommandParser = NULL;
+ }
+
// clear temp drive
CFileMan* fileMan = CFileMan::NewL( iEnv->FsSession() );
@@ -791,53 +815,51 @@
}
// ---------------------------------------------------------------------------
-
-void CCreatorEngine::RunScriptL()
+void CCreatorEngine::QueryDialogClosedL( TBool /*aPositiveAction*/, TInt /*aUserData*/ )
{
- 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 )
+void CCreatorEngine::FileChosenL( TBool aSuccess, const TDesC& aFileName )
+ {
+ if( aSuccess )
{
+ // open the file for reading
+ RFile scriptFile;
+ User::LeaveIfError( scriptFile.Open( iEnv->FsSession(), aFileName, EFileRead ) );
+ CleanupClosePushL(scriptFile);
+
+
// wait dialog
- /* TODO
+ /* TODO
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 );
- );
+ CCreatorScriptParser* scriptParser = CCreatorScriptParser::NewLC(this);
+ scriptParser->ParseL(scriptFile);
+ parseErr = scriptParser->GetError();
+ CleanupStack::PopAndDestroy( scriptParser );
+
+ CleanupStack::PopAndDestroy( &scriptFile );
+
//waitDialog->CancelNoteL( dialogId );
//CleanupStack::PopAndDestroy( waitDialog );
- User::LeaveIfError( parserErr );
-
+
if(parseErr != KErrNone)
{
-
// show error note
_LIT(KErrMsg, "Parser error: %d");
TBuf<32> msgBuf;
msgBuf.Format(KErrMsg, parseErr);
- iEngineWrapper->ShowNote(msgBuf);
- CleanupStack::PopAndDestroy(); //commandParser
+ iEngineWrapper->ShowErrorMessage(msgBuf);
ShutDownEnginesL();
+ delete iCommandParser;
+ iCommandParser = NULL;
return;
}
}
- CleanupStack::PopAndDestroy( &scriptFile );
- CleanupStack::PopAndDestroy( commandParser );
// start executing commands if commands in the command array
if (CommandArrayCount() > 0)
@@ -848,7 +870,26 @@
{
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
+ delete iCommandParser;
+ iCommandParser = CCommandParser::NewL(this);
+ TBool ret = EFalse;
+ TRAPD(err, ret = iCommandParser->OpenScriptL( this ) );
+ if( err != KErrNone || ret == EFalse)
+ {
+ ShutDownEnginesL();
+ User::LeaveIfError(err);
+ }
}
// ---------------------------------------------------------------------------
@@ -1118,13 +1159,13 @@
ShutDownEnginesL();
}
}
- else if ( iUsedOptionsMenuModule->AskDataFromUserL( aCommand, iEntriesToBeCreated ) )
+ else if ( iUsedOptionsMenuModule->AskDataFromUserL( aCommand ) )
{
// add this command to command array
- AppendToCommandArrayL( aCommand, NULL, 1 );
+// AppendToCommandArrayL( aCommand, NULL, 1 );
// started exucuting commands
- ExecuteFirstCommandL( KDeletingText );
+// ExecuteFirstCommandL( KDeletingText );
}
else
{
@@ -1134,13 +1175,13 @@
}
// ask user data, if query accepted start processing...
- else if (iUsedOptionsMenuModule->AskDataFromUserL(aCommand, iEntriesToBeCreated))
+ else if (iUsedOptionsMenuModule->AskDataFromUserL(aCommand))
{
// add this command to command array
- AppendToCommandArrayL(aCommand, NULL, iEntriesToBeCreated);
+ //AppendToCommandArrayL(aCommand, NULL, iEntriesToBeCreated);
// started exucuting commands
- ExecuteFirstCommandL( KSavingText );
+ //ExecuteFirstCommandL( KSavingText );
}
else
{
@@ -1202,11 +1243,16 @@
// ---------------------------------------------------------------------------
-TBool CCreatorEngine::GetRandomDataFilenameL(TDes& aFilename)
+TBool CCreatorEngine::GetRandomDataL()
{
+ TFileName fileName;
CCommandParser* commandParser = CCommandParser::NewLC(this);
- TBool ret = commandParser->GetRandomDataFilenameL(aFilename);
+ TBool ret = commandParser->GetRandomDataFilenameL(fileName);
CleanupStack::PopAndDestroy(commandParser);
+ if (ret)
+ {
+ ret = GetRandomDataFromFileL(fileName);
+ }
return ret;
}
--- a/creator/src/enginewrapper.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/src/enginewrapper.cpp Fri May 14 16:10:39 2010 +0300
@@ -18,8 +18,7 @@
#include <hbprogressdialog.h>
#include <hbmessagebox.h>
-
-#include <hbpopup.h>
+#include <hblabel.h>
#include <QString>
#include <QDate>
@@ -106,7 +105,7 @@
// ---------------------------------------------------------------------------
-void EngineWrapper::ShowNote(const TDesC& aNoteMessage, TInt aResourceId)
+void EngineWrapper::ShowNote(const TDesC& aNoteMessage, TInt /*aResourceId*/)
{
QString note((QChar*)aNoteMessage.Ptr(),aNoteMessage.Length());
Notifications::showGlobalNote(note, HbMessageBox::MessageTypeInformation, HbPopup::ConfirmationNoteTimeout);
@@ -132,40 +131,59 @@
void EngineWrapper::CloseProgressbar()
{
- delete iProgressDialog;
- iProgressDialog = 0;
+ if(iProgressDialog){
+ delete iProgressDialog;
+ iProgressDialog = 0;
+ }
}
// ---------------------------------------------------------------------------
-TBool EngineWrapper::EntriesQueryDialog(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero)
+TBool EngineWrapper::EntriesQueryDialog(TInt* aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero, MUIObserver* observer, int userData)
{
QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
- bool err = Notifications::entriesQueryDialog(aNumberOfEntries, text, aAcceptsZero);
- return err;
+ TBool success(EFalse);
+ try{
+ CreatorInputDialog::launch(text, aNumberOfEntries, aAcceptsZero ? true : false, observer, userData);
+ success = ETrue;
+ }
+ catch (std::exception& e)
+ {
+ Notifications::error( QString("exception: ")+e.what() );
+ }
+ return success;
}
// ---------------------------------------------------------------------------
-TBool EngineWrapper::TimeQueryDialog(TTime aTime, const TDesC& aPrompt)
+TBool EngineWrapper::TimeQueryDialog(TTime* aTime, const TDesC& aPrompt, MUIObserver* observer, int userData)
{
- // TTime to QDate
- TBuf<20> timeString;
- _LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3");
- TRAP_IGNORE( aTime.FormatL(timeString, KDateString) );
- QString temp = QString::fromUtf16(timeString.Ptr(), timeString.Length());
- temp.replace(QChar('/'), QChar('-'));
- QDate date = QDate::fromString(temp, "dd-MM-yyyy");
-
- QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
- bool err = Notifications::timeQueryDialog(date, text);
- return err;
+ QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
+ TBool success(EFalse);
+ try{
+ CreatorDateTimeDialog::launch(text, aTime, observer, userData);
+ success = ETrue;
+ }
+ catch (std::exception& e)
+ {
+ Notifications::error( QString("exception: ")+e.what() );
+ }
+ return success;
}
-TBool EngineWrapper::YesNoQueryDialog(const TDesC& aPrompt)
+TBool EngineWrapper::YesNoQueryDialog(const TDesC& aPrompt, MUIObserver* observer, int userData)
{
QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
- return Notifications::yesNoQueryDialog(text);
+ TBool success(EFalse);
+ try{
+ CreatorYesNoDialog::launch(text, "", observer, userData);
+ success = ETrue;
+ }
+ catch (std::exception& e)
+ {
+ Notifications::error( QString("exception: ")+e.what() );
+ }
+ return success;
}
// ---------------------------------------------------------------------------
@@ -177,16 +195,12 @@
TRAP(err, iEngine->RunScriptL());
}
else if (commandId == ECmdSelectRandomDataFile) {
- TFileName filename;
TBool ret = EFalse;
- TRAP(err, ret = iEngine->GetRandomDataFilenameL(filename));
- if (err != KErrNone) {
+ TRAP(err, ret = iEngine->GetRandomDataL());
+ if ( err != KErrNone || ret == EFalse ) {
Notifications::error("Error in getting random data.");
return false;
}
- if (ret == true) {
- TRAP(err, iEngine->GetRandomDataFromFileL(filename));
- }
}
else {
TRAP(err, iEngine->ExecuteOptionsMenuCommandL(commandId));
@@ -202,7 +216,7 @@
// ---------------------------------------------------------------------------
-bool EngineWrapper::PopupListDialog(const TDesC& aPrompt, CDesCArray* aFileNameArray, TInt& aIndex)
+TBool EngineWrapper::PopupListDialog(const TDesC& aPrompt, const CDesCArray* aFileNameArray, TInt* aIndex, MUIObserver* aObserver, TInt aUserData)
{
QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
QStringList itemList;
@@ -213,8 +227,16 @@
aFileNameArray->MdcaPoint(i).Length()));
}
// TODO: HbSelectionDialog handle close & user choice
- Notifications::popupListDialog(text, itemList, HbAbstractItemView::SingleSelection);
- return false;
+ TBool success(EFalse);
+ try{
+ CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
+ success = ETrue;
+ }
+ catch (std::exception& e)
+ {
+ Notifications::error( QString("exception: ")+e.what() );
+ }
+ return success;
}
// ---------------------------------------------------------------------------
@@ -246,7 +268,7 @@
// ---------------------------------------------------------------------------
-bool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt& aIndex)
+TBool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt* aIndex, MUIObserver* aObserver, TInt aUserData)
{
bool ret = false;
QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
@@ -293,34 +315,42 @@
}
}
// TODO: HbSelectionDialog handle close & user choice
- Notifications::popupListDialog(text, itemList, HbAbstractItemView::SingleSelection);
- return false;
-
+ TBool success(EFalse);
+ try{
+ CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
+ success = ETrue;
+ }
+ catch (std::exception& e)
+ {
+ Notifications::error( QString("exception: ")+e.what() );
+ }
+ return success;
}
-bool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aIndexes)
+TBool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* aObserver, TInt aUserData)
{
- bool ret = false;
+ TBool success(EFalse);
+ QStringList itemList;
QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
- QStringList itemList;
- QList<int> indexes;
if (aId == R_ATTACHMENT_MULTI_SELECTION_QUERY) {
- itemList << "None" << "JPEG 25kB" << "JPEG 300kB" << "JPEG 500kB" << "PNG 15kB" << "GIF 2kB" << "RNG 1kB"
- << "MIDI 10kB" << "WAVE 20kB" << "AMR 20kB" << "Excel 15kB" << "Word 20kB" << "PowerPoint 40kB"
- << "Text 10kB" << "Text 70kB" << "3GPP 70kB" << "MP3 250kB" << "AAC 100kB" << "RM 95kB";
-
- //ret = Notifications::popupListDialog(text, itemList, indexes);
- // TODO: HbSelectionDialog handle close & user choice
- Notifications::popupListDialog(text, itemList, HbAbstractItemView::MultiSelection);
-
- if (ret == true) {
- aIndexes->Reset();
- for (int i = 0; i < indexes.count(); i++) {
- aIndexes->AppendL(indexes.at(i));
- }
- }
+ itemList << "None" << "JPEG 25kB" << "JPEG 300kB" << "JPEG 500kB" << "PNG 15kB" << "GIF 2kB" << "RNG 1kB"
+ << "MIDI 10kB" << "WAVE 20kB" << "AMR 20kB" << "Excel 15kB" << "Word 20kB" << "PowerPoint 40kB"
+ << "Text 10kB" << "Text 70kB" << "3GPP 70kB" << "MP3 250kB" << "AAC 100kB" << "RM 95kB";
}
- return ret;
+ else{
+ Notifications::error("Error in resource id.");
+ return EFalse;
+ }
+
+ try{
+ CreatorSelectionDialog::launch(text, itemList, aSelectedItems, aObserver, aUserData);
+ success = ETrue;
+ }
+ catch (std::exception& e)
+ {
+ Notifications::error( QString("exception: ")+e.what() );
+ }
+ return success;
}
void EngineWrapper::CloseCreatorApp()
--- a/creator/src/notifications.cpp Fri May 14 15:15:12 2010 +0300
+++ b/creator/src/notifications.cpp Fri May 14 16:10:39 2010 +0300
@@ -24,10 +24,12 @@
#include <hbvalidator.h>
#include <hbabstractitemview.h>
#include <hbprogressdialog.h>
+#include <hbdatetimepicker.h>
#include <QString>
#include <QDate>
#include <QRegExp>
+#include <QList>
#include "notifications.h"
@@ -87,116 +89,6 @@
// ---------------------------------------------------------------------------
-bool Notifications::entriesQueryDialog(int& numberOfEntries, const QString& text, bool acceptsZero)
-{
- bool err = false;
- HbDialog *popup = new HbDialog();
- popup->setDismissPolicy(HbPopup::TapOutside);
- popup->setTimeout(HbPopup::NoTimeout);
-
- HbLabel *title = new HbLabel();
- HbLineEdit *edit = new HbLineEdit();
- HbAction *actionOk = new HbAction("Ok");
- HbAction *actionCancel = new HbAction("Cancel");
-
- title->setPlainText(text);
- popup->setHeadingWidget(title);
- popup->setContentWidget(edit);
-
- HbValidator *validator = new HbValidator();
- QString tmp;
- if (acceptsZero == false) {
- tmp.append("[1-9]{1}\\d{1,4}");
- }
- else {
- tmp.append("^[0-9]{5}");
- }
-
- QRegExp rxBasic(tmp);
- validator->addField(new QRegExpValidator(rxBasic, 0), "");
- edit->setValidator(validator);
- edit->setText(QString::number(numberOfEntries));
- edit->setSelection(0, QString::number(numberOfEntries).length());
-
- popup->setPrimaryAction(actionOk);
- popup->setSecondaryAction(actionCancel);
-
- // Launch popup syncronously
- popup->setAttribute(Qt::WA_DeleteOnClose);
- // TODO: handle dialog close & user input
- popup->open();
-
- // continue if ok selected and valid user input exists in line editor
- /*if (action && action->text() == "Ok" && edit->text() != "") {
- numberOfEntries = edit->text().toInt(&err, 10);
- }*/
- return err;
-}
-
-// ---------------------------------------------------------------------------
-bool Notifications::timeQueryDialog(QDate& date, const QString& text)
-{
- bool err = false;
- HbDialog *popup = new HbDialog();
- popup->setDismissPolicy(HbPopup::TapOutside);
- popup->setTimeout(HbPopup::NoTimeout);
-
- HbLabel *title = new HbLabel();
- HbLineEdit *edit = new HbLineEdit();
- HbAction *actionOk = new HbAction("Ok");
- HbAction *actionCancel = new HbAction("Cancel");
-
- title->setPlainText(text);
- popup->setHeadingWidget(title);
- popup->setContentWidget(edit);
-
- HbValidator *validator =new HbValidator;
- QString dateString("(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\\d\\d");
- QRegExp rxDate(dateString);
- validator->addField(new QRegExpValidator(rxDate, 0), "");
- edit->setValidator(validator);
- edit->setText(date.toString());
- edit->setSelection(0, date.toString().length());
-
-
- popup->setPrimaryAction(actionOk);
- popup->setSecondaryAction(actionCancel);
-
- // Launch popup syncronously
- popup->setAttribute(Qt::WA_DeleteOnClose);
- // TODO: handle dialog close & user input
- popup->open();
-
- // continue if ok selected and valid user input exists in line editor
- /*if (action && action->text() == "Ok" && edit->text() != "") {
- date = QDate::fromString(edit->text());
- err = true;
- }*/
- return err;
-}
-
-// ---------------------------------------------------------------------------
-
-bool Notifications::yesNoQueryDialog(const QString& text)
-{
- HbMessageBox::question(text, 0, 0);
- return false;
-}
-
-// ---------------------------------------------------------------------------
-
-void Notifications::popupListDialog(const QString& text, QStringList& items, HbAbstractItemView::SelectionMode mode, QObject* receiver, const char* member)
-{
- HbSelectionDialog *dlg = new HbSelectionDialog;
- dlg->setHeadingWidget(new HbLabel(text, dlg));
- dlg->setStringItems(items);
- dlg->setSelectionMode(mode);
- dlg->setAttribute(Qt::WA_DeleteOnClose);
- dlg->open(receiver, member);
-}
-
-// ---------------------------------------------------------------------------
-
bool Notifications::directoryQueryDialog(const QString& text, QString& directory)
{
bool err = false;
@@ -233,3 +125,190 @@
}
// ---------------------------------------------------------------------------
+
+CreatorYesNoDialog::CreatorYesNoDialog(MUIObserver* observer, int userData) :
+ HbMessageBox(HbMessageBox::MessageTypeQuestion, NULL),
+ CreatorDialog(observer, userData)
+{
+}
+
+void CreatorYesNoDialog::launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw(std::exception)
+{
+ CreatorYesNoDialog* dlg = new CreatorYesNoDialog(observer, userData);
+ dlg->setText(text);
+ if(label.length())
+ dlg->setHeadingWidget(new HbLabel(label, dlg));
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ dlg->setTimeout(HbPopup::NoTimeout);
+ dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorYesNoDialog::DialogClosed(HbAction *action)
+{
+ TBool PositiveAction(EFalse);
+ if(action && (action->softKeyRole()==QAction::PositiveSoftKey || !action->text().compare("yes", Qt::CaseInsensitive))){
+ PositiveAction = ETrue;
+ }
+ NotifyObserver(PositiveAction);
+}
+
+CreatorInputDialog::CreatorInputDialog(int* value, MUIObserver* module, int userData) :
+ HbInputDialog(NULL),
+ CreatorDialog(module, userData),
+ mValue(value)
+{
+ if(!value)
+ throw std::invalid_argument("value cannot be the null!");
+}
+
+void CreatorInputDialog::launch(const QString& label, int* value, bool acceptsZero, MUIObserver* observer, int userData) throw( std::exception )
+{
+ CreatorInputDialog* dlg = new CreatorInputDialog(value, observer, userData);
+ dlg->setPromptText(label);
+ dlg->setInputMode(IntInput);
+ HbValidator *validator = new HbValidator(dlg);
+ QString tmp;
+ if (acceptsZero == false) {
+ tmp.append("[1-9]{1}\\d{1,4}");
+ }
+ else {
+ tmp.append("^[0-9]{5}");
+ }
+
+ QRegExp rxBasic(tmp);
+ validator->addField(new QRegExpValidator(rxBasic, 0), "");
+ dlg->setValidator(validator);
+ dlg->setValue(QVariant(*value));
+ dlg->lineEdit()->setSelection(0, dlg->value().toString().length());
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorInputDialog::DialogClosed(HbAction *action)
+{
+ TBool PositiveAction(EFalse);
+ if(action && (action->softKeyRole()==QAction::PositiveSoftKey || !action->text().compare("ok", Qt::CaseInsensitive))){
+ bool ok = false;
+ *mValue = value().toInt(&ok);
+ PositiveAction = ok ? ETrue : EFalse;
+ }
+ NotifyObserver(PositiveAction);
+}
+
+CreatorSelectionDialog::CreatorSelectionDialog(int* selectedItem, MUIObserver* observer, int userData) throw(std::exception) :
+ HbSelectionDialog(NULL),
+ CreatorDialog(observer, userData),
+ mSelectedItem(selectedItem),
+ mSelectedItems(NULL)
+{
+ if(!mSelectedItem)
+ throw std::invalid_argument("selectedItem cannot be null!");
+}
+
+CreatorSelectionDialog::CreatorSelectionDialog(CArrayFixFlat<TInt>* selectedItems, MUIObserver* observer, int userData) throw(std::exception) :
+ HbSelectionDialog(NULL),
+ CreatorDialog(observer, userData),
+ mSelectedItem(NULL),
+ mSelectedItems(selectedItems)
+{
+ if(!mSelectedItems)
+ throw std::invalid_argument("selectedItems cannot be null!");
+}
+
+void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, int* selectedItem, MUIObserver* observer, int userData) throw(std::exception)
+{
+ CreatorSelectionDialog* dlg = new CreatorSelectionDialog(selectedItem, observer, userData);
+ if(label.length())
+ dlg->setHeadingWidget(new HbLabel(label, dlg));
+ dlg->setStringItems(items);
+ dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* selectedItems, MUIObserver* observer, int userData) throw(std::exception)
+{
+ CreatorSelectionDialog* dlg = new CreatorSelectionDialog(selectedItems, observer, userData);
+ if(label.length())
+ dlg->setHeadingWidget(new HbLabel(label, dlg));
+ dlg->setStringItems(items);
+ dlg->setSelectionMode(HbAbstractItemView::MultiSelection);
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorSelectionDialog::DialogClosed(HbAction *action)
+{
+ TBool PositiveAction(EFalse);
+ //CreatorSelectionDialog* dlg = qobject_cast<CreatorSelectionDialog*>(sender());
+ if(!action || (action && action->softKeyRole()==QAction::SelectSoftKey) || (action && !action->text().compare("ok", Qt::CaseInsensitive))){
+ if(selectedItems().count()){
+ try{
+ if( selectionMode() == HbAbstractItemView::SingleSelection && mSelectedItem){
+ bool ok(false);
+ *mSelectedItem = selectedItems().at(0).toInt(&ok);
+ if(!ok)
+ throw std::invalid_argument("cannot obtain selected item!");
+ }
+ if( selectionMode() == HbAbstractItemView::MultiSelection && mSelectedItems){
+ QList<QVariant> items = selectedItems();
+ foreach( QVariant item, items){
+ QT_TRAP_THROWING( mSelectedItems->AppendL( item.toInt() ) );
+ }
+ }
+ PositiveAction = ETrue;
+ }
+ catch (std::exception& e){
+ Notifications::error( QString("exception: ")+e.what() );
+ }
+ }
+ }
+ NotifyObserver(PositiveAction);
+}
+
+CreatorDateTimeDialog::CreatorDateTimeDialog(TTime* value, MUIObserver* observer, int userData) :
+ HbDialog(NULL),
+ CreatorDialog(observer, userData),
+ mValue(value)
+{
+}
+
+void CreatorDateTimeDialog::launch(const QString& label, TTime* value, MUIObserver* observer, int userData) throw( std::exception )
+{
+ CreatorDateTimeDialog* dlg = new CreatorDateTimeDialog(value, observer, userData);
+ if(!value)
+ throw std::invalid_argument("value cannot be the null!");
+ if(label.length())
+ dlg->setHeadingWidget( new HbLabel(label, dlg) );
+
+ // TTime to QDate
+ TBuf<20> timeString;
+ _LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3");
+ TRAP_IGNORE( value->FormatL(timeString, KDateString) );
+ QString temp = QString::fromUtf16(timeString.Ptr(), timeString.Length());
+ temp.replace(QChar('/'), QChar('-'));
+ QDate date = QDate::fromString(temp, "dd-MM-yyyy");
+ HbDateTimePicker* widget = new HbDateTimePicker( date, dlg );
+ dlg->setContentWidget( widget );
+ dlg->addAction(new HbAction("Ok", dlg));
+ dlg->addAction(new HbAction("Cancel", dlg));
+ dlg->setModal(true); // Dialog is modal
+ dlg->setAttribute(Qt::WA_DeleteOnClose);
+ dlg->setTimeout(HbPopup::NoTimeout);
+ dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorDateTimeDialog::DialogClosed(HbAction *action)
+{
+ TBool PositiveAction(EFalse);
+ if(action && (action->softKeyRole()==QAction::PositiveSoftKey || !action->text().compare("ok", Qt::CaseInsensitive))){
+ QString str = qobject_cast<HbDateTimePicker*>(contentWidget())->date().toString(Qt::ISODate);
+ str.remove('-');
+ str += ":000000";// 0h 0m 0s
+ TBuf<30> dateTimeString(str.utf16());
+ mValue->Set(dateTimeString);
+ PositiveAction = ETrue;
+ }
+ NotifyObserver(PositiveAction);
+}
+//End of File
--- a/filebrowser/engine/FBFileUtils.cpp Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/engine/FBFileUtils.cpp Fri May 14 16:10:39 2010 +0300
@@ -27,6 +27,8 @@
#include <f32file.h>
#include <eikfutil.h>
#include <apparc.h>
+#include <apaid.h>
+#include <apaidpartner.h>
#include <eikenv.h>
#include <bautils.h>
#include <gulicon.h>
@@ -1960,46 +1962,48 @@
// if (dlgResult)
// {
// iEngine->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; i<iDriveEntryList->Count(); 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);
-// }
-//
+
+
+ iEngine->FileBrowserUI()->ShowWaitDialog(_L("** Searching **"));
+ iFileEntryList->Reset();
+
+ // if search dir is empty, find from all drives
+ if (iSearchAttributes.iSearchDir == KNullDesC)
+ {
+ for (TInt i=0; i<iDriveEntryList->Count(); 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);
+ }
+
// iEngine->EikonEnv()->BusyMsgCancel();
-//
+ iEngine->FileBrowserUI()->CancelWaitDialog();
+
// TInt operations = iFileEntryList->Count();
-//
-// iListingMode = ESearchResults;
-// iEngine->FileListContainer()->ListBox()->SetCurrentItemIndex(0);
-// RefreshViewL();
-//
+
+ iListingMode = ESearchResults;
+ // TODO iEngine->FileListContainer()->ListBox()->SetCurrentItemIndex(0);
+ RefreshViewL();
+
// _LIT(KMessage, "%d entries found");
// TFileName noteMsg;
// noteMsg.Format(KMessage, operations);
@@ -2016,8 +2020,9 @@
CDir* dir;
TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
- while (err == KErrNone)
+ while (err == KErrNone && iAllowProcessing)
{
+ iEngine->FileBrowserUI()->ProcessEvents();
for (TInt i=0; i<dir->Count(); i++)
{
TEntry entry = (*dir)[i];
@@ -3266,7 +3271,7 @@
CleanupClosePushL(file);
iFindFileEntryList->Reset();
- iEngine->EikonEnv()->BusyMsgL(_L("** Generating **"), TGulAlignment(EHCenterVTop));
+ iEngine->FileBrowserUI()->ShowWaitDialog(_L("** Generating **"));
for (TInt i=0; i<iDriveEntryList->Count(); i++)
{
@@ -3291,12 +3296,14 @@
writeBuf.Copy(fileEntry.iPath);
writeBuf.Append(fileEntry.iEntry.iName);
+ writeBuf.Append(_L(" - "));
+ writeBuf.AppendNum(fileEntry.iEntry.iSize);
+ writeBuf.Append(_L(" B"));
writeBuf.Append(KFileNewLine);
-
file.Write(writeBuf);
}
- iEngine->EikonEnv()->BusyMsgCancel();
+ iEngine->FileBrowserUI()->CancelWaitDialog();
CleanupStack::PopAndDestroy(); //file
iFindFileEntryList->Reset();
@@ -3325,8 +3332,9 @@
CDir* dir;
TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
- while (err == KErrNone)
+ while (err == KErrNone && iAllowProcessing)
{
+ iEngine->FileBrowserUI()->ProcessEvents();
for (TInt i=0; i<dir->Count(); i++)
{
TEntry entry = (*dir)[i];
--- a/filebrowser/engine/FBFileUtils.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/engine/FBFileUtils.h Fri May 14 16:10:39 2010 +0300
@@ -334,7 +334,7 @@
void GetDriveVolumeLabel(TInt aIndex, TFileName &aVolumeLabel);
CFileEntryList* FileEntries() const;
- CDriveEntryList* DriveEntries() const;
+ CDriveEntryList* DriveEntries() const;
public:
inline TInt SortMode() { return iSortMode; }
@@ -348,7 +348,8 @@
inline TSearchAttributes GetSearchAttributes(){ return iSearchAttributes; };
inline void ChangeAttributes(TSearchAttributes attributes) { iSearchAttributes = attributes; };
inline TSearchResults SearchResults(){ return iFileSearchResults; };
- inline CFileEntryList* FoundFiles() { return iFileEntryList; };
+ inline CFileEntryList* FoundFiles() { return iFileEntryList; };
+ inline void SetAllowProcessing(TBool aAllowProcessing) { iAllowProcessing = aAllowProcessing; }
private:
TState iState;
@@ -388,6 +389,7 @@
RTz iTz;
TSearchResults iFileSearchResults;
CDesCArray* iTextArray;
+ TBool iAllowProcessing;
};
--- a/filebrowser/engine/engine.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/engine/engine.h Fri May 14 16:10:39 2010 +0300
@@ -128,18 +128,24 @@
// */
// virtual void HideProgressBar() = 0;
//
-// /**
-// * Shows wait dialog with text
-// * @param aText A text to be shown at top of the wait bar.
-// * @return None.
-// */
-// virtual void ShowWaitDialog(const TDesC& aText) = 0;
-//
-// /**
-// * Hides wait dialog
-// * @return None.
-// */
-// virtual void HideWaitDialog() = 0;
+ /**
+ * Shows wait dialog with text
+ * @param aText A text to be shown at top of the wait bar.
+ * @return None.
+ */
+ virtual void ShowWaitDialog(const TDesC& aText) = 0;
+
+ /**
+ * Cancel wait dialog
+ * @return None.
+ */
+ virtual void CancelWaitDialog() = 0;
+
+ /**
+ * Processes all pending events to allow wait/progresa dialog to update itself
+ * @return None.
+ */
+ virtual void ProcessEvents() = 0;
/**
* Shows confirmation dialog
--- a/filebrowser/ui/inc/enginewrapper.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/inc/enginewrapper.h Fri May 14 16:10:39 2010 +0300
@@ -34,6 +34,7 @@
class SearchAttributes;
class SearchResults;
class FileBrowserView;
+class HbProgressDialog;
class QModelIndex;
@@ -55,9 +56,10 @@
/**
* class that is used for communicating between Symbian and Qt code.
*/
-class EngineWrapper : MFileBrowserUI {
+class EngineWrapper : public QObject, public MFileBrowserUI
+{
+ Q_OBJECT
public:
-
/**
* Constructor
*/
@@ -79,6 +81,9 @@
void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle);
void ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
void ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
+ void ShowWaitDialog(const TDesC& aText);
+ void CancelWaitDialog();
+ void ProcessEvents();
TBool ShowConfirmationQuery(const TDesC& aDescText);
public:
@@ -158,14 +163,20 @@
quint32 getDebugMask();
void toolsSetDebugMask(quint32 aDbgMask);
+ void toolsWriteAllFiles();
+
void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType);
+private slots:
+ void waitDialogCancelled();
+
private:
// FB engine
CEngine *mEngine;
// List of found files results for Ui
QStringList mFilesFound;
FileBrowserSettings mSettings;
+ HbProgressDialog *mWaitDialog;
};
#endif //ENGINEWRAPPER_H
--- a/filebrowser/ui/inc/filebrowsermainwindow.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/inc/filebrowsermainwindow.h Fri May 14 16:10:39 2010 +0300
@@ -25,6 +25,7 @@
class FileBrowserView;
class SettingsView;
class EditorView;
+class SearchView;
class FileBrowserMainWindow : public HbMainWindow
{
@@ -40,12 +41,14 @@
void openFileBrowserView();
void openSettingsView();
void openEditorView(const QString &, bool);
+ void openSearchView(const QString &);
private:
EngineWrapper* mEngineWrapper;
FileBrowserView* mFileBrowserView;
SettingsView* mSettingsView;
EditorView* mEditorView;
+ SearchView* mSearchView;
};
#endif /* FILEBROWSERMAINWINDOW_H_ */
--- a/filebrowser/ui/inc/filebrowserview.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/inc/filebrowserview.h Fri May 14 16:10:39 2010 +0300
@@ -51,12 +51,6 @@
{
Q_OBJECT
- enum resourceItem
- {
- FileItem,
- Directory
- };
-
public:
explicit FileBrowserView(FileBrowserMainWindow &mainWindow);
virtual ~FileBrowserView();
@@ -65,33 +59,14 @@
QModelIndexList getSelectedItemsOrCurrentItem();
public slots:
+ void refreshList();
private:
void fileOverwriteDialog();
- void openListDialog(const QStringList& items, const QString &aTitleText, QObject* receiver, const char* member);
-
- void diskAdmin(int cmd);
- HbDialog *filePathQuery(const QString &headingText,
- const QString &text,
- const QString &primaryActionText,
- const QString &secondaryActionText);
-
-// HbDialog *openTextQuery(const QString &headingText,
-// const QString &text,
-// const QString &primaryActionText,
-// const QString &secondaryActionText);
-
- HbDialog *openNumberQuery(const QString &headingText,
- const QString &text,
- const QString &primaryActionText,
- const QString &secondaryActionText,
- int aMin = -99999,
- int aMax = 99999);
+ void openListDialog(const QStringList& items, const QString &titleText, QObject* receiver, const char* member);
void openPropertyDialog(const QStringList& propertyList, const QString& title);
-// QModelIndexList *getSelectedItemsOrCurrentItem();
-
void createToolBar();
// Menu related methods
void createMenu();
@@ -106,7 +81,7 @@
void createAboutMenuItem();
void createExitMenuItem();
- void refreshList();
+// void refreshList();
void populateFolderContent();
private slots:
@@ -252,6 +227,7 @@
signals:
void aboutToShowSettingsView();
void aboutToShowEditorView(const QString &, bool);
+ void aboutToShowSearchView(const QString &);
void aboutToSimulateLeave(int);
private slots:
@@ -287,10 +263,6 @@
MenuAction mFileViewMenuActions;
HbAction *mToolbarBackAction;
- // search
- SearchView *mSearch;
- // settings
- SettingsView *mSettingsView;
// flags
bool mItemHighlighted;
bool mLocationChanged;
@@ -305,7 +277,7 @@
QString mAbsoluteFilePath;
OverwriteOptions mOverwriteOptions;
QModelIndex mModelIndex;
- bool mIsRenameAllowed;
+ QString mNewFileName;
bool mProceed;
bool mEraseMBR;
};
--- a/filebrowser/ui/inc/menuaction.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/inc/menuaction.h Fri May 14 16:10:39 2010 +0300
@@ -18,8 +18,6 @@
#ifndef MENUACTION_H
#define MENUACTION_H
-//#include <QtGui>
-
class HbMenu;
class HbAction;
@@ -97,10 +95,10 @@
mToolsMessageDrafts(0),
mToolsMessageSentItems(0),
mToolsMessageOutbox(0),
- // mLocalConnectivityMenu(0),
- // mToolsLocalConnectivityActivateInfrared(0),
- // mToolsLocalConnectivityLaunchBTUI(0),
- // mToolsLocalConnectivityLaunchUSBUI(0),
+ mToolsLocalConnectivityMenu(0),
+ mToolsLocalConnectivityActivateInfrared(0),
+ mToolsLocalConnectivityLaunchBTUI(0),
+ mToolsLocalConnectivityLaunchUSBUI(0),
mToolsMemoryInfo(0),
mToolsSecureBackupMenu(0),
mToolsSecureBackStart(0),
@@ -221,4 +219,356 @@
};
+class FileViewDriveContextMenu
+{
+public:
+ FileViewDriveContextMenu() :
+// //NoAction = 0,
+// mFileMenu(0),
+// mFileBackMoveUp(0),
+// mFileOpenDrive(0),
+// mFileOpenDirectory(0),
+// mFileSearch(0),
+// mFileNewMenu(0),
+// mFileNewFile(0),
+// mFileNewDirectory(0),
+// mFileDelete(0),
+// mFileRename(0),
+// mFileTouch(0),
+// mFileProperties(0),
+// mFileChecksumsMenu(0),
+// mFileChecksumsMD5(0),
+// mFileChecksumsMD2(0),
+// mFileChecksumsSHA1(0),
+// mFileSetAttributes(0),
+// //Edit -
+// mEditMenu(0),
+// mEditSnapShotToE(0),
+// mEditCut(0),
+// mEditCopy(0),
+// mEditPaste(0),
+// mEditCopyToFolder(0),
+// mEditMoveToFolder(0),
+// mEditSelect(0),
+// mEditUnselect(0),
+// mEditSelectAll(0),
+// mEditUnselectAll(0),
+// // View -
+// mViewMenu(0),
+// mViewFilterEntries(0),
+// mViewRefresh(0),
+ // Disk admin -
+ mDiskAdminMenu(0),
+ mDiskAdminSetDrivePassword(0),
+ mDiskAdminUnlockDrive(0),
+ mDiskAdminClearDrivePassword(0),
+ mDiskAdminEraseDrivePassword(0),
+ mDiskAdminFormatDrive(0),
+ mDiskAdminQuickFormatDrive(0),
+ mDiskAdminCheckDisk(0),
+ mDiskAdminScanDrive(0),
+ mDiskAdminSetDriveName(0),
+ mDiskAdminSetDriveVolumeLabel(0),
+ mDiskAdminEjectDrive(0),
+ mDiskAdminDismountDrive(0),
+ mDiskAdminEraseMBR(0),
+ mDiskAdminPartitionDrive(0)
+ // Tools -
+// mToolsMenu(0),
+// mToolsAllAppsToTextFile(0),
+// mToolsAllFilesToTextFile(0),
+// mToolsAvkonIconCacheMenu(0),
+// mToolsAvkonIconCacheEnable(0),
+// mToolsAvkonIconCacheDisable(0),
+// mToolsDisableExtendedErrors(0),
+// mToolsDumpMsgStoreWalk(0),
+// mToolsEditDataTypes(0),
+// mToolsEnableExtendedErrors(0),
+// mToolsErrorSimulateMenu(0),
+// mToolsErrorSimulateLeave(0),
+// mToolsErrorSimulatePanic(0),
+// mToolsErrorSimulateException(0),
+// mToolsMessageAttachmentsMenu(0),
+// mToolsMessageInbox(0),
+// mToolsMessageDrafts(0),
+// mToolsMessageSentItems(0),
+// mToolsMessageOutbox(0),
+// // mLocalConnectivityMenu(0),
+// // mToolsLocalConnectivityActivateInfrared(0),
+// // mToolsLocalConnectivityLaunchBTUI(0),
+// // mToolsLocalConnectivityLaunchUSBUI(0),
+// mToolsMemoryInfo(0),
+// mToolsSecureBackupMenu(0),
+// mToolsSecureBackStart(0),
+// mToolsSecureBackRestore(0),
+// mToolsSecureBackStop(0),
+// mToolsSetDebugMask(0),
+// mToolsShowOpenFilesHere(0)
+ {
+
+ }
+
+ ~FileViewDriveContextMenu() { }
+public:
+ //File menu operations
+ //NoAction = 0,
+// HbMenu *mFileMenu;
+// HbAction *mFileBackMoveUp;
+// HbAction *mFileOpenDrive;
+// HbAction *mFileOpenDirectory;
+// HbAction *mFileSearch;
+// HbMenu *mFileNewMenu;
+// HbAction *mFileNewFile;
+// HbAction *mFileNewDirectory;
+// HbAction *mFileDelete;
+// HbAction *mFileRename;
+// HbAction *mFileTouch;
+// HbAction *mFileProperties;
+// HbMenu *mFileChecksumsMenu;
+// HbAction *mFileChecksumsMD5;
+// HbAction *mFileChecksumsMD2;
+// HbAction *mFileChecksumsSHA1;
+// HbAction *mFileSetAttributes;
+//
+// //Edit -
+// HbMenu *mEditMenu;
+// HbAction *mEditSnapShotToE;
+// HbAction *mEditCut;
+// HbAction *mEditCopy;
+// HbAction *mEditPaste;
+// HbAction *mEditCopyToFolder;
+// HbAction *mEditMoveToFolder;
+// HbAction *mEditSelect;
+// HbAction *mEditUnselect;
+// HbAction *mEditSelectAll;
+// HbAction *mEditUnselectAll;
+//
+// // View -
+// HbMenu *mViewMenu;
+// HbAction *mViewFilterEntries;
+// HbAction *mViewRefresh;
+
+ // Disk admin -
+ HbMenu *mDiskAdminMenu;
+ HbAction *mDiskAdminSetDrivePassword;
+ HbAction *mDiskAdminUnlockDrive;
+ HbAction *mDiskAdminClearDrivePassword;
+ HbAction *mDiskAdminEraseDrivePassword;
+ HbAction *mDiskAdminFormatDrive;
+ HbAction *mDiskAdminQuickFormatDrive;
+ HbAction *mDiskAdminCheckDisk;
+ HbAction *mDiskAdminScanDrive;
+ HbAction *mDiskAdminSetDriveName;
+ HbAction *mDiskAdminSetDriveVolumeLabel;
+ HbAction *mDiskAdminEjectDrive;
+ HbAction *mDiskAdminDismountDrive;
+ HbAction *mDiskAdminEraseMBR;
+ HbAction *mDiskAdminPartitionDrive;
+//
+// // Tools -
+// HbMenu *mToolsMenu;
+// HbAction *mToolsAllAppsToTextFile;
+// HbAction *mToolsAllFilesToTextFile;
+//
+// HbMenu *mToolsAvkonIconCacheMenu;
+// HbAction *mToolsAvkonIconCacheEnable;
+// HbAction *mToolsAvkonIconCacheDisable;
+//
+// HbAction *mToolsDisableExtendedErrors;
+// HbAction *mToolsDumpMsgStoreWalk;
+// HbAction *mToolsEditDataTypes;
+//
+// HbAction *mToolsEnableExtendedErrors;
+//
+// HbMenu *mToolsErrorSimulateMenu;
+// HbAction *mToolsErrorSimulateLeave;
+// HbAction *mToolsErrorSimulatePanic;
+// HbAction *mToolsErrorSimulateException;
+//
+// HbMenu *mToolsMessageAttachmentsMenu;
+// HbAction *mToolsMessageInbox;
+// HbAction *mToolsMessageDrafts;
+// HbAction *mToolsMessageSentItems;
+// HbAction *mToolsMessageOutbox;
+//
+// HbMenu *mToolsLocalConnectivityMenu;
+// HbAction *mToolsLocalConnectivityActivateInfrared;
+// HbAction *mToolsLocalConnectivityLaunchBTUI;
+// HbAction *mToolsLocalConnectivityLaunchUSBUI;
+//
+// HbAction *mToolsMemoryInfo;
+//
+// HbMenu *mToolsSecureBackupMenu;
+// HbAction *mToolsSecureBackStart;
+// HbAction *mToolsSecureBackRestore;
+// HbAction *mToolsSecureBackStop;
+//
+// HbAction *mToolsSetDebugMask;
+// HbAction *mToolsShowOpenFilesHere;
+};
+
+class FileViewFileContextMenu
+{
+public:
+ FileViewFileContextMenu() :
+ //NoAction = 0,
+ mFileMenu(0),
+ mFileBackMoveUp(0),
+// mFileOpenDrive(0),
+//?? mFileOpenDirectory(0),
+// mFileSearch(0),
+ mFileNewMenu(0),
+ mFileNewFile(0),
+ mFileNewDirectory(0),
+ mFileDelete(0),
+ mFileRename(0),
+ mFileTouch(0),
+ mFileProperties(0),
+ mFileChecksumsMenu(0),
+ mFileChecksumsMD5(0),
+ mFileChecksumsMD2(0),
+ mFileChecksumsSHA1(0),
+ mFileSetAttributes(0),
+ //Edit -
+ mEditMenu(0),
+//?? mEditSnapShotToE(0),
+ mEditCut(0),
+ mEditCopy(0),
+ mEditPaste(0),
+ mEditCopyToFolder(0),
+ mEditMoveToFolder(0)
+// mEditSelect(0),
+// mEditUnselect(0),
+// mEditSelectAll(0),
+// mEditUnselectAll(0),
+// // View -
+// mViewMenu(0),
+// mViewFilterEntries(0),
+// mViewRefresh(0),
+// // Tools -
+// mToolsMenu(0),
+// mToolsAllAppsToTextFile(0),
+// mToolsAllFilesToTextFile(0),
+// mToolsAvkonIconCacheMenu(0),
+// mToolsAvkonIconCacheEnable(0),
+// mToolsAvkonIconCacheDisable(0),
+// mToolsDisableExtendedErrors(0),
+// mToolsDumpMsgStoreWalk(0),
+// mToolsEditDataTypes(0),
+// mToolsEnableExtendedErrors(0),
+// mToolsErrorSimulateMenu(0),
+// mToolsErrorSimulateLeave(0),
+// mToolsErrorSimulatePanic(0),
+// mToolsErrorSimulateException(0),
+// mToolsMessageAttachmentsMenu(0),
+// mToolsMessageInbox(0),
+// mToolsMessageDrafts(0),
+// mToolsMessageSentItems(0),
+// mToolsMessageOutbox(0),
+// // mLocalConnectivityMenu(0),
+// // mToolsLocalConnectivityActivateInfrared(0),
+// // mToolsLocalConnectivityLaunchBTUI(0),
+// // mToolsLocalConnectivityLaunchUSBUI(0),
+// mToolsMemoryInfo(0),
+// mToolsSecureBackupMenu(0),
+// mToolsSecureBackStart(0),
+// mToolsSecureBackRestore(0),
+// mToolsSecureBackStop(0),
+// mToolsSetDebugMask(0),
+// mToolsShowOpenFilesHere(0),
+// mSelection(0),
+// mSetting(0),
+// mAbout(0),
+// mExit(0)
+ {
+
+ }
+
+ ~FileViewFileContextMenu() { }
+public:
+ //File menu operations
+ //NoAction = 0,
+ HbMenu *mFileMenu;
+ HbAction *mFileBackMoveUp;
+// HbAction *mFileOpenDrive;
+//?? HbAction *mFileOpenDirectory;
+// HbAction *mFileSearch;
+ HbMenu *mFileNewMenu;
+ HbAction *mFileNewFile;
+ HbAction *mFileNewDirectory;
+ HbAction *mFileDelete;
+ HbAction *mFileRename;
+ HbAction *mFileTouch;
+ HbAction *mFileProperties;
+ HbMenu *mFileChecksumsMenu;
+ HbAction *mFileChecksumsMD5;
+ HbAction *mFileChecksumsMD2;
+ HbAction *mFileChecksumsSHA1;
+ HbAction *mFileSetAttributes;
+
+ //Edit -
+ HbMenu *mEditMenu;
+//?? HbAction *mEditSnapShotToE;
+ HbAction *mEditCut;
+ HbAction *mEditCopy;
+ HbAction *mEditPaste;
+ HbAction *mEditCopyToFolder;
+ HbAction *mEditMoveToFolder;
+// HbAction *mEditSelect;
+// HbAction *mEditUnselect;
+// HbAction *mEditSelectAll;
+// HbAction *mEditUnselectAll;
+//
+// // View -
+// HbMenu *mViewMenu;
+// HbAction *mViewFilterEntries;
+// HbAction *mViewRefresh;
+//
+// // Tools -
+// HbMenu *mToolsMenu;
+// HbAction *mToolsAllAppsToTextFile;
+// HbAction *mToolsAllFilesToTextFile;
+//
+// HbMenu *mToolsAvkonIconCacheMenu;
+// HbAction *mToolsAvkonIconCacheEnable;
+// HbAction *mToolsAvkonIconCacheDisable;
+//
+// HbAction *mToolsDisableExtendedErrors;
+// HbAction *mToolsDumpMsgStoreWalk;
+// HbAction *mToolsEditDataTypes;
+//
+// HbAction *mToolsEnableExtendedErrors;
+//
+// HbMenu *mToolsErrorSimulateMenu;
+// HbAction *mToolsErrorSimulateLeave;
+// HbAction *mToolsErrorSimulatePanic;
+// HbAction *mToolsErrorSimulateException;
+//
+// HbMenu *mToolsMessageAttachmentsMenu;
+// HbAction *mToolsMessageInbox;
+// HbAction *mToolsMessageDrafts;
+// HbAction *mToolsMessageSentItems;
+// HbAction *mToolsMessageOutbox;
+//
+// HbMenu *mToolsLocalConnectivityMenu;
+// HbAction *mToolsLocalConnectivityActivateInfrared;
+// HbAction *mToolsLocalConnectivityLaunchBTUI;
+// HbAction *mToolsLocalConnectivityLaunchUSBUI;
+//
+// HbAction *mToolsMemoryInfo;
+//
+// HbMenu *mToolsSecureBackupMenu;
+// HbAction *mToolsSecureBackStart;
+// HbAction *mToolsSecureBackRestore;
+// HbAction *mToolsSecureBackStop;
+//
+// HbAction *mToolsSetDebugMask;
+// HbAction *mToolsShowOpenFilesHere;
+//
+// HbAction *mSelection;
+// HbAction *mSetting;
+// HbAction *mAbout;
+// HbAction *mExit;
+};
+
#endif // MENUACTION_H
--- a/filebrowser/ui/inc/notifications.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/inc/notifications.h Fri May 14 16:10:39 2010 +0300
@@ -18,24 +18,19 @@
#ifndef NOTIFICATIONS_H_
#define NOTIFICATIONS_H_
-//#include <hbdeviceprogressdialog.h>
#include <hbmessagebox.h>
+class HbProgressDialog;
+
class Notifications
{
public:
-
static void showAboutNote();
static void showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout = HbPopup::NoTimeout);
static void showInformationNote(const QString &text, const QString &title = QString());
static void showErrorNote(const QString &text, bool noTimeout = false);
static void showConfirmationNote(const QString &text, bool noTimeout = false);
static bool showConfirmationQuery(const QString &aText);
-
-
-// static HbDeviceProgressDialog* showWaitDialog(const QString &text);
-
-private:
};
#endif // NOTIFICATIONS_H_
--- a/filebrowser/ui/inc/searchview.h Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/inc/searchview.h Fri May 14 16:10:39 2010 +0300
@@ -18,16 +18,18 @@
#ifndef SEARCHVIEW_H
#define SEARCHVIEW_H
-#include <hbview.h>
-#include <hbmainwindow.h>
+#include <HbView>
+#include <HbMainWindow>
-#include <qdatetime.h>
+#include <QDateTime>
class QDir;
+class QStringList;
+
class EngineWrapper;
-class QStringList;
class HbDataForm;
class HbDataFormModelItem;
+class HbProgressDialog;
/**
* Settings class that is used for
@@ -51,8 +53,8 @@
class SearchResults
{
public:
- int mNumberOfFoundFiles;
- QStringList* mFoundFilesList;
+ int mNumberOfFoundFiles;
+ QStringList *mFoundFilesList;
};
class SearchView : public HbView
@@ -60,24 +62,27 @@
Q_OBJECT
public:
- SearchView(HbView &mainView, HbMainWindow &mainWindow, EngineWrapper &engineWrapper);
+ explicit SearchView(EngineWrapper &engineWrapper);
~SearchView();
void open(const QString &path);
+signals:
+ void finished(bool ok);
private slots:
- void backButtonClicked();
- void startFileSearch();
+ void accept();
+ void reject();
+
+private:
+ void initDataForm();
+ void createToolbar();
void loadAttributes();
void readFormItems();
-
-private:
+
+ void startFileSearch();
void fileSearchResults();
- /* Main Window of folderbrowser */
- HbMainWindow &mMainWindow;
- /* Main View of folderbrowser*/
- HbView &mMainView;
+private:
/* EngineWrapper */
EngineWrapper &mEngineWrapper;
@@ -97,6 +102,8 @@
HbDataFormModelItem *mMaxDate;
QString mPath;
+
+ HbProgressDialog *mProgressDialog;
};
#endif // SEARCHVIEW_H
--- a/filebrowser/ui/src/enginewrapper.cpp Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/src/enginewrapper.cpp Fri May 14 16:10:39 2010 +0300
@@ -24,6 +24,8 @@
#include "filebrowsersettings.h"
#include "settingsview.h"
+#include <HbProgressDialog>
+
#include <QString>
#include <QFileInfo>
#include <QModelIndex>
@@ -33,7 +35,8 @@
EngineWrapper::EngineWrapper()
: mEngine(0),
mFilesFound(),
- mSettings(0)
+ mSettings(0),
+ mWaitDialog(0)
{
}
@@ -45,6 +48,8 @@
TRAP_IGNORE(mEngine->DeActivateEngineL());
delete mEngine;
}
+ if (mWaitDialog)
+ delete mWaitDialog;
}
// ---------------------------------------------------------------------------
@@ -686,6 +691,11 @@
mEngine->FileUtils()->SetDebugMaskL(aDbgMask);
}
+void EngineWrapper::toolsWriteAllFiles()
+{
+ mEngine->FileUtils()->WriteAllFilesL();
+}
+
void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType)
{
mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType);
@@ -699,8 +709,8 @@
void EngineWrapper::ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
{
- QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
- Notifications::showErrorNote(qStringText, aNoTimeout);
+ QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+ Notifications::showErrorNote(qText, aNoTimeout);
}
// ---------------------------------------------------------------------------
@@ -716,14 +726,44 @@
void EngineWrapper::ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
{
- QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
- Notifications::showConfirmationNote(qStringText, aNoTimeout);
+ QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+ Notifications::showConfirmationNote(qText, aNoTimeout);
+}
+
+void EngineWrapper::ShowWaitDialog(const TDesC& aDescText)
+{
+ const QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+ if (!mWaitDialog) {
+ mWaitDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
+ QObject::connect(mWaitDialog, SIGNAL(cancelled ()), this, SLOT(waitDialogCancelled()));
+ }
+
+ mWaitDialog->setText(qText);
+ mEngine->FileUtils()->SetAllowProcessing(true);
+ //mWaitDialog->setAttribute(Qt::WA_DeleteOnClose);
+ mWaitDialog->show();
+}
+
+void EngineWrapper::CancelWaitDialog()
+{
+ if (mWaitDialog)
+ mWaitDialog->cancel();
+}
+
+void EngineWrapper::waitDialogCancelled()
+{
+ mEngine->FileUtils()->SetAllowProcessing(false);
+}
+
+void EngineWrapper::ProcessEvents()
+{
+ qApp->processEvents();
}
TBool EngineWrapper::ShowConfirmationQuery(const TDesC& aDescText)
{
- QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
- return Notifications::showConfirmationQuery(qStringText);
+ QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+ return Notifications::showConfirmationQuery(qText);
}
// ---------------------------------------------------------------------------
--- a/filebrowser/ui/src/filebrowsermainwindow.cpp Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/src/filebrowsermainwindow.cpp Fri May 14 16:10:39 2010 +0300
@@ -24,13 +24,15 @@
#include "filebrowserview.h"
#include "settingsview.h"
#include "editorview.h"
+#include "searchview.h"
-FileBrowserMainWindow::FileBrowserMainWindow(QWidget *parent) :
- HbMainWindow( parent )
- ,mEngineWrapper(0)
- ,mFileBrowserView(0)
- ,mSettingsView(0)
- ,mEditorView(0)
+FileBrowserMainWindow::FileBrowserMainWindow(QWidget *parent)
+ : HbMainWindow(parent),
+ mEngineWrapper(0),
+ mFileBrowserView(0),
+ mSettingsView(0),
+ mEditorView(0),
+ mSearchView(0)
{
}
@@ -65,14 +67,22 @@
connect(mEditorView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView()));
addView(mEditorView);
+ // Create Search view
+ mSearchView = new SearchView(*mEngineWrapper);
+ connect(mFileBrowserView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString)));
+ connect(mSearchView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView()));
+ addView(mSearchView);
+
// Show ApplicationView at startup
setCurrentView(mFileBrowserView);
+
// Show HbMainWindow
show();
}
void FileBrowserMainWindow::openFileBrowserView()
{
+ mFileBrowserView->refreshList();
setCurrentView(mFileBrowserView);
}
@@ -86,3 +96,9 @@
mEditorView->open(fileName, flagReadOnly);
setCurrentView(mEditorView);
}
+
+void FileBrowserMainWindow::openSearchView(const QString &path)
+{
+ mSearchView->open(path);
+ setCurrentView(mSearchView);
+}
--- a/filebrowser/ui/src/filebrowserview.cpp Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/src/filebrowserview.cpp Fri May 14 16:10:39 2010 +0300
@@ -67,8 +67,6 @@
mFileBrowserModel(0),
mFileViewMenuActions(),
mToolbarBackAction(0),
- mSearch(0),
- mSettingsView(0),
mItemHighlighted(false),
mLocationChanged(false),
mRemoveFileAfterCopied(false),
@@ -78,7 +76,8 @@
mPanicCategory(),
mAbsoluteFilePath(),
mOverwriteOptions(),
- mIsRenameAllowed(true),
+ mModelIndex(),
+ mNewFileName(),
mProceed(false),
mEraseMBR(false)
{
@@ -107,7 +106,6 @@
//mListView->setRootIndex(model->index());
mListView->setScrollingStyle(HbScrollArea::PanWithFollowOn);
- //mListView->setHighlightMode(HbItemHighlight::HighlightAlwaysVisible);
connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
@@ -129,12 +127,6 @@
FileBrowserView::~FileBrowserView()
{
-// if (mSearch !=0) {
-// delete mSearch;
-// }
-// if (mSettingsView != 0) {
-// delete mSettingsView;
-// }
// if (mEngineWrapper) {
// delete mEngineWrapper;
// }
@@ -195,8 +187,8 @@
mFileViewMenuActions.mFileBackMoveUp = mFileViewMenuActions.mFileMenu->addAction("Back/Move up (<-)", this, SLOT(fileBackMoveUp()));
mFileViewMenuActions.mFileOpenDrive = mFileViewMenuActions.mFileMenu->addAction("Open drive (->)", this, SLOT(fileOpenDrive()));
mFileViewMenuActions.mFileOpenDirectory = mFileViewMenuActions.mFileMenu->addAction("Open directory (->)", this, SLOT(fileOpenDirectory()));
- mFileViewMenuActions.mFileSearch = mFileViewMenuActions.mFileMenu->addAction("Search", this, SLOT(fileSearch()));
- mFileViewMenuActions.mFileSearch->setVisible(false);
+ mFileViewMenuActions.mFileSearch = mFileViewMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch()));
+ //mFileViewMenuActions.mFileSearch->setVisible(false);
mFileViewMenuActions.mFileNewMenu = mFileViewMenuActions.mFileMenu->addMenu("New");
mFileViewMenuActions.mFileNewFile = mFileViewMenuActions.mFileNewMenu->addAction("File", this, SLOT(fileNewFile()));
@@ -262,8 +254,12 @@
mFileViewMenuActions.mDiskAdminUnlockDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Unlock drive", this, SLOT(diskAdminUnlockDrive()));
mFileViewMenuActions.mDiskAdminClearDrivePassword = mFileViewMenuActions.mDiskAdminMenu->addAction("Clear drive password", this, SLOT(diskAdminClearDrivePassword()));
mFileViewMenuActions.mDiskAdminEraseDrivePassword = mFileViewMenuActions.mDiskAdminMenu->addAction("Erase drive password", this, SLOT(diskAdminEraseDrivePassword()));
+
mFileViewMenuActions.mDiskAdminFormatDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Format drive", this, SLOT(diskAdminFormatDrive()));
+ mFileViewMenuActions.mDiskAdminFormatDrive->setVisible(false);
mFileViewMenuActions.mDiskAdminQuickFormatDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Quick format drive", this, SLOT(diskAdminQuickFormatDrive()));
+ mFileViewMenuActions.mDiskAdminQuickFormatDrive->setVisible(false);
+
mFileViewMenuActions.mDiskAdminCheckDisk = mFileViewMenuActions.mDiskAdminMenu->addAction("Check disk", this, SLOT(diskAdminCheckDisk()));
mFileViewMenuActions.mDiskAdminScanDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Scan drive", this, SLOT(diskAdminScanDrive()));
mFileViewMenuActions.mDiskAdminSetDriveName = mFileViewMenuActions.mDiskAdminMenu->addAction("Set drive name", this, SLOT(diskAdminSetDriveName()));
@@ -284,7 +280,7 @@
mFileViewMenuActions.mToolsAllAppsToTextFile = mFileViewMenuActions.mToolsMenu->addAction("All apps to a text file", this, SLOT(toolsAllAppsToTextFile()));
mFileViewMenuActions.mToolsAllAppsToTextFile->setVisible(false);
mFileViewMenuActions.mToolsAllFilesToTextFile = mFileViewMenuActions.mToolsMenu->addAction("All files to a text file", this, SLOT(toolsAllFilesToTextFile()));
- mFileViewMenuActions.mToolsAllFilesToTextFile->setVisible(false);
+ //mFileViewMenuActions.mToolsAllFilesToTextFile->setVisible(false);
mFileViewMenuActions.mToolsAvkonIconCacheMenu = mFileViewMenuActions.mToolsMenu->addMenu("Avkon icon cache");
mFileViewMenuActions.mToolsAvkonIconCacheMenu->menuAction()->setVisible(false);
@@ -348,7 +344,7 @@
*/
void FileBrowserView::createSettingsMenuItem()
{
- mFileViewMenuActions.mSetting = menu()->addAction("Settings");
+ mFileViewMenuActions.mSetting = menu()->addAction("Settings...");
connect(mFileViewMenuActions.mSetting, SIGNAL(triggered()), this, SIGNAL(aboutToShowSettingsView()));
}
@@ -503,10 +499,11 @@
// ---------------------------------------------------------------------------
void FileBrowserView::fileOpen(HbAction *action)
-{
+{
+// Q_UNUSED(action);
HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
- if(!action && dlg && dlg->selectedModelIndexes().count()){
- int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+ if(!action && dlg && dlg->selectedItems().count()){
+ int selectionIndex = dlg->selectedItems().at(0).toInt();
if (selectionIndex == 0) {
// open editor view
@@ -541,9 +538,10 @@
*/
void FileBrowserView::fileOverwrite(HbAction *action)
{
+// Q_UNUSED(action);
HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
- if(!action && dlg && dlg->selectedModelIndexes().count()) {
- mOverwriteOptions.queryIndex = dlg->selectedModelIndexes().at(0).row();
+ if(!action && dlg && dlg->selectedItems().count()) {
+ mOverwriteOptions.queryIndex = dlg->selectedItems().at(0).toInt();
if (mOverwriteOptions.queryIndex == EFileActionQueryPostFix) {
QString heading = QString("Postfix");
HbInputDialog::getText(heading, this, SLOT(fileOverwritePostfix(HbAction *)), QString(), scene());
@@ -561,7 +559,7 @@
void FileBrowserView::fileOverwritePostfix(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
mOverwriteOptions.postFix = dlg->value().toString();
} else {
mOverwriteOptions.doFileOperations = false;
@@ -572,11 +570,15 @@
/**
Show a list dialog
\param List aList of item to select item from.
- \param Title text aTitleText of a dialog heading widget
+ \param Title text titleText of a dialog heading widget
\return None
*/
-void FileBrowserView::openListDialog(const QStringList& items, const QString &aTitleText, QObject* receiver, const char* member)
+void FileBrowserView::openListDialog(const QStringList& items, const QString &titleText, QObject* receiver, const char* member)
{
+// Q_UNUSED(items);
+// Q_UNUSED(titleText);
+// Q_UNUSED(receiver);
+// Q_UNUSED(member);
// Create a list and some simple content for it
HbSelectionDialog *dlg = new HbSelectionDialog();
dlg->setAttribute(Qt::WA_DeleteOnClose);
@@ -584,9 +586,9 @@
dlg->setStringItems(items);
dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
//dlg->setDismissPolicy(HbPopup::TapOutside);
-
+
HbLabel *title = new HbLabel(dlg);
- title->setPlainText(aTitleText);
+ title->setPlainText(titleText);
dlg->setHeadingWidget(title);
// Launch popup and handle the user response:
@@ -595,89 +597,6 @@
// ---------------------------------------------------------------------------
-HbDialog *FileBrowserView::filePathQuery(const QString &headingText,
- const QString &text,
- const QString &primaryActionText,
- const QString &secondaryActionText)
-{
- HbDialog *dialog = new HbDialog();
- dialog->setDismissPolicy(HbPopup::TapOutside);
- dialog->setTimeout(HbPopup::NoTimeout);
- HbLineEdit *edit = new HbLineEdit();
- HbAction *primaryAction = new HbAction(primaryActionText);
- HbAction *secondaryAction = new HbAction(secondaryActionText);
- // connect signal to close pop-up if cancel selected:
- connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close()));
- edit->setText(text);
- dialog->setHeadingWidget(new HbLabel(headingText));
- //popup->setHeadingWidget(dlgTitle);
- dialog->setContentWidget(edit);
- dialog->setPrimaryAction(primaryAction);
- dialog->setSecondaryAction(secondaryAction);
-
- return dialog;
-}
-
-// ---------------------------------------------------------------------------
-
-//HbDialog *FileBrowserView::openTextQuery(const QString &headingText,
-// const QString &text,
-// const QString &primaryActionText,
-// const QString &secondaryActionText)
-//{
-// HbDialog *dialog = new HbDialog();
-// dialog->setDismissPolicy(HbPopup::TapOutside);
-// dialog->setTimeout(HbPopup::NoTimeout);
-// HbLineEdit *edit = new HbLineEdit();
-// HbAction *primaryAction = new HbAction(primaryActionText);
-// HbAction *secondaryAction = new HbAction(secondaryActionText);
-// // connect signal to close pop-up if cancel selected:
-// connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close()));
-// edit->setText(text);
-// dialog->setHeadingWidget(new HbLabel(headingText));
-// //popup->setHeadingWidget(dlgTitle);
-// dialog->setContentWidget(edit);
-// dialog->setPrimaryAction(primaryAction);
-// dialog->setSecondaryAction(secondaryAction);
-//
-// return dialog;
-//}
-
-// ---------------------------------------------------------------------------
-
-HbDialog *FileBrowserView::openNumberQuery(const QString &headingText,
- const QString &text,
- const QString &primaryActionText,
- const QString &secondaryActionText,
- int aMin/* = -99999*/,
- int aMax/* = 99999*/)
-{
- HbDialog *dialog = new HbDialog();
- dialog->setDismissPolicy(HbPopup::TapOutside);
- dialog->setTimeout(HbPopup::NoTimeout);
- HbAction *primaryAction = new HbAction(primaryActionText);
- HbAction *secondaryAction = new HbAction(secondaryActionText);
- // connect signal to close pop-up if cancel selected:
- connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close()));
-
- HbLineEdit *edit = new HbLineEdit();
- HbValidator *validator = new HbValidator();
- validator->addField(new QIntValidator(aMin, aMax, 0), text);
- edit->setValidator(validator);
- edit->setInputMethodHints(Qt::ImhDigitsOnly);
-
- //edit->setText(text);
- dialog->setHeadingWidget(new HbLabel(headingText));
- //popup->setHeadingWidget(dlgTitle);
- dialog->setContentWidget(edit);
- dialog->setPrimaryAction(primaryAction);
- dialog->setSecondaryAction(secondaryAction);
-
- return dialog;
-}
-
-// ---------------------------------------------------------------------------
-
void FileBrowserView::openPropertyDialog(const QStringList& propertyList, const QString& title)
{
HbDialog *dialog = new HbDialog();
@@ -717,10 +636,10 @@
if (selectionIndexes->hasSelection()) {
modelIndexList = mListView->selectionModel()->selectedIndexes();
} else { // or if none selected, use the current item index
- QModelIndex currentIndex = currentItemIndex();
+// QModelIndex currentIndex = currentItemIndex();
// if (mFileBrowserModel->rowCount(currentItemIndex) > currentItemIndex && currentItemIndex >= 0)
// {
- modelIndexList.append(currentIndex);
+// modelIndexList.append(currentIndex);
// }
}
}
@@ -800,19 +719,15 @@
void FileBrowserView::fileSearch()
{
- // create and launch search:
-// if(mSearch != 0){
-// delete mSearch;
-// mSearch = 0;
-// }
-// mSearch = new SearchView(*this, mMainWindow, *mEngineWrapper);
-// QString searchPath;
-// if (mDirectory != mInitDirPath.path()) {
+ QString searchPath;
+// if (mEngineWrapper->currentPath() != mInitDirPath.path()) {
// searchPath = mDirectory;
// searchPath.replace("/", "\\");
// searchPath+="\\";
// }
+ searchPath = mEngineWrapper->currentPath();
// mSearch->open(searchPath);
+ emit aboutToShowSearchView(searchPath);
}
/**
@@ -830,8 +745,7 @@
void FileBrowserView::doFileNewFile(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction())
- {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString newFileName = dlg->value().toString();
mEngineWrapper->createNewFile(newFileName);
refreshList();
@@ -853,8 +767,7 @@
void FileBrowserView::doFileNewDirectory(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction())
- {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString newDirectoryName = dlg->value().toString();
mEngineWrapper->createNewDirectory(newDirectoryName);
refreshList();
@@ -877,8 +790,7 @@
*/
void FileBrowserView::doFileDelete(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
mEngineWrapper->deleteItems(currentSelection);
refreshList();
@@ -894,15 +806,13 @@
mEngineWrapper->setCurrentSelection(currentSelection);
for (int i(0), ie(currentSelection.count()); i < ie; ++i ) {
+ mProceed = (i == ie-1); // if the last item
mModelIndex = currentSelection.at(i);
FileEntry entry = mEngineWrapper->getFileEntry(mModelIndex);
QString heading = QString("Enter new name");
HbInputDialog::getText(heading, this, SLOT(doFileRename(HbAction*)), entry.name(), scene());
-
}
- mEngineWrapper->startExecutingCommands(QString("Renaming"));
- refreshList();
}
/**
@@ -911,18 +821,19 @@
void FileBrowserView::doFileRename(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction())
- {
- QString newName = dlg->value().toString();
-
- if (mEngineWrapper->targetExists(mModelIndex, newName)) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+ mNewFileName = dlg->value().toString();
+ if (mEngineWrapper->targetExists(mModelIndex, mNewFileName)) {
const QString messageTemplate = QString("%1 already exists, overwrite?");
- QString message = messageTemplate.arg(newName);
+ QString message = messageTemplate.arg(mNewFileName);
HbMessageBox::question(message, this, SLOT(doFileRenameFileExist(HbAction *)));
- }
- if (mIsRenameAllowed) {
- mEngineWrapper->rename(mModelIndex, newName);
+ } else {
+ mEngineWrapper->rename(mModelIndex, mNewFileName);
+ if (mProceed) {
+ mEngineWrapper->startExecutingCommands(QString("Renaming"));
+ refreshList();
+ }
}
}
}
@@ -932,9 +843,12 @@
*/
void FileBrowserView::doFileRenameFileExist(HbAction *action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->secondaryAction()) {
- mIsRenameAllowed = false;
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+ mEngineWrapper->rename(mModelIndex, mNewFileName);
+ if (mProceed) {
+ mEngineWrapper->startExecutingCommands(QString("Renaming"));
+ refreshList();
+ }
}
}
@@ -962,8 +876,7 @@
void FileBrowserView::doFileTouch(HbAction* action)
{
bool recurse = false;
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
recurse = true;
}
mEngineWrapper->touch(recurse);
@@ -1081,8 +994,7 @@
void FileBrowserView::doEditCopyToFolder(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction())
- {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString targetDir = dlg->value().toString();
bool someEntryExists(false);
@@ -1114,8 +1026,7 @@
void FileBrowserView::doEditMoveToFolder(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction())
- {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString targetDir = dlg->value().toString();
bool someEntryExists(false);
@@ -1223,7 +1134,7 @@
void FileBrowserView::diskAdminSetDrivePasswordNew(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
mOldPassword = dlg->value().toString();
}
@@ -1237,7 +1148,7 @@
void FileBrowserView::doDiskAdminSetDrivePassword(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString newPassword = dlg->value().toString();
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminSetDrivePassword(currentIndex, mOldPassword, newPassword);
@@ -1266,8 +1177,7 @@
void FileBrowserView::doDiskAdminUnlockDrive(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction())
- {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString oldPassword = dlg->value().toString();
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminUnlockDrive(currentIndex, oldPassword);
@@ -1296,8 +1206,7 @@
void FileBrowserView::doDiskAdminClearDrivePassword(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction())
- {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString oldPassword = dlg->value().toString();
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminClearDrivePassword(currentIndex, oldPassword);
@@ -1325,8 +1234,7 @@
*/
void FileBrowserView::doDiskAdminEraseDrivePassword(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminEraseDrivePassword(currentIndex);
refreshList();
@@ -1346,8 +1254,7 @@
*/
void FileBrowserView::doDiskAdminFormatDrive(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminFormatDrive(currentIndex, false);
}
@@ -1366,8 +1273,7 @@
*/
void FileBrowserView::doDiskAdminQuickFormatDrive(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminFormatDrive(currentIndex, true);
}
@@ -1395,8 +1301,7 @@
*/
void FileBrowserView::doDiskAdminScanDrive(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminScanDrive(currentIndex);
refreshList();
@@ -1424,7 +1329,7 @@
void FileBrowserView::doDiskAdminSetDriveName(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString driveName = dlg->value().toString();
QModelIndex currentIndex = currentItemIndex();
@@ -1455,7 +1360,7 @@
void FileBrowserView::doDiskAdminSetDriveVolumeLabel(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString volumeLabel = dlg->value().toString();
QModelIndex currentIndex = currentItemIndex();
@@ -1485,8 +1390,7 @@
void FileBrowserView::doDiskAdminDismountDrive(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminDismountDrive(currentIndex);
refreshList();
@@ -1505,16 +1409,14 @@
void FileBrowserView::doDiskAdminEraseMBR(HbAction* action)
{
// TODO What to do with FB LITE macros?
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()){
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"), this, SLOT(doDiskAdminReallyEraseMBR(HbAction*)));
}
}
void FileBrowserView::doDiskAdminReallyEraseMBR(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
// warn if the selected drive is not detected as removable
if (mEngineWrapper->isDriveRemovable(currentIndex)) {
@@ -1528,8 +1430,7 @@
void FileBrowserView::doDiskAdminNotRemovableReallyEraseMBR(HbAction* action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
mEngineWrapper->DiskAdminEraseMBR(currentIndex);
refreshList();
@@ -1551,8 +1452,7 @@
*/
void FileBrowserView::diskAdminPartitionDriveProceed(HbAction *action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
const QString message("Are you really sure you know what are you doing ?!?");
HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveReallyProceed(HbAction *)));
}
@@ -1563,11 +1463,11 @@
*/
void FileBrowserView::diskAdminPartitionDriveReallyProceed(HbAction *action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
QModelIndex currentIndex = currentItemIndex();
mEraseMBR = false;
// warn if the selected drive is not detected as removable
+ mProceed = false;
if (mEngineWrapper->isDriveRemovable(currentIndex)) {
mProceed = true;
} else {
@@ -1595,8 +1495,7 @@
*/
void FileBrowserView::diskAdminPartitionDriveIsNotRemovable(HbAction *action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
mProceed = true;
} else {
mProceed = false;
@@ -1608,8 +1507,7 @@
*/
void FileBrowserView::diskAdminPartitionDriveEraseMbr(HbAction *action)
{
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
- if (action == dlg->primaryAction()) {
+ if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
mEraseMBR = true;
}
}
@@ -1619,6 +1517,7 @@
*/
void FileBrowserView::diskAdminPartitionDriveGetCount(HbAction* action)
{
+// Q_UNUSED(action);
HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
if(!action && dlg && dlg->selectedItems().count()){
int selectionIndex = dlg->selectedItems().at(0).toInt();
@@ -1636,10 +1535,15 @@
{
}
+
+/**
+ Write all files to text file
+ */
void FileBrowserView::toolsAllFilesToTextFile()
{
+ mEngineWrapper->toolsWriteAllFiles();
+}
-}
void FileBrowserView::toolsAvkonIconCacheEnable()
{
@@ -1692,7 +1596,7 @@
void FileBrowserView::doToolsErrorSimulateLeave(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
bool ok;
int leaveCode = dlg->value().toString().toInt(&ok);
if (leaveCode != 0 || ok) {
@@ -1717,7 +1621,7 @@
void FileBrowserView::doToolsErrorSimulatePanicCode(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
mPanicCategory = dlg->value().toString();
int panicCode(555);
QString heading = QString("Panic code");
@@ -1731,7 +1635,7 @@
void FileBrowserView::doToolsErrorSimulatePanic(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
bool ok;
int panicCode = dlg->value().toInt(&ok);
if (panicCode != 0 || ok) {
@@ -1756,7 +1660,7 @@
void FileBrowserView::doToolsErrorSimulateException(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if (action == dlg->primaryAction()) {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
bool ok;
int exceptionCode = dlg->value().toInt(&ok);
if (exceptionCode != 0 || ok) {
@@ -1827,8 +1731,7 @@
void FileBrowserView::toolsSetDebugMask(HbAction *action)
{
HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
- if(action == dlg->primaryAction())
- {
+ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
QString dbgMaskText = dlg->value().toString();
if (dbgMaskText.length() > 2 && dbgMaskText[0]=='0' && dbgMaskText[1]=='x') {
bool ok;
@@ -1881,8 +1784,8 @@
*/
void FileBrowserView::selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
{
- QItemSelectionModel *selectionModel = mListView->selectionModel();
- itemHighlighted(selectionModel->currentIndex());
+ //QItemSelectionModel *selectionModel = mListView->selectionModel();
+ //itemHighlighted(selectionModel->currentIndex());
}
/**
--- a/filebrowser/ui/src/notifications.cpp Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/src/notifications.cpp Fri May 14 16:10:39 2010 +0300
@@ -14,14 +14,11 @@
* Description:
*
*/
-
-
-#include <hblabel.h>
-//#include <hbdeviceprogressdialog.h>
-#include <hbmessagebox.h>
-
#include "notifications.h"
+#include <HbLabel>
+#include <HbProgressDialog>
+#include <HbMessageBox>
// ---------------------------------------------------------------------------
@@ -50,16 +47,6 @@
// ---------------------------------------------------------------------------
-//HbDeviceProgressDialog* Notifications::showWaitDialog(const QString &text)
-//{
-// HbDeviceProgressDialog *note = new HbDeviceProgressDialog( HbProgressDialog::WaitDialog );
-// note->setText( text );
-// note->show();
-// return note;
-//}
-
-// ---------------------------------------------------------------------------
-
void Notifications::showInformationNote(const QString &text, const QString &title)
{
showMessageBox(HbMessageBox::MessageTypeInformation, text, title, false);
@@ -83,6 +70,7 @@
bool Notifications::showConfirmationQuery(const QString &aText)
{
+ Q_UNUSED(aText);
return false; //HbMessageBox::question(aText);
}
--- a/filebrowser/ui/src/searchview.cpp Fri May 14 15:15:12 2010 +0300
+++ b/filebrowser/ui/src/searchview.cpp Fri May 14 16:10:39 2010 +0300
@@ -17,62 +17,64 @@
#include "searchview.h"
#include "enginewrapper.h"
+#include "notifications.h"
#include <HbView>
-#include <HbMainWindow>
-
#include <HbDataForm>
#include <HbDataFormModel>
#include <HbDataFormModelItem>
#include <HbAction>
-#include <HbPushButton>
#include <HbListWidget>
#include <HbListWidgetItem>
#include <HbDialog>
-#include <HbMenu>
+#include <HbToolBar>
+#include <HbProgressDialog>
#include <QtGui>
#include <QDir>
#include <QFileInfo>
-#include <QProgressBar>
-
const QStringList RECURSEMODES = (QStringList() << "Non-recursive" << "Recursive");
+const QString acceptActionText = "Search";
+const QString rejectActionText = "Cancel";
-SearchView::SearchView(HbView &mainView, HbMainWindow &mainWindow, EngineWrapper &engineWrapper)
-: mMainWindow(mainWindow),
- mMainView(mainView),
- mEngineWrapper(engineWrapper),
- mAttributes(),
- mResults(),
- mForm(0),
- mSearchFileNameItem(0),
- mWildCardItem(0),
- mHasString(0),
- mRecurse(0),
- mMinSize(0),
- mMaxSize(0),
- mMinDate(0),
- mMaxDate(0),
- mPath()
+
+SearchView::SearchView(EngineWrapper &engineWrapper)
+ : mEngineWrapper(engineWrapper),
+ mAttributes(),
+ mResults(),
+ mForm(0),
+ mSearchFileNameItem(0),
+ mWildCardItem(0),
+ mHasString(0),
+ mRecurse(0),
+ mMinSize(0),
+ mMaxSize(0),
+ mMinDate(0),
+ mMaxDate(0),
+ mPath(),
+ mProgressDialog(0)
{
+ // Set title and add this view to main window
+ setTitle("Search");
+
+ // Override back navigation action
+ HbAction *leaveViewAction = new HbAction(Hb::BackNaviAction, this);
+ connect(leaveViewAction, SIGNAL(triggered()), this, SLOT(reject()));
+ setNavigationAction(leaveViewAction);
+
+ initDataForm();
+ createToolbar();
}
SearchView::~SearchView()
{
}
-void SearchView::open(const QString &path)
-{
- // Remove main view from main window
- mMainWindow.removeView(&mMainView);
- mMainWindow.addView(this);
- // Set title and add this view to main window
- setTitle("Search");
-
+void SearchView::initDataForm() {
mForm = new HbDataForm(/*HbFormView::ModeEdit,*/ this);
HbDataFormModel *model = new HbDataFormModel();
- mPath = path;
+
mSearchFileNameItem = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
mSearchFileNameItem->setLabel("Search dir: ");
@@ -81,28 +83,25 @@
mHasString = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
mHasString->setLabel("Has string: ");
-
+
mRecurse = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem);
mRecurse->setLabel("Recurse: ");
mRecurse->setContentWidgetData("items", RECURSEMODES);
-
+
mMinSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
mMinSize->setLabel("Min size: ");
-
+
mMaxSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
mMaxSize->setLabel("Max size: ");
-
+
mMinDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
mMinDate->setLabel("Min date: ");
mMinDate->setContentWidgetData("text", "01/01/1980");
-
+
mMaxDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
mMaxDate->setLabel("Max date: ");
mMaxDate->setContentWidgetData("text", "31/12/2060");
-
- // load file search attribute values from FB engine:
- loadAttributes();
-
+
model->appendDataFormItem(mSearchFileNameItem);
model->appendDataFormItem(mWildCardItem);
model->appendDataFormItem(mHasString);
@@ -114,82 +113,32 @@
mForm->setModel(model);
QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this);
-
- HbPushButton* buttonSearch = new HbPushButton("Search");
- buttonSearch->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
- connect(buttonSearch, SIGNAL(clicked()), this, SLOT(startFileSearch()));
-
- HbPushButton* buttonCancel = new HbPushButton("Cancel");
- buttonCancel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
- connect(buttonCancel, SIGNAL(clicked()), this, SLOT(backButtonClicked()));
-
- // Create widget and layout for buttons
- QGraphicsWidget *buttonsWidget = new QGraphicsWidget(this);
- QGraphicsGridLayout *gridLayout = new QGraphicsGridLayout(buttonsWidget);
-
- // add buttons to layout
- gridLayout->addItem(buttonSearch, 0, 0);
- gridLayout->addItem(buttonCancel, 0, 1);
- buttonsWidget->setLayout(gridLayout);
- // add form and buttons widget to list layout
- layout->addItem(mForm);
- layout->addItem(buttonsWidget);
+ layout->addItem(mForm);
setLayout(layout);
- // about to close connect to go back to file browser view
- connect(this, SIGNAL(aboutToClose()), this, SLOT(backButtonClicked()));
-}
-
-void SearchView::backButtonClicked()
-{
- mMainWindow.removeView(this);
- mForm->deleteLater();
- mForm = 0;
- mMainWindow.addView(&mMainView);
}
-void SearchView::startFileSearch()
+void SearchView::createToolbar()
{
- // save form data values and set them as search attributes into FB engine.
- readFormItems();
- mEngineWrapper.setFileSearchAttributes(mAttributes);
-
- // Create busy indicator widget with label **Searching**. Launch it to screen when
- // FB Utils engine started for file search. Hide busy indicator when search completed.
- QProgressBar *progressBar = new QProgressBar();
- progressBar->setMaximumHeight(16);
- progressBar->setMaximumWidth(200);
- progressBar->setTextVisible(false);
- progressBar->setMaximum(0);
- progressBar->setMinimum(0);
- progressBar->setValue(1);
+ HbToolBar *toolBar = new HbToolBar(this);
+ HbAction *acceptAction = new HbAction(acceptActionText);
+ connect(acceptAction, SIGNAL(triggered()), this, SLOT(accept()));
+ toolBar->addAction(acceptAction);
- QWidget *busyIndWidget = new QWidget();
- busyIndWidget->setGeometry(12, 50, 120, 60);
- QVBoxLayout *vbl = new QVBoxLayout(busyIndWidget);
- QLabel *label = new QLabel("**Searching**");
- vbl->addWidget(label);
- vbl->addWidget(progressBar);
- QHBoxLayout *hbl1 = new QHBoxLayout();
- vbl->addLayout(hbl1);
- busyIndWidget->show();
- qApp->processEvents();
- bool err = mEngineWrapper.searchFiles();
- busyIndWidget->hide();
+ HbAction *rejectAction = new HbAction(rejectActionText);
+ connect(rejectAction, SIGNAL(triggered()), this, SLOT(reject()));
+ toolBar->addAction(rejectAction);
- // show results of file search:
- mResults = mEngineWrapper.getSearchResults();
- fileSearchResults();
+ setToolBar(toolBar);
}
-
void SearchView::loadAttributes()
{
// get settings from engine;
mAttributes = mEngineWrapper.getFileSearchAttributes();
-
+
// set data:
mSearchFileNameItem->setContentWidgetData("text", mPath);
- mSearchFileNameItem->setContentWidgetData("text", mAttributes.mSearchDir);
+// mSearchFileNameItem->setContentWidgetData("text", mAttributes.mSearchDir);
mWildCardItem->setContentWidgetData("text",mAttributes.mWildCards);
mHasString->setContentWidgetData("text", mAttributes.mTextInFile);
@@ -202,23 +151,6 @@
mMaxDate->setContentWidgetData("text", mAttributes.mMaxDate);
}
-
-void SearchView::fileSearchResults()
-{
- HbDialog *dialog = new HbDialog();
- dialog->setDismissPolicy(HbPopup::TapOutside);
- dialog->setTimeout(HbPopup::NoTimeout);
-
- // Create a list and some simple content for it
- HbListWidget *resultsList = new HbListWidget();
- resultsList->addItem(QString("%1 entries found").arg(mResults.mNumberOfFoundFiles));
- for (int i = 0; i < mResults.mFoundFilesList->size(); i++) {
- resultsList->addItem(QString("%1").arg(mResults.mFoundFilesList->at(i)));
- }
- dialog->setContentWidget(resultsList);
- dialog->open();
-}
-
/**
* Reads form items and saves values of them into member variable mAttributes
*/
@@ -233,3 +165,40 @@
mAttributes.mMaxDate = mMaxDate->contentWidgetData("text").toDate();
mAttributes.mRecurse = mRecurse->contentWidgetData("selected").toBool();
}
+
+void SearchView::open(const QString &path)
+{
+ mPath = path;
+ // load file search attribute values from FB engine:
+ loadAttributes();
+}
+
+void SearchView::startFileSearch()
+{
+ // save form data values and set them as search attributes into FB engine.
+ readFormItems();
+ mEngineWrapper.setFileSearchAttributes(mAttributes);
+
+ bool err = mEngineWrapper.searchFiles();
+
+ // show results of file search:
+ mResults = mEngineWrapper.getSearchResults();
+ fileSearchResults();
+}
+
+void SearchView::fileSearchResults()
+{
+ QString noteMsg("%1 entries found");
+ Notifications::showInformationNote(noteMsg.arg(mEngineWrapper.itemCount()), QString(""));
+}
+
+void SearchView::accept()
+{
+ startFileSearch();
+ emit finished(true);
+}
+
+void SearchView::reject()
+{
+ emit finished(false);
+}