filebrowser/engine/FBFileUtils.cpp
branchGCC_SURGE
changeset 37 c20154ccf3c0
parent 35 98924d2efce9
child 48 da3ec8478e66
equal deleted inserted replaced
20:ba8a586c45f1 37:c20154ccf3c0
    22 #include "FB.hrh"
    22 #include "FB.hrh"
    23 #include <filebrowser.rsg>
    23 #include <filebrowser.rsg>
    24 
    24 
    25 #include <textresolver.h> 
    25 #include <textresolver.h> 
    26 #include <eikprogi.h>
    26 #include <eikprogi.h>
    27 #include <f32file.h>
    27 #include <e32svr.h>
    28 #include <eikfutil.h>
    28 #include <eikfutil.h>
    29 #include <apparc.h>
    29 #include <apparc.h>
       
    30 #include <apaid.h>
       
    31 #include <apaidpartner.h>
    30 #include <eikenv.h>
    32 #include <eikenv.h>
    31 #include <bautils.h>
    33 #include <bautils.h>
    32 #include <gulicon.h>
    34 #include <gulicon.h>
    33 #include <aknconsts.h>
       
    34 #include <babackup.h> 
    35 #include <babackup.h> 
    35 #include <aknmemorycardui.mbg>
    36 //#include <aknmemorycardui.mbg>
    36 #include <sendui.h>
    37 #include <sendui.h>
    37 #include <CMessageData.h>
    38 #include <CMessageData.h>
    38 #include <ezgzip.h>
    39 #include <ezgzip.h>
    39 #include <e32hal.h>
    40 #include <e32hal.h>
    40 #include <pathinfo.h>
    41 #include <pathinfo.h>
   116     iAppIconList = new(ELeave) CAppIconList(16);
   117     iAppIconList = new(ELeave) CAppIconList(16);
   117     iClipBoardList = new(ELeave) CFileEntryList(64);
   118     iClipBoardList = new(ELeave) CFileEntryList(64);
   118     iCurrentSelectionList = new(ELeave) CFileEntryList(64);
   119     iCurrentSelectionList = new(ELeave) CFileEntryList(64);
   119 
   120 
   120     iDocHandler = CDocumentHandler::NewL();
   121     iDocHandler = CDocumentHandler::NewL();
   121     iDocHandler->SetExitObserver(this);
   122 //    iDocHandler->SetExitObserver(this);
   122     
   123     
   123     // set defaults to the search settings
   124     // set defaults to the search settings
   124     iSearchAttributes.iSearchDir = KNullDesC;
   125     iSearchAttributes.iSearchDir = KNullDesC;
   125     iSearchAttributes.iWildCards = _L("*.jpg");
   126     iSearchAttributes.iWildCards = _L("*.jpg");
   126     iSearchAttributes.iTextInFile = KNullDesC;
   127     iSearchAttributes.iTextInFile = KNullDesC;
   200     iTimer.Cancel();
   201     iTimer.Cancel();
   201 	}
   202 	}
   202 
   203 
   203 // --------------------------------------------------------------------------------------------
   204 // --------------------------------------------------------------------------------------------
   204 
   205 
   205 void CFileBrowserFileUtils::StartExecutingCommandsL(const TDesC& /*aLabel*/)
   206 void CFileBrowserFileUtils::StartExecutingCommandsL(const TDesC& aLabel)
   206     {
   207     {
   207     if (iCommandArray->Count() >= 2)
   208     if (iCommandArray->Count() >= 2)
   208         {
   209         {
   209         // init progress bar
   210         // init progress bar
   210 //        iProgressDialog = new(ELeave) CAknProgressDialog((reinterpret_cast<CEikDialog**>(&iProgressDialog)), ETrue);
   211 //        iProgressDialog = new(ELeave) CAknProgressDialog((reinterpret_cast<CEikDialog**>(&iProgressDialog)), ETrue);
   213 //        iProgressDialog->SetCurrentLabelL( EAknCtNote, aLabel );
   214 //        iProgressDialog->SetCurrentLabelL( EAknCtNote, aLabel );
   214 //        iProgressInfo = iProgressDialog->GetProgressInfoL();
   215 //        iProgressInfo = iProgressDialog->GetProgressInfoL();
   215 //        iProgressInfo->SetFinalValue( CommandArrayCount() );
   216 //        iProgressInfo->SetFinalValue( CommandArrayCount() );
   216 //        iProgressDialog->RunLD();
   217 //        iProgressDialog->RunLD();
   217 //        iProgressDialog->MakeVisible( ETrue );        
   218 //        iProgressDialog->MakeVisible( ETrue );        
       
   219         iEngine->FileBrowserUI()->ShowProgressDialog(aLabel, 0, CommandArrayCount());
       
   220         isProgressDialog = ETrue;
   218         }
   221         }
   219     else if (iCommandArray->Count() >= 1)
   222     else if (iCommandArray->Count() >= 1)
   220         {
   223         {
   221         // init wait dialog
   224         // init wait dialog
   222 //        iWaitDialog = new(ELeave) CAknWaitDialog((reinterpret_cast<CEikDialog**>(&iWaitDialog)), ETrue);
   225 //        iWaitDialog = new(ELeave) CAknWaitDialog((reinterpret_cast<CEikDialog**>(&iWaitDialog)), ETrue);
   223 //        iWaitDialog->SetCallback(this);
   226 //        iWaitDialog->SetCallback(this);
   224 //        iWaitDialog->PrepareLC(R_GENERAL_WAIT_NOTE);
   227 //        iWaitDialog->PrepareLC(R_GENERAL_WAIT_NOTE);
   225 //        iWaitDialog->SetTextL( aLabel );
   228 //        iWaitDialog->SetTextL( aLabel );
   226 //        iWaitDialog->RunLD();
   229 //        iWaitDialog->RunLD();
       
   230         iEngine->FileBrowserUI()->ShowWaitDialog(aLabel);
       
   231         isWaitDialog = ETrue;
   227         }
   232         }
   228     else
   233     else
   229         {
   234         {
   230         // no commands, just do nothing
   235         // no commands, just do nothing
   231         return;
   236         return;
   247     {
   252     {
   248     // make sure the engine isn't active, should never happen
   253     // make sure the engine isn't active, should never happen
   249     __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("FileUtils:IsActive"), 333));
   254     __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("FileUtils:IsActive"), 333));
   250 
   255 
   251     // execute a command after a very short delay (25ms)
   256     // execute a command after a very short delay (25ms)
       
   257     if (isWaitDialog)
       
   258         {
       
   259         iEngine->FileBrowserUI()->ProcessEvents();
       
   260         }
       
   261     if (isProgressDialog)
       
   262         {
       
   263         TInt newValue = iCurrentEntry;
       
   264         iEngine->FileBrowserUI()->SetProgressValue(newValue);
       
   265         }
   252     iTimer.After(iStatus, 25);
   266     iTimer.After(iStatus, 25);
   253     SetActive();
   267     SetActive();
   254     }
   268     }
   255 
   269 
   256 // --------------------------------------------------------------------------------------------
   270 // --------------------------------------------------------------------------------------------
   361         
   375         
   362         // deactive secure backup if it was activated by a file command
   376         // deactive secure backup if it was activated by a file command
   363         iFileOps->DeActivateSecureBackUpViaFileOp();
   377         iFileOps->DeActivateSecureBackUpViaFileOp();
   364 
   378 
   365         // dismiss any wait/progress dialogs        
   379         // dismiss any wait/progress dialogs        
       
   380         if (isWaitDialog)
       
   381             {
       
   382             iEngine->FileBrowserUI()->CancelWaitDialog();
       
   383             isWaitDialog = EFalse;
       
   384             }
       
   385         if (isProgressDialog)
       
   386             {
       
   387             iEngine->FileBrowserUI()->CancelProgressDialog();
       
   388             isProgressDialog = EFalse;
       
   389             }
   366 //        if (iWaitDialog)
   390 //        if (iWaitDialog)
   367 //            {
   391 //            {
   368 //            TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); 
   392 //            TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); 
   369 //            iWaitDialog = NULL;
   393 //            iWaitDialog = NULL;
   370 //            }
   394 //            }
   418             CleanupStack::PopAndDestroy();  //textResolver
   442             CleanupStack::PopAndDestroy();  //textResolver
   419             }
   443             }
   420 
   444 
   421         RefreshViewL();
   445         RefreshViewL();
   422 
   446 
   423 		}
   447             }
   424 	else
   448 	else
   425 		{
   449             {
   426 		// maintain requests
   450             // maintain requests
   427 		iCurrentEntry++;
   451             iCurrentEntry++;
   428 
   452 
   429         //LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry);
   453             //LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry);
   430 
   454 
   431         ExecuteCommand();
   455             ExecuteCommand();
   432 		}
   456             }
   433     }    
   457     }    
   434 // --------------------------------------------------------------------------------------------
   458 // --------------------------------------------------------------------------------------------
   435 
   459 
   436 // This callback function is called when cancel button of the progress bar was pressed
   460 // This callback function is called when cancel button of the progress bar was pressed
   437 void CFileBrowserFileUtils::DialogDismissedL(TInt aButtonId)
   461 void CFileBrowserFileUtils::DialogDismissedL(/*TInt aButtonId*/)
   438     {
   462     {
   439 //    iProgressDialog = NULL;
   463 //    iProgressDialog = NULL;
   440 //    iProgressInfo = NULL;
   464 //    iProgressInfo = NULL;
   441 //    iWaitDialog = NULL;
   465 //    iWaitDialog = NULL;
   442     
   466     
   443     // check if cancel button was pressed
   467     // check if cancel button was pressed
   444     if (aButtonId == EAknSoftkeyCancel)
   468 //    if (aButtonId == EAknSoftkeyCancel)
   445         {
   469 //        {
   446         // cancel the active object, command executer 
   470         // cancel the active object, command executer 
   447         Cancel();
   471         Cancel();
   448         
   472         
   449         iFileOps->CancelOp();
   473         iFileOps->CancelOp();
   450         
   474         
   451         ResetCommandArray();
   475         ResetCommandArray();
   452 
   476 
       
   477         isProgressDialog = EFalse;
       
   478 
   453         iEngine->FileBrowserUI()->ShowInformationNote(_L("Cancelled"), _L(""));
   479         iEngine->FileBrowserUI()->ShowInformationNote(_L("Cancelled"), _L(""));
   454         }
   480 //        }
   455     }
   481     }
   456     
   482     
   457 // --------------------------------------------------------------------------------------------
   483 // --------------------------------------------------------------------------------------------
   458 
   484 
   459 void CFileBrowserFileUtils::AppendToCommandArrayL(TInt aCommand, CCommandParamsBase* aParameters)
   485 void CFileBrowserFileUtils::AppendToCommandArrayL(TInt aCommand, CCommandParamsBase* aParameters)
   605     {
   631     {
   606 	// TODO
   632 	// TODO
   607 
   633 
   608 //    if (iEngine->FileListContainer())
   634 //    if (iEngine->FileListContainer())
   609 //        {
   635 //        {
   610         // update navi pane text        
       
   611 //        if (iListingMode == ENormalEntries)
       
   612 //            iEngine->FileListContainer()->SetNaviPaneTextL(iCurrentPath);
       
   613 //        else if (iListingMode == ESearchResults)
       
   614 //            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Search results"));
       
   615 //        else if (iListingMode == EOpenFiles)
       
   616 //            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Open files"));
       
   617 //        else if (iListingMode == EMsgAttachmentsInbox)
       
   618 //            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Inbox"));
       
   619 //        else if (iListingMode == EMsgAttachmentsDrafts)
       
   620 //            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Drafts"));
       
   621 //        else if (iListingMode == EMsgAttachmentsSentItems)
       
   622 //            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Sent Items"));
       
   623 //        else if (iListingMode == EMsgAttachmentsOutbox)
       
   624 //            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Outbox"));
       
   625 //
       
   626 //        // create a list box if it doesn't already exist
   636 //        // create a list box if it doesn't already exist
   627 //        if (!iEngine->FileListContainer()->ListBox())
   637 //        if (!iEngine->FileListContainer()->ListBox())
   628 //            iEngine->FileListContainer()->CreateListBoxL(iEngine->Settings().iFileViewMode);
   638 //            iEngine->FileListContainer()->CreateListBoxL(iEngine->Settings().iFileViewMode);
   629 //
   639 //
   630 //        // clear selections if any
   640 //        // clear selections if any
   653 
   663 
   654         }
   664         }
   655     
   665     
   656 // --------------------------------------------------------------------------------------------
   666 // --------------------------------------------------------------------------------------------
   657 
   667 
   658 /*CAknIconArray* CFileBrowserFileUtils::GenerateIconArrayL(TBool aGenerateNewBasicIconArray)
   668 //CAknIconArray* CFileBrowserFileUtils::GenerateIconArrayL(TBool aGenerateNewBasicIconArray)
   659     {
   669 //    {
   660 	// TODO
   670 //	// TODO
   661 	
   671 //
   662     CAknIconArray* iconArray = NULL;
   672 //    CAknIconArray* iconArray = NULL;
   663 
   673 //
   664     if (aGenerateNewBasicIconArray)
   674 //    if (aGenerateNewBasicIconArray)
   665         {
   675 //        {
   666         iconArray = new(ELeave) CAknIconArray(16);    
   676 //        iconArray = new(ELeave) CAknIconArray(16);
   667         }
   677 //        }
   668     else
   678 //    else
   669         {
   679 //        {
   670         if (iEngine->FileListContainer())
   680 //        if (iEngine->FileListContainer())
   671             iconArray = iEngine->FileListContainer()->ListBoxIconArrayL();
   681 //            iconArray = iEngine->FileListContainer()->ListBoxIconArrayL();
   672         
   682 //
   673         if (!iconArray)    
   683 //        if (!iconArray)
   674             iconArray = new(ELeave) CAknIconArray(16);
   684 //            iconArray = new(ELeave) CAknIconArray(16);
   675         }
   685 //        }
   676 
   686 //
   677         
   687 //
   678     CleanupStack::PushL(iconArray);
   688 //    CleanupStack::PushL(iconArray);
   679     
   689 //
   680     // generate basic items if not already existing
   690 //    // generate basic items if not already existing
   681     if (iconArray->Count() < EFixedIconListLength)
   691 //    if (iconArray->Count() < EFixedIconListLength)
   682         {
   692 //        {
   683         // reset arrays
   693 //        // reset arrays
   684         iconArray->Reset();
   694 //        iconArray->Reset();
   685         iAppIconList->Reset();
   695 //        iAppIconList->Reset();
   686         
   696 //
   687         // get default control color
   697 //        // get default control color
   688         TRgb defaultColor;
   698 //        TRgb defaultColor;
   689         defaultColor = iEngine->EikonEnv()->Color(EColorControlText);
   699 //        defaultColor = iEngine->EikonEnv()->Color(EColorControlText);
   690         
   700 //
   691         // create a color icon of the marking indicator
   701 //        // create a color icon of the marking indicator
   692         CFbsBitmap* markBitmap = NULL;
   702 //        CFbsBitmap* markBitmap = NULL;
   693         CFbsBitmap* markBitmapMask = NULL;
   703 //        CFbsBitmap* markBitmapMask = NULL;
   694 
   704 //
   695         AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
   705 //        AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
   696                 KAknsIIDQgnIndiMarkedAdd,
   706 //                KAknsIIDQgnIndiMarkedAdd,
   697                 KAknsIIDQsnIconColors,
   707 //                KAknsIIDQsnIconColors,
   698                 EAknsCIQsnIconColorsCG13,
   708 //                EAknsCIQsnIconColorsCG13,
   699                 markBitmap,
   709 //                markBitmap,
   700                 markBitmapMask,
   710 //                markBitmapMask,
   701                 AknIconUtils::AvkonIconFileName(),
   711 //                AknIconUtils::AvkonIconFileName(),
   702                 EMbmAvkonQgn_indi_marked_add,
   712 //                EMbmAvkonQgn_indi_marked_add,
   703                 EMbmAvkonQgn_indi_marked_add_mask,
   713 //                EMbmAvkonQgn_indi_marked_add_mask,
   704                 defaultColor
   714 //                defaultColor
   705                 );
   715 //                );
   706          
   716 //
   707         // 0 marking indicator
   717 //        // 0 marking indicator
   708         CGulIcon* markIcon = CGulIcon::NewL(markBitmap, markBitmapMask);
   718 //        CGulIcon* markIcon = CGulIcon::NewL(markBitmap, markBitmapMask);
   709         iconArray->AppendL(markIcon);                       
   719 //        iconArray->AppendL(markIcon);
   710 
   720 //
   711         // 1 empty
   721 //        // 1 empty
   712         AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   722 //        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   713                                   EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask, KAknsIIDQgnPropEmpty);
   723 //                                  EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask, KAknsIIDQgnPropEmpty);
   714         // 2 phone memory
   724 //        // 2 phone memory
   715         AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   725 //        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   716                                   EMbmAvkonQgn_prop_phone_memc, EMbmAvkonQgn_prop_phone_memc_mask, KAknsIIDQgnPropPhoneMemc);
   726 //                                  EMbmAvkonQgn_prop_phone_memc, EMbmAvkonQgn_prop_phone_memc_mask, KAknsIIDQgnPropPhoneMemc);
   717         // 3 memory card
   727 //        // 3 memory card
   718         AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
   728 //        AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
   719                                   EMbmAknmemorycarduiQgn_prop_mmc_memc, EMbmAknmemorycarduiQgn_prop_mmc_memc_mask, KAknsIIDQgnPropMmcMemc);
   729 //                                  EMbmAknmemorycarduiQgn_prop_mmc_memc, EMbmAknmemorycarduiQgn_prop_mmc_memc_mask, KAknsIIDQgnPropMmcMemc);
   720         // 4 memory card disabled
   730 //        // 4 memory card disabled
   721         AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
   731 //        AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
   722                                   EMbmAknmemorycarduiQgn_prop_mmc_non, EMbmAknmemorycarduiQgn_prop_mmc_non_mask, KAknsIIDQgnPropMmcNon);
   732 //                                  EMbmAknmemorycarduiQgn_prop_mmc_non, EMbmAknmemorycarduiQgn_prop_mmc_non_mask, KAknsIIDQgnPropMmcNon);
   723         // 5 folder
   733 //        // 5 folder
   724         AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   734 //        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   725                                   EMbmAvkonQgn_prop_folder_small, EMbmAvkonQgn_prop_folder_small_mask, KAknsIIDQgnPropFolderSmall);
   735 //                                  EMbmAvkonQgn_prop_folder_small, EMbmAvkonQgn_prop_folder_small_mask, KAknsIIDQgnPropFolderSmall);
   726         // 6 folder with subfolders
   736 //        // 6 folder with subfolders
   727         AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   737 //        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   728                                   EMbmAvkonQgn_prop_folder_sub_small, EMbmAvkonQgn_prop_folder_sub_small_mask, KAknsIIDQgnPropFolderSubSmall);
   738 //                                  EMbmAvkonQgn_prop_folder_sub_small, EMbmAvkonQgn_prop_folder_sub_small_mask, KAknsIIDQgnPropFolderSubSmall);
   729         // 7 current folder
   739 //        // 7 current folder
   730         AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   740 //        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
   731                                   EMbmAvkonQgn_prop_folder_current, EMbmAvkonQgn_prop_folder_current_mask, KAknsIIDQgnPropFolderCurrent);
   741 //                                  EMbmAvkonQgn_prop_folder_current, EMbmAvkonQgn_prop_folder_current_mask, KAknsIIDQgnPropFolderCurrent);
   732         }
   742 //        }
   733 
   743 //
   734     // append custom icons if not in drive list view and setting is enabled
   744 //    // append custom icons if not in drive list view and setting is enabled
   735     if (!aGenerateNewBasicIconArray && !IsDriveListViewActive() && iEngine->Settings().iShowAssociatedIcons)
   745 //    if (!aGenerateNewBasicIconArray && !IsDriveListViewActive() && iEngine->Settings().iShowAssociatedIcons)
   736         {
   746 //        {
   737         // init id counter
   747 //        // init id counter
   738         TInt idCounter(EFixedIconListLength + iAppIconList->Count());
   748 //        TInt idCounter(EFixedIconListLength + iAppIconList->Count());
   739         
   749 //
   740         // loop all items in the file list
   750 //        // loop all items in the file list
   741         for (TInt i=0; i<iFileEntryList->Count(); i++)
   751 //        for (TInt i=0; i<iFileEntryList->Count(); i++)
   742             {
   752 //            {
   743             TFileEntry& fileEntry = iFileEntryList->At(i);
   753 //            TFileEntry& fileEntry = iFileEntryList->At(i);
   744 
   754 //
   745             // just check for normal files            
   755 //            // just check for normal files
   746             if (!fileEntry.iEntry.IsDir())     
   756 //            if (!fileEntry.iEntry.IsDir())
   747                 {
   757 //                {
   748                 TUid appUid = GetAppUid(fileEntry);
   758 //                TUid appUid = GetAppUid(fileEntry);
   749                 TInt iconId = AppIconIdForUid(appUid);
   759 //                TInt iconId = AppIconIdForUid(appUid);
   750                 
   760 //
   751                 if (appUid != KNullUid && iconId == KErrNotFound)
   761 //                if (appUid != KNullUid && iconId == KErrNotFound)
   752                     {
   762 //                    {
   753                     // icon not found from the icon array, generate it
   763 //                    // icon not found from the icon array, generate it
   754                     CFbsBitmap* bitmap = NULL;
   764 //                    CFbsBitmap* bitmap = NULL;
   755                     CFbsBitmap* mask = NULL;
   765 //                    CFbsBitmap* mask = NULL;
   756                     CGulIcon* appIcon = NULL;
   766 //                    CGulIcon* appIcon = NULL;
   757         
   767 //
   758                     TRAPD(err, 
   768 //                    TRAPD(err,
   759                         AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), appUid, EAknsAppIconTypeList, bitmap, mask);
   769 //                        AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), appUid, EAknsAppIconTypeList, bitmap, mask);
   760                         appIcon = CGulIcon::NewL(bitmap, mask);
   770 //                        appIcon = CGulIcon::NewL(bitmap, mask);
   761                         CleanupStack::Pop(2); //bitmap, mask
   771 //                        CleanupStack::Pop(2); //bitmap, mask
   762                         );
   772 //                        );
   763                          
   773 //
   764                     if (err == KErrNone)
   774 //                    if (err == KErrNone)
   765                         {
   775 //                        {
   766                         TAppIcon appIconEntry;
   776 //                        TAppIcon appIconEntry;
   767                         appIconEntry.iId = idCounter;
   777 //                        appIconEntry.iId = idCounter;
   768                         appIconEntry.iUid = appUid;
   778 //                        appIconEntry.iUid = appUid;
   769                         
   779 //
   770                         appIcon->SetBitmapsOwnedExternally(EFalse);
   780 //                        appIcon->SetBitmapsOwnedExternally(EFalse);
   771                         iconArray->AppendL(appIcon);
   781 //                        iconArray->AppendL(appIcon);
   772                         iAppIconList->AppendL(appIconEntry);
   782 //                        iAppIconList->AppendL(appIconEntry);
   773 
   783 //
   774                         fileEntry.iIconId = idCounter;
   784 //                        fileEntry.iIconId = idCounter;
   775                                                 
   785 //
   776                         idCounter++;      
   786 //                        idCounter++;
   777                         }
   787 //                        }
   778                     else
   788 //                    else
   779                         {
   789 //                        {
   780                         delete bitmap;
   790 //                        delete bitmap;
   781                         delete mask;
   791 //                        delete mask;
   782 		
   792 //
   783                         TAppIcon appIconEntry;
   793 //                        TAppIcon appIconEntry;
   784                         appIconEntry.iId = EFixedIconEmpty;
   794 //                        appIconEntry.iId = EFixedIconEmpty;
   785                         appIconEntry.iUid = appUid;
   795 //                        appIconEntry.iUid = appUid;
   786                         
   796 //
   787                         iAppIconList->AppendL(appIconEntry);
   797 //                        iAppIconList->AppendL(appIconEntry);
   788                         }
   798 //                        }
   789                     }
   799 //                    }
   790 
   800 //
   791                 else if (appUid != KNullUid && iconId >= 0)
   801 //                else if (appUid != KNullUid && iconId >= 0)
   792                     {
   802 //                    {
   793                     // we already have already generated an icon for this uid, use it
   803 //                    // we already have already generated an icon for this uid, use it
   794                     fileEntry.iIconId = iconId;
   804 //                    fileEntry.iIconId = iconId;
   795                     }
   805 //                    }
   796                 }
   806 //                }
   797             }
   807 //            }
   798         }
   808 //        }
   799 
   809 //
   800     CleanupStack::Pop(); //iconArray
   810 //    CleanupStack::Pop(); //iconArray
   801 	return iconArray;
   811 //	return iconArray;
   802     
   812 //
   803 	}
   813 //	}
   804 */
   814 //
   805 // --------------------------------------------------------------------------------------------
   815 // --------------------------------------------------------------------------------------------
   806 
   816 
   807 //void CFileBrowserFileUtils::AppendGulIconToIconArrayL(CAknIconArray* aIconArray, const TDesC& aIconFile, TInt aIconId, TInt aMaskId, const TAknsItemID aAknsItemId)
   817 //void CFileBrowserFileUtils::AppendGulIconToIconArrayL(CAknIconArray* aIconArray, const TDesC& aIconFile, TInt aIconId, TInt aMaskId, const TAknsItemID aAknsItemId)
   808 //    {
   818 //    {
   809 //    CGulIcon* icon = AknsUtils::CreateGulIconL(
   819 //    CGulIcon* icon = AknsUtils::CreateGulIconL(
  1367 //        }
  1377 //        }
  1368     
  1378     
  1369     // update view
  1379     // update view
  1370     RefreshViewL();
  1380     RefreshViewL();
  1371     
  1381     
  1372     if ( iEngine->Settings().iRememberFolderSelection &&
  1382     if (iEngine->Settings().iRememberFolderSelection
  1373          iEngine->FileListContainer() && iPrevFolderIndex > KErrNotFound )
  1383         //&& iEngine->FileListContainer()
       
  1384         && iPrevFolderIndex > KErrNotFound )
  1374         {
  1385         {
  1375         
  1386         
  1376 //        TInt visibleItems = iEngine->FileListContainer()->ListBox()->Rect().Height() /
  1387 //        TInt visibleItems = iEngine->FileListContainer()->ListBox()->Rect().Height() /
  1377 //                            iEngine->FileListContainer()->ListBox()->ItemHeight()
  1388 //                            iEngine->FileListContainer()->ListBox()->ItemHeight()
  1378 //                            - 1; // for the title row
  1389 //                            - 1; // for the title row
  1958 //    iEngine->FileListContainer()->SetNaviPaneTextL(iCurrentPath);
  1969 //    iEngine->FileListContainer()->SetNaviPaneTextL(iCurrentPath);
  1959 //
  1970 //
  1960 //    if (dlgResult)
  1971 //    if (dlgResult)
  1961 //        {
  1972 //        {
  1962 //        iEngine->EikonEnv()->BusyMsgL(_L("** Searching **"), TGulAlignment(EHCenterVTop));
  1973 //        iEngine->EikonEnv()->BusyMsgL(_L("** Searching **"), TGulAlignment(EHCenterVTop));
  1963 //
  1974 
  1964 //        iFileEntryList->Reset();
  1975 
  1965 //
  1976         iEngine->FileBrowserUI()->ShowWaitDialog(_L("Searching"));
  1966 //        // if search dir is empty, find from all drives
  1977         iFileEntryList->Reset();
  1967 //        if (iSearchAttributes.iSearchDir == KNullDesC)
  1978 
  1968 //            {
  1979         // if search dir is empty, find from all drives
  1969 //            for (TInt i=0; i<iDriveEntryList->Count(); i++)
  1980         if (iSearchAttributes.iSearchDir == KNullDesC)
  1970 //                {
  1981             {
  1971 //                TDriveEntry driveEntry = iDriveEntryList->At(i);
  1982             for (TInt i=0; i<iDriveEntryList->Count(); i++)
  1972 //
  1983                 {
  1973 //                TBuf<10> driveRoot;
  1984                 TDriveEntry driveEntry = iDriveEntryList->At(i);
  1974 //                driveRoot.Append(driveEntry.iLetter);
  1985 
  1975 //                driveRoot.Append(_L(":\\"));
  1986                 TBuf<10> driveRoot;
  1976 //
  1987                 driveRoot.Append(driveEntry.iLetter);
  1977 //                DoSearchFiles(iSearchAttributes.iWildCards, driveRoot);
  1988                 driveRoot.Append(_L(":\\"));
  1978 //
  1989 
  1979 //                if (iSearchAttributes.iRecurse)
  1990                 DoSearchFiles(iSearchAttributes.iWildCards, driveRoot);
  1980 //                    DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, driveRoot);
  1991 
  1981 //
  1992                 if (iSearchAttributes.iRecurse)
  1982 //                }
  1993                     DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, driveRoot);
  1983 //
  1994                 }
  1984 //            }
  1995 
  1985 //
  1996             }
  1986 //        // otherwise just search from the selected directory
  1997 
  1987 //        else
  1998         // otherwise just search from the selected directory
  1988 //            {
  1999         else
  1989 //            DoSearchFiles(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
  2000             {
  1990 //
  2001             DoSearchFiles(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
  1991 //            if (iSearchAttributes.iRecurse)
  2002 
  1992 //                DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
  2003             if (iSearchAttributes.iRecurse)
  1993 //            }
  2004                 DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
  1994 //
  2005             }
       
  2006 
  1995 //        iEngine->EikonEnv()->BusyMsgCancel();
  2007 //        iEngine->EikonEnv()->BusyMsgCancel();
  1996 //
  2008         iEngine->FileBrowserUI()->CancelWaitDialog();
       
  2009 
  1997 //        TInt operations = iFileEntryList->Count();
  2010 //        TInt operations = iFileEntryList->Count();
  1998 //
  2011 
  1999 //        iListingMode = ESearchResults;
  2012         iListingMode = ESearchResults;
  2000 //        iEngine->FileListContainer()->ListBox()->SetCurrentItemIndex(0);
  2013         // TODO iEngine->FileListContainer()->ListBox()->SetCurrentItemIndex(0);
  2001 //        RefreshViewL();
  2014         RefreshViewL();
  2002 //
  2015 
  2003 //        _LIT(KMessage, "%d entries found");
  2016 //        _LIT(KMessage, "%d entries found");
  2004 //        TFileName noteMsg;
  2017 //        TFileName noteMsg;
  2005 //        noteMsg.Format(KMessage, operations);
  2018 //        noteMsg.Format(KMessage, operations);
  2006 //
  2019 //
  2007 //        iEngine->FileBrowserUI()->ShowInformationNote(noteMsg, _L(""));
  2020 //        iEngine->FileBrowserUI()->ShowInformationNote(noteMsg, _L(""));
  2014     {
  2027     {
  2015     TFindFile fileFinder(iFs);
  2028     TFindFile fileFinder(iFs);
  2016     CDir* dir;
  2029     CDir* dir;
  2017     TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
  2030     TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
  2018 
  2031 
  2019     while (err == KErrNone)
  2032     while (err == KErrNone && iAllowProcessing)
  2020         {
  2033         {
       
  2034         iEngine->FileBrowserUI()->ProcessEvents();
  2021         for (TInt i=0; i<dir->Count(); i++)
  2035         for (TInt i=0; i<dir->Count(); i++)
  2022             {
  2036             {
  2023             TEntry entry = (*dir)[i];
  2037             TEntry entry = (*dir)[i];
  2024             
  2038             
  2025             TTime entryModified = entry.iModified;
  2039             TTime entryModified = entry.iModified;
  2737         //}   
  2751         //}   
  2738     }
  2752     }
  2739 	
  2753 	
  2740 // --------------------------------------------------------------------------------------------
  2754 // --------------------------------------------------------------------------------------------
  2741 
  2755 
  2742 void CFileBrowserFileUtils::HandleServerAppExit(TInt aReason)
  2756 //void CFileBrowserFileUtils::HandleServerAppExit(TInt aReason)
  2743 	{
  2757 //	{
  2744 //	if (iOpenFileService)
  2758 //	if (iOpenFileService)
  2745 //		{
  2759 //		{
  2746 //		delete iOpenFileService;
  2760 //		delete iOpenFileService;
  2747 //		iOpenFileService = NULL;
  2761 //		iOpenFileService = NULL;
  2748 //		}
  2762 //		}
  2749 	MAknServerAppExitObserver::HandleServerAppExit(aReason);
  2763 //	MAknServerAppExitObserver::HandleServerAppExit(aReason);
  2750 	}
  2764 //	}
  2751 
  2765 
  2752 // --------------------------------------------------------------------------------------------
  2766 // --------------------------------------------------------------------------------------------
  2753 
  2767 
  2754 void CFileBrowserFileUtils::OpenWithDocHandlerL(TFileName aFileName, TBool aEmbed)
  2768 void CFileBrowserFileUtils::OpenWithDocHandlerL(TFileName aFileName, TBool aEmbed)
  2755     {
  2769     {
  3121             }        
  3135             }        
  3122 
  3136 
  3123         // update view
  3137         // update view
  3124         RefreshViewL(); 
  3138         RefreshViewL(); 
  3125     
  3139     
  3126         if (err == KErrNone)    
  3140         if (err == KErrNone)
  3127             {
  3141             {
  3128             iEngine->FileBrowserUI()->ShowConfirmationNote(_L("State changed"));
  3142             iEngine->FileBrowserUI()->ShowConfirmationNote(_L("State changed"));
  3129             }
  3143             }
  3130         else    
  3144         else    
  3131             {
  3145             {
  3264     if (file.Replace(iFs, allFilesPath, EFileWrite) == KErrNone)
  3278     if (file.Replace(iFs, allFilesPath, EFileWrite) == KErrNone)
  3265         {
  3279         {
  3266         CleanupClosePushL(file);
  3280         CleanupClosePushL(file);
  3267         iFindFileEntryList->Reset();
  3281         iFindFileEntryList->Reset();
  3268         
  3282         
  3269         iEngine->EikonEnv()->BusyMsgL(_L("** Generating **"), TGulAlignment(EHCenterVTop));
  3283         iEngine->FileBrowserUI()->ShowWaitDialog(_L("Generating"));
  3270         
  3284         
  3271         for (TInt i=0; i<iDriveEntryList->Count(); i++)
  3285         for (TInt i=0; i<iDriveEntryList->Count(); i++)
  3272             {
  3286             {
  3273             TDriveEntry driveEntry = iDriveEntryList->At(i);
  3287             TDriveEntry driveEntry = iDriveEntryList->At(i);
  3274 
  3288 
  3289             {
  3303             {
  3290             TFileEntry fileEntry = iFindFileEntryList->At(i);
  3304             TFileEntry fileEntry = iFindFileEntryList->At(i);
  3291             
  3305             
  3292             writeBuf.Copy(fileEntry.iPath);
  3306             writeBuf.Copy(fileEntry.iPath);
  3293             writeBuf.Append(fileEntry.iEntry.iName);
  3307             writeBuf.Append(fileEntry.iEntry.iName);
       
  3308             writeBuf.Append(_L(","));
       
  3309             writeBuf.AppendNum(fileEntry.iEntry.iSize);
       
  3310             writeBuf.Append(_L(" B"));
       
  3311 
       
  3312 //            // date
       
  3313 //            TTime entryModified = fileEntry.iEntry.iModified;
       
  3314 //            // convert from universal time
       
  3315 //            if ( iTz.ConvertToLocalTime( entryModified ) == KErrNone )
       
  3316 //                {
       
  3317 //                entryModified = fileEntry.iEntry.iModified; // use universal time
       
  3318 //                }
       
  3319 //
       
  3320 //            _LIT(KDateFormat,               "%D%M%Y%/0%1%/1%2%/2%3%/3");
       
  3321 //            TBuf<32> dateBuf;
       
  3322 //            entryModified.FormatL(dateBuf, KDateFormat);
       
  3323 //            writeBuf.Append(dateBuf);
       
  3324 //
       
  3325 //            writeBuf.Append(_L(" "));
       
  3326 //            // time
       
  3327 //            _LIT(KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B");
       
  3328 //            TBuf<32> timeBuf;
       
  3329 //            entryModified.FormatL(timeBuf, KTimeFormat);
       
  3330 //            writeBuf.Append(timeBuf);
       
  3331 //
  3294             writeBuf.Append(KFileNewLine);
  3332             writeBuf.Append(KFileNewLine);
  3295             
       
  3296             file.Write(writeBuf);
  3333             file.Write(writeBuf);
  3297             }
  3334             }
  3298         
  3335         
  3299         iEngine->EikonEnv()->BusyMsgCancel();
  3336         iEngine->FileBrowserUI()->CancelWaitDialog();
  3300         
  3337         
  3301         CleanupStack::PopAndDestroy(); //file
  3338         CleanupStack::PopAndDestroy(); //file
  3302         iFindFileEntryList->Reset();
  3339         iFindFileEntryList->Reset();
  3303         
  3340         
  3304         _LIT(KMessage, "File list written to %S");
  3341         _LIT(KMessage, "File list written to %S");
  3305         TFileName noteMsg;
  3342         TFileName noteMsg;
  3306         noteMsg.Format(KMessage, &allFilesPath);
  3343         noteMsg.Format(KMessage, &allFilesPath);
  3307 
  3344 
  3308         iEngine->FileBrowserUI()->ShowConfirmationNote(noteMsg, ETrue); // NoTimeout
  3345         iEngine->FileBrowserUI()->ShowConfirmationNote(noteMsg, EFalse); // NoTimeout
  3309         }
  3346         }
  3310     else
  3347     else
  3311         {
  3348         {
  3312         _LIT(KMessage, "Failed writing to %S");
  3349         _LIT(KMessage, "Failed writing to %S");
  3313         TFileName noteMsg;
  3350         TFileName noteMsg;
  3323     {
  3360     {
  3324     TFindFile fileFinder(iFs);
  3361     TFindFile fileFinder(iFs);
  3325     CDir* dir;
  3362     CDir* dir;
  3326     TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
  3363     TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
  3327 
  3364 
  3328     while (err == KErrNone)
  3365     while (err == KErrNone && iAllowProcessing)
  3329         {
  3366         {
       
  3367         iEngine->FileBrowserUI()->ProcessEvents();
  3330         for (TInt i=0; i<dir->Count(); i++)
  3368         for (TInt i=0; i<dir->Count(); i++)
  3331             {
  3369             {
  3332             TEntry entry = (*dir)[i];
  3370             TEntry entry = (*dir)[i];
  3333 
  3371 
  3334             // ignore any directory entries
  3372             // ignore any directory entries