×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    181

    Showing File copy progress in a progress dialog

    I am using the following functions to keep track of the file copy progress.

    TFileCopyProgressMonitor::TFileCopyProgressMonitor(CFileMan& aFileMan)
    :iFileMan(aFileMan)
    {
    }

    .................................................................................

    // Called when a copy operation started
    MFileManObserver::TControl TFileCopyProgressMonitor::NotifyFileManStarted()
    {
    //TFileName& aFile = _L("C:\\sdsd");

    // Get name of file we are copying.
    // you might want to do something with this, such as display in a UI,
    // or save in a data member of this object for later use.
    // iFileMan.GetCurrentSource(aFile);

    // Allow the operation to continue.
    return EContinue;
    }

    .................................................................................

    // Called while a copy operation is in progress
    MFileManObserver::TControl TFileCopyProgressMonitor::NotifyFileManOperation()
    {
    TInt bytesTransferred;

    // number of bytes copied so far for the file.
    bytesTransferred = iFileMan.BytesTransferredByCopyStep();

    // Allow the operation to continue.
    // You would choose to do something different; for example, you could
    // return ECancel to cancel the operation if you had a reason to do so,
    return EContinue;
    }
    .................................................................................
    // Called when a copy operation is complete
    MFileManObserver::TControl TFileCopyProgressMonitor::NotifyFileManEnded()
    {
    TInt lasterror;

    // Allow operations to continue if all is well.
    lasterror = iFileMan.GetLastError();
    if (lasterror == KErrNone)
    {
    return EContinue;
    }

    // Operation has not completed properly, so you might want to get
    // more information, and proceed accordingly.
    TFileManError filemanerror;

    filemanerror = iFileMan.GetMoreInfoAboutError();
    if (filemanerror==ESrcOpenFailed)
    {

    return EAbort;
    }

    if (filemanerror==ETrgOpenFailed)
    {

    return EAbort;
    }

    // you might want to check for other conditions etc.
    }



    And I am using a progress dialog to show the file copy progress. My question is how do I update the progress dialog as the file copy is underway. From whr do I call the Update function of the progress dialog.

    I have a function wherein I am copying a file

    TFileCopyProgressMonitor fileCopyProgressMonitor(*fileMan);
    fileMan->SetObserver(&fileCopyProgressMonitor);



    // Do copy (here synchronously)

    if(selitems[3] == true)
    {
    iClass->StartProgressNoteL(10);
    fileMan->Copy(text1,PathInfo::ImagesPath());
    }


    But how Do I access the NotifyFileManOperation() and other functions so that I can show d file copy progress.

  2. #2
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    181

    Re: Showing File copy progress in a progress dialog

    I need to copy a file from one folder to another. I am using CFileman to do that and the following class to keep track of the progress.
    class CEikProgressInfo;

    class TFileCopyProgressMonitor : public MFileManObserver
    {
    public :
    TFileCopyProgressMonitor(CFileMan& aFileMan);
    public : // implement the interface
    TControl NotifyFileManStarted();
    TControl NotifyFileManOperation();
    TControl NotifyFileManEnded();
    public :
    CFileMan& iFileMan;
    };


    But once the Copy function is called, the functions of the class do not get called automatically. I have just provided the defs for them as shown in the post below and as I understand am not required to call them explicitly.

    How do I do that ?

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Showing File copy progress in a progress dialog

    you might want to check CFileMan::BytesTransferredByCopyStep

  4. #4
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    181

    Re: Showing File copy progress in a progress dialog

    Quote Originally Posted by skumar_rao View Post
    you might want to check CFileMan::BytesTransferredByCopyStep

    CFileMan::BytesTransferredByCopyStep is called inside TFileCopyProgressMonitor::NotifyFileManOperation(). But how do I access TFileCopyProgressMonitor::NotifyFileManOperation(). Or is there a way to continually call BytesTransferred function.

    Another thing: in the fileman->Copy function, I have give nthe source path as a location in the C: drive( I am using an emulator) and the destination path as PathInfo::ImagesPath(). Is this correct or am I committing an error here because the NotifyFileManOperation is just never called.
    Last edited by nisheethpandey; 2009-12-14 at 08:22.

  5. #5
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Showing File copy progress in a progress dialog

    that is a function of MFileManObserver so you have to update your progress dialog from here. the function will be called by the system.

  6. #6
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    181

    Re: Showing File copy progress in a progress dialog

    Quote Originally Posted by skumar_rao View Post
    that is a function of MFileManObserver so you have to update your progress dialog from here. the function will be called by the system.
    Another thing: in the fileman->Copy function, I have give nthe source path as a location in the C: drive( I am using an emulator) and the destination path as PathInfo::ImagesPath(). Is this correct or am I committing an error here because the NotifyFileManOperation is just never called.

Similar Threads

  1. Showing Time Progress in a Dialog
    By enigma_007 in forum Symbian
    Replies: 10
    Last Post: 2009-08-31, 06:58
  2. Problem with GCCE build in Carbide.vs
    By raffaelbechara in forum Symbian
    Replies: 6
    Last Post: 2008-10-20, 16:06
  3. Tips on using NDS 1.1
    By mitts in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2006-01-18, 16:07
  4. Replies: 1
    Last Post: 2005-05-26, 14:22
  5. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×