filebrowser/ui/src/enginewrapper.cpp
changeset 51 b048e15729d6
parent 31 e7a04a6385be
equal deleted inserted replaced
44:5db69f4c3d06 51:b048e15729d6
    18 #include "enginewrapper.h"
    18 #include "enginewrapper.h"
    19 #include "engine.h"
    19 #include "engine.h"
    20 #include "FBFileUtils.h"
    20 #include "FBFileUtils.h"
    21 #include "notifications.h"
    21 #include "notifications.h"
    22 #include "fbfileview.h"
    22 #include "fbfileview.h"
    23 #include "searchview.h"
    23 #include "fbsearchview.h"
    24 #include "filebrowsersettings.h"
    24 #include "filebrowsersettings.h"
    25 #include "settingsview.h"
    25 //#include "fbsettingsview.h"
    26 
    26 
    27 #include <HbProgressDialog>
    27 #include <HbProgressDialog>
    28 
    28 
    29 #include <QString>
    29 #include <QString>
    30 #include <QFileInfo>
    30 #include <QFileInfo>
    95     attributes.mWildCards  = QString((QChar*)tAttributes.iWildCards.Ptr(),tAttributes.iWildCards.Length()); 
    95     attributes.mWildCards  = QString((QChar*)tAttributes.iWildCards.Ptr(),tAttributes.iWildCards.Length()); 
    96     attributes.mTextInFile = QString((QChar*)tAttributes.iTextInFile.Ptr(),tAttributes.iTextInFile.Length()); 
    96     attributes.mTextInFile = QString((QChar*)tAttributes.iTextInFile.Ptr(),tAttributes.iTextInFile.Length()); 
    97     attributes.mMinSize    = tAttributes.iMinSize;
    97     attributes.mMinSize    = tAttributes.iMinSize;
    98     attributes.mMaxSize    = tAttributes.iMaxSize;
    98     attributes.mMaxSize    = tAttributes.iMaxSize;
    99     attributes.mRecurse    = tAttributes.iRecurse;
    99     attributes.mRecurse    = tAttributes.iRecurse;
       
   100     attributes.mDefaultWildCard = tAttributes.iDefaultWildCard;
   100     
   101     
   101     // TTime to QDate
   102     // TTime to QDate
   102     TBuf<20> timeString;
   103     TBuf<20> timeString;
   103     _LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3");
   104     _LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3");
   104     TRAP_IGNORE( tAttributes.iMinDate.FormatL(timeString, KDateString) );
   105     TRAP_IGNORE( tAttributes.iMinDate.FormatL(timeString, KDateString) );
   128     tAttributes.iTextInFile = TFileName(attributes.mTextInFile.utf16());
   129     tAttributes.iTextInFile = TFileName(attributes.mTextInFile.utf16());
   129     
   130     
   130     tAttributes.iMinSize    = attributes.mMinSize;
   131     tAttributes.iMinSize    = attributes.mMinSize;
   131     tAttributes.iMaxSize    = attributes.mMaxSize;    
   132     tAttributes.iMaxSize    = attributes.mMaxSize;    
   132     tAttributes.iRecurse    = attributes.mRecurse;
   133     tAttributes.iRecurse    = attributes.mRecurse;
       
   134     tAttributes.iDefaultWildCard = attributes.mDefaultWildCard;
   133     
   135     
   134     // QDate to TTime for both min- and max Date
   136     // QDate to TTime for both min- and max Date
   135     QString temp = attributes.mMinDate.toString("yyyy-MM-dd");
   137     QString temp = attributes.mMinDate.toString("yyyy-MM-dd");
   136     QStringList dateList = temp.split("-");
   138     QStringList dateList = temp.split("-");
   137     int month = dateList[1].toInt() - 1;
   139     int month = dateList[1].toInt() - 1;
   401         }
   403         }
   402 //        CleanupStack::PopAndDestroy(); //entryLines
   404 //        CleanupStack::PopAndDestroy(); //entryLines
   403         delete entryLines;
   405         delete entryLines;
   404     }
   406     }
   405 }
   407 }
       
   408 
       
   409 // ---------------------------------------------------------------------------
       
   410 
       
   411 void EngineWrapper::setAttributes(quint32 &setAttributesMask, quint32 &clearAttributesMask, bool &recurse)
       
   412 {
       
   413     if (mEngine->FileUtils()) {
       
   414         TBool tRecurse = recurse ? ETrue : EFalse;
       
   415         TRAPD(err, mEngine->FileUtils()->SetAttributesL(setAttributesMask, clearAttributesMask, tRecurse));
       
   416         Q_UNUSED(err); //TODO
       
   417     }
       
   418 }
       
   419 
   406 // ---------------------------------------------------------------------------
   420 // ---------------------------------------------------------------------------
   407 
   421 
   408 bool EngineWrapper::openAppArc(QString fileName)
   422 bool EngineWrapper::openAppArc(QString fileName)
   409 {
   423 {
   410 
   424 
   447     }
   461     }
   448 }
   462 }
   449 
   463 
   450 // ---------------------------------------------------------------------------
   464 // ---------------------------------------------------------------------------
   451 
   465 
   452 DriveEntry EngineWrapper::getDriveEntry(const QModelIndex& aIndex) const
   466 FbDriveEntry EngineWrapper::getDriveEntry(const QModelIndex& aIndex) const
   453 {
   467 {
   454     TDriveEntry driveEntry;
   468     TDriveEntry driveEntry;
   455     if (mEngine->FileUtils()->DriveEntries()->Count() > aIndex.row() && aIndex.row() >= 0) {
   469     if (mEngine->FileUtils()->DriveEntries()->Count() > aIndex.row() && aIndex.row() >= 0) {
   456         driveEntry = mEngine->FileUtils()->DriveEntries()->At(aIndex.row());
   470         driveEntry = mEngine->FileUtils()->DriveEntries()->At(aIndex.row());
   457     }
   471     }
   458     return DriveEntry(driveEntry);
   472     return FbDriveEntry(driveEntry);
   459 }
   473 }
   460 
   474 
   461 // ---------------------------------------------------------------------------
   475 // ---------------------------------------------------------------------------
   462 
   476 
   463 FileEntry EngineWrapper::getFileEntry(const QModelIndex& aIndex) const
   477 FbFileEntry EngineWrapper::getFileEntry(const QModelIndex& aIndex) const
   464 {
   478 {
   465     TFileEntry fileEntry;
   479     TFileEntry fileEntry;
   466     if (mEngine->FileUtils()->FileEntries()->Count() > aIndex.row() && aIndex.row() >= 0) {
   480     if (mEngine->FileUtils()->FileEntries()->Count() > aIndex.row() && aIndex.row() >= 0) {
   467         fileEntry = mEngine->FileUtils()->FileEntries()->At(aIndex.row());
   481         fileEntry = mEngine->FileUtils()->FileEntries()->At(aIndex.row());
   468     }
   482     }
   469     return FileEntry(fileEntry);
   483     return FbFileEntry(fileEntry);
   470 }
   484 }
   471 
   485 
   472 // ---------------------------------------------------------------------------
   486 // ---------------------------------------------------------------------------
   473 
   487 
   474 const CArrayFix<TInt> *EngineWrapper::convertSelectionList(const QModelIndexList &aSelectionIndices)
   488 const CArrayFix<TInt> *EngineWrapper::convertSelectionList(const QModelIndexList &aSelectionIndices)
   499 // ---------------------------------------------------------------------------
   513 // ---------------------------------------------------------------------------
   500 
   514 
   501 bool EngineWrapper::isDestinationEntriesExists(const QModelIndexList &aSelectionIndices, QString aTargetDir)
   515 bool EngineWrapper::isDestinationEntriesExists(const QModelIndexList &aSelectionIndices, QString aTargetDir)
   502 {
   516 {
   503     TFileName targetDir = TFileName(aTargetDir.utf16());
   517     TFileName targetDir = TFileName(aTargetDir.utf16());
   504     setCurrentSelection(aSelectionIndices);
   518     //setCurrentSelection(aSelectionIndices);
       
   519     Q_UNUSED(aSelectionIndices);
   505 
   520 
   506     TBool someEntryExists = mEngine->FileUtils()->IsDestinationEntriesExists(targetDir);
   521     TBool someEntryExists = mEngine->FileUtils()->IsDestinationEntriesExists(targetDir);
   507     return someEntryExists;
   522     return someEntryExists;
   508 }
   523 }
   509 
   524 
   803 {
   818 {
   804     QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   819     QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
   805     return Notifications::showConfirmationQuery(qText);
   820     return Notifications::showConfirmationQuery(qText);
   806 }
   821 }
   807 
   822 
   808 // ---------------------------------------------------------------------------
   823 void EngineWrapper::NotifyModelHasChanged()
       
   824 {
       
   825     emit fileSystemDataChanged();
       
   826 }
       
   827 
       
   828 // ---------------------------------------------------------------------------