filebrowser/ui/src/enginewrapper.cpp
changeset 27 271e901a9423
parent 25 31fc1277642e
child 28 4cc0d1a608c1
equal deleted inserted replaced
26:41ebde60981f 27:271e901a9423
    22 #include "filebrowserview.h"
    22 #include "filebrowserview.h"
    23 #include "searchview.h"
    23 #include "searchview.h"
    24 #include "filebrowsersettings.h"
    24 #include "filebrowsersettings.h"
    25 #include "settingsview.h"
    25 #include "settingsview.h"
    26 
    26 
       
    27 #include <HbProgressDialog>
       
    28 
    27 #include <QString>
    29 #include <QString>
    28 #include <QFileInfo>
    30 #include <QFileInfo>
    29 #include <QModelIndex>
    31 #include <QModelIndex>
    30 
    32 
    31 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    32 
    34 
    33 EngineWrapper::EngineWrapper()
    35 EngineWrapper::EngineWrapper()
    34     : mEngine(0),
    36     : mEngine(0),
    35     mFilesFound(),
    37     mFilesFound(),
    36     mSettings(0)
    38     mSettings(0),
       
    39     mWaitDialog(0)
    37 {
    40 {
    38 }
    41 }
    39 
    42 
    40 // ---------------------------------------------------------------------------
    43 // ---------------------------------------------------------------------------
    41 
    44 
    43 {
    46 {
    44     if(mEngine != NULL) {
    47     if(mEngine != NULL) {
    45         TRAP_IGNORE(mEngine->DeActivateEngineL());
    48         TRAP_IGNORE(mEngine->DeActivateEngineL());
    46         delete mEngine;
    49         delete mEngine;
    47     } 
    50     } 
       
    51     if (mWaitDialog)
       
    52         delete mWaitDialog;
    48 }
    53 }
    49 
    54 
    50 // ---------------------------------------------------------------------------
    55 // ---------------------------------------------------------------------------
    51 
    56 
    52 bool EngineWrapper::init()
    57 bool EngineWrapper::init()
   684 void EngineWrapper::toolsSetDebugMask(quint32 aDbgMask)
   689 void EngineWrapper::toolsSetDebugMask(quint32 aDbgMask)
   685 {
   690 {
   686     mEngine->FileUtils()->SetDebugMaskL(aDbgMask);
   691     mEngine->FileUtils()->SetDebugMaskL(aDbgMask);
   687 }
   692 }
   688 
   693 
       
   694 void EngineWrapper::toolsWriteAllFiles()
       
   695 {
       
   696     mEngine->FileUtils()->WriteAllFilesL();
       
   697 }
       
   698 
   689 void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType)
   699 void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType)
   690 {
   700 {
   691     mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType);
   701     mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType);
   692 }
   702 }
   693 
   703 
   697 
   707 
   698 // ---------------------------------------------------------------------------
   708 // ---------------------------------------------------------------------------
   699 
   709 
   700 void EngineWrapper::ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
   710 void EngineWrapper::ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
   701 {
   711 {
   702     QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   712     QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   703     Notifications::showErrorNote(qStringText, aNoTimeout);
   713     Notifications::showErrorNote(qText, aNoTimeout);
   704 }
   714 }
   705 
   715 
   706 // ---------------------------------------------------------------------------
   716 // ---------------------------------------------------------------------------
   707 
   717 
   708 void EngineWrapper::ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle)
   718 void EngineWrapper::ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle)
   714 
   724 
   715 // ---------------------------------------------------------------------------
   725 // ---------------------------------------------------------------------------
   716 
   726 
   717 void EngineWrapper::ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
   727 void EngineWrapper::ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
   718 {
   728 {
   719     QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   729     QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   720     Notifications::showConfirmationNote(qStringText, aNoTimeout);
   730     Notifications::showConfirmationNote(qText, aNoTimeout);
       
   731 }
       
   732 
       
   733 void EngineWrapper::ShowWaitDialog(const TDesC& aDescText)
       
   734 {
       
   735     const QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
       
   736     if (!mWaitDialog) {
       
   737         mWaitDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
       
   738         QObject::connect(mWaitDialog, SIGNAL(cancelled ()), this, SLOT(waitDialogCancelled()));
       
   739     }
       
   740 
       
   741     mWaitDialog->setText(qText);
       
   742     mEngine->FileUtils()->SetAllowProcessing(true);
       
   743     //mWaitDialog->setAttribute(Qt::WA_DeleteOnClose);
       
   744     mWaitDialog->show();
       
   745 }
       
   746 
       
   747 void EngineWrapper::CancelWaitDialog()
       
   748 {
       
   749     if (mWaitDialog)
       
   750         mWaitDialog->cancel();
       
   751 }
       
   752 
       
   753 void EngineWrapper::waitDialogCancelled()
       
   754 {
       
   755     mEngine->FileUtils()->SetAllowProcessing(false);
       
   756 }
       
   757 
       
   758 void EngineWrapper::ProcessEvents()
       
   759 {
       
   760     qApp->processEvents();
   721 }
   761 }
   722 
   762 
   723 TBool EngineWrapper::ShowConfirmationQuery(const TDesC& aDescText)
   763 TBool EngineWrapper::ShowConfirmationQuery(const TDesC& aDescText)
   724 {
   764 {
   725     QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   765     QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   726     return Notifications::showConfirmationQuery(qStringText);
   766     return Notifications::showConfirmationQuery(qText);
   727 }
   767 }
   728 
   768 
   729 // ---------------------------------------------------------------------------
   769 // ---------------------------------------------------------------------------