# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272878679 -10800 # Node ID ada7962b43082f15c8e4b74629ae696b93a65ce6 # Parent 1957042d8c7ec4c4ebfd32304d153aed47d291a5 Revision: 201015 Kit: 201018 diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/bwins/fmbkupenginewrapperu.def --- a/filemanager/src/bwins/fmbkupenginewrapperu.def Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/bwins/fmbkupenginewrapperu.def Mon May 03 12:24:39 2010 +0300 @@ -23,42 +23,44 @@ ?CreateEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@ABVQString@@0W4TSettingType@2@@Z @ 22 NONAME ; class FmBackupEntry * FmBackupSettings::CreateEntry(class QString const &, class QString const &, enum FmBackupEntry::TSettingType) ?content@FmBackupSettings@@QBEIXZ @ 23 NONAME ; unsigned int FmBackupSettings::content(void) const ?targetDrive@FmBackupSettings@@QBE?AVQString@@XZ @ 24 NONAME ; class QString FmBackupSettings::targetDrive(void) const - ??0FmBkupEngine@@QAE@PAVQObject@@@Z @ 25 NONAME ; FmBkupEngine::FmBkupEngine(class QObject *) - ?notifyPreparing@FmBkupEngine@@IAEX_N@Z @ 26 NONAME ; void FmBkupEngine::notifyPreparing(bool) - ?setWeekday@FmBackupSettings@@QAEXW4TFileManagerBackupWeekday@1@@Z @ 27 NONAME ; void FmBackupSettings::setWeekday(enum FmBackupSettings::TFileManagerBackupWeekday) - ?load@FmRestoreSettings@@QAEXV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 28 NONAME ; void FmRestoreSettings::load(class QList) - ?resetAndDestoryRestoreEntry@FmRestoreSettings@@AAEXXZ @ 29 NONAME ; void FmRestoreSettings::resetAndDestoryRestoreEntry(void) - ?targetDriveToString@FmBackupSettings@@QAE?AVQString@@ABV2@@Z @ 30 NONAME ; class QString FmBackupSettings::targetDriveToString(class QString const &) - ?setScheduling@FmBackupSettings@@QAEXW4TFileManagerBackupSchedule@1@@Z @ 31 NONAME ; void FmBackupSettings::setScheduling(enum FmBackupSettings::TFileManagerBackupSchedule) - ??1FmRestoreSettings@@QAE@XZ @ 32 NONAME ; FmRestoreSettings::~FmRestoreSettings(void) - ?notifyFinish@FmBkupEngine@@IAEXH@Z @ 33 NONAME ; void FmBkupEngine::notifyFinish(int) - ?createContentsEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 34 NONAME ; class FmBackupEntry * FmBackupSettings::createContentsEntry(void) - ?qt_metacast@FmBkupEngine@@UAEPAXPBD@Z @ 35 NONAME ; void * FmBkupEngine::qt_metacast(char const *) - ?SetSelection@FmRestoreSettings@@QAEXAB_K@Z @ 36 NONAME ; void FmRestoreSettings::SetSelection(unsigned long long const &) - ?createSchedulingEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 37 NONAME ; class FmBackupEntry * FmBackupSettings::createSchedulingEntry(void) - ?metaObject@FmBkupEngine@@UBEPBUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const * FmBkupEngine::metaObject(void) const - ?startBackup@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@V?$QList@PAVFmBkupBackupCategory@@@@VQString@@I@Z @ 39 NONAME ; bool FmBkupEngine::startBackup(class QList, class QList, class QString, unsigned int) - ?createTargetDriveEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 40 NONAME ; class FmBackupEntry * FmBackupSettings::createTargetDriveEntry(void) - ?load@FmBackupSettings@@QAEXXZ @ 41 NONAME ; void FmBackupSettings::load(void) - ?notifyMemoryLow@FmBkupEngine@@IAEXHAAH@Z @ 42 NONAME ; void FmBkupEngine::notifyMemoryLow(int, int &) - ??1FmBkupEngine@@UAE@XZ @ 43 NONAME ; FmBkupEngine::~FmBkupEngine(void) - ??0FmBackupSettings@@QAE@XZ @ 44 NONAME ; FmBackupSettings::FmBackupSettings(void) - ?CreateEntry@FmRestoreSettings@@AAEPAVFmRestoreEntry@@ABVFmRestoreInfo@@@Z @ 45 NONAME ; class FmRestoreEntry * FmRestoreSettings::CreateEntry(class FmRestoreInfo const &) - ?startRestore@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 46 NONAME ; bool FmBkupEngine::startRestore(class QList) - ?resetAndDestoryBackupEntry@FmBackupSettings@@AAEXXZ @ 47 NONAME ; void FmBackupSettings::resetAndDestoryBackupEntry(void) - ?BackupSettingsL@FmBkupEngine@@QAEPAVFmBackupSettings@@XZ @ 48 NONAME ; class FmBackupSettings * FmBkupEngine::BackupSettingsL(void) - ?setContent@FmBackupSettings@@QAEXI@Z @ 49 NONAME ; void FmBackupSettings::setContent(unsigned int) - ?staticMetaObject@FmBkupEngine@@2UQMetaObject@@B @ 50 NONAME ; struct QMetaObject const FmBkupEngine::staticMetaObject - ?setTargetDrive@FmBackupSettings@@QAEXABVQString@@@Z @ 51 NONAME ; void FmBackupSettings::setTargetDrive(class QString const &) - ?schedulingToString@FmBackupSettings@@QAE?AVQString@@W4TFileManagerBackupSchedule@1@@Z @ 52 NONAME ; class QString FmBackupSettings::schedulingToString(enum FmBackupSettings::TFileManagerBackupSchedule) - ?refreshList@FmRestoreSettings@@AAEXAAV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 53 NONAME ; void FmRestoreSettings::refreshList(class QList &) - ?weekdayToString@FmBackupSettings@@SA?AVQString@@W4TFileManagerBackupWeekday@1@@Z @ 54 NONAME ; class QString FmBackupSettings::weekdayToString(enum FmBackupSettings::TFileManagerBackupWeekday) - ?tr@FmBkupEngine@@SA?AVQString@@PBD0H@Z @ 55 NONAME ; class QString FmBkupEngine::tr(char const *, char const *, int) - ?contentToString@FmBackupSettings@@SA?AVQString@@I@Z @ 56 NONAME ; class QString FmBackupSettings::contentToString(unsigned int) - ?RestoreSettingsL@FmBkupEngine@@QAEPAVFmRestoreSettings@@XZ @ 57 NONAME ; class FmRestoreSettings * FmBkupEngine::RestoreSettingsL(void) - ?time@FmBackupSettings@@QBEABVQTime@@XZ @ 58 NONAME ; class QTime const & FmBackupSettings::time(void) const - ?notifyStart@FmBkupEngine@@IAEX_NH@Z @ 59 NONAME ; void FmBkupEngine::notifyStart(bool, int) - ?scheduling@FmBackupSettings@@QBE?AW4TFileManagerBackupSchedule@1@XZ @ 60 NONAME ; enum FmBackupSettings::TFileManagerBackupSchedule FmBackupSettings::scheduling(void) const - ?qt_metacall@FmBkupEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 61 NONAME ; int FmBkupEngine::qt_metacall(enum QMetaObject::Call, int, void * *) - ?createWeekdayEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 62 NONAME ; class FmBackupEntry * FmBackupSettings::createWeekdayEntry(void) + ?getBackupDriveList@FmBkupEngine@@QAEXAAVQStringList@@@Z @ 25 NONAME ; void FmBkupEngine::getBackupDriveList(class QStringList &) + ??0FmBkupEngine@@QAE@PAVQObject@@@Z @ 26 NONAME ; FmBkupEngine::FmBkupEngine(class QObject *) + ?notifyPreparing@FmBkupEngine@@IAEX_N@Z @ 27 NONAME ; void FmBkupEngine::notifyPreparing(bool) + ?setWeekday@FmBackupSettings@@QAEXW4TFileManagerBackupWeekday@1@@Z @ 28 NONAME ; void FmBackupSettings::setWeekday(enum FmBackupSettings::TFileManagerBackupWeekday) + ?load@FmRestoreSettings@@QAEXV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 29 NONAME ; void FmRestoreSettings::load(class QList) + ?resetAndDestoryRestoreEntry@FmRestoreSettings@@AAEXXZ @ 30 NONAME ; void FmRestoreSettings::resetAndDestoryRestoreEntry(void) + ?targetDriveToString@FmBackupSettings@@QAE?AVQString@@ABV2@@Z @ 31 NONAME ; class QString FmBackupSettings::targetDriveToString(class QString const &) + ?setScheduling@FmBackupSettings@@QAEXW4TFileManagerBackupSchedule@1@@Z @ 32 NONAME ; void FmBackupSettings::setScheduling(enum FmBackupSettings::TFileManagerBackupSchedule) + ??1FmRestoreSettings@@QAE@XZ @ 33 NONAME ; FmRestoreSettings::~FmRestoreSettings(void) + ?notifyFinish@FmBkupEngine@@IAEXH@Z @ 34 NONAME ; void FmBkupEngine::notifyFinish(int) + ?createContentsEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 35 NONAME ; class FmBackupEntry * FmBackupSettings::createContentsEntry(void) + ?qt_metacast@FmBkupEngine@@UAEPAXPBD@Z @ 36 NONAME ; void * FmBkupEngine::qt_metacast(char const *) + ??0FmBackupSettings@@QAE@PAVFmBkupEngine@@@Z @ 37 NONAME ; FmBackupSettings::FmBackupSettings(class FmBkupEngine *) + ?SetSelection@FmRestoreSettings@@QAEXAB_K@Z @ 38 NONAME ; void FmRestoreSettings::SetSelection(unsigned long long const &) + ?createSchedulingEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 39 NONAME ; class FmBackupEntry * FmBackupSettings::createSchedulingEntry(void) + ?metaObject@FmBkupEngine@@UBEPBUQMetaObject@@XZ @ 40 NONAME ; struct QMetaObject const * FmBkupEngine::metaObject(void) const + ?startBackup@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@V?$QList@PAVFmBkupBackupCategory@@@@VQString@@I@Z @ 41 NONAME ; bool FmBkupEngine::startBackup(class QList, class QList, class QString, unsigned int) + ?createTargetDriveEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 42 NONAME ; class FmBackupEntry * FmBackupSettings::createTargetDriveEntry(void) + ?load@FmBackupSettings@@QAEXXZ @ 43 NONAME ; void FmBackupSettings::load(void) + ?notifyMemoryLow@FmBkupEngine@@IAEXHAAH@Z @ 44 NONAME ; void FmBkupEngine::notifyMemoryLow(int, int &) + ??1FmBkupEngine@@UAE@XZ @ 45 NONAME ; FmBkupEngine::~FmBkupEngine(void) + ?CreateEntry@FmRestoreSettings@@AAEPAVFmRestoreEntry@@ABVFmRestoreInfo@@@Z @ 46 NONAME ; class FmRestoreEntry * FmRestoreSettings::CreateEntry(class FmRestoreInfo const &) + ?startRestore@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 47 NONAME ; bool FmBkupEngine::startRestore(class QList) + ?resetAndDestoryBackupEntry@FmBackupSettings@@AAEXXZ @ 48 NONAME ; void FmBackupSettings::resetAndDestoryBackupEntry(void) + ?BackupSettingsL@FmBkupEngine@@QAEPAVFmBackupSettings@@XZ @ 49 NONAME ; class FmBackupSettings * FmBkupEngine::BackupSettingsL(void) + ?setContent@FmBackupSettings@@QAEXI@Z @ 50 NONAME ; void FmBackupSettings::setContent(unsigned int) + ?staticMetaObject@FmBkupEngine@@2UQMetaObject@@B @ 51 NONAME ; struct QMetaObject const FmBkupEngine::staticMetaObject + ?setTargetDrive@FmBackupSettings@@QAEXABVQString@@@Z @ 52 NONAME ; void FmBackupSettings::setTargetDrive(class QString const &) + ?schedulingToString@FmBackupSettings@@QAE?AVQString@@W4TFileManagerBackupSchedule@1@@Z @ 53 NONAME ; class QString FmBackupSettings::schedulingToString(enum FmBackupSettings::TFileManagerBackupSchedule) + ?refreshList@FmRestoreSettings@@AAEXAAV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 54 NONAME ; void FmRestoreSettings::refreshList(class QList &) + ?weekdayToString@FmBackupSettings@@SA?AVQString@@W4TFileManagerBackupWeekday@1@@Z @ 55 NONAME ; class QString FmBackupSettings::weekdayToString(enum FmBackupSettings::TFileManagerBackupWeekday) + ?tr@FmBkupEngine@@SA?AVQString@@PBD0H@Z @ 56 NONAME ; class QString FmBkupEngine::tr(char const *, char const *, int) + ?contentToString@FmBackupSettings@@SA?AVQString@@I@Z @ 57 NONAME ; class QString FmBackupSettings::contentToString(unsigned int) + ?RestoreSettingsL@FmBkupEngine@@QAEPAVFmRestoreSettings@@XZ @ 58 NONAME ; class FmRestoreSettings * FmBkupEngine::RestoreSettingsL(void) + ?time@FmBackupSettings@@QBEABVQTime@@XZ @ 59 NONAME ; class QTime const & FmBackupSettings::time(void) const + ?notifyStart@FmBkupEngine@@IAEX_NH@Z @ 60 NONAME ; void FmBkupEngine::notifyStart(bool, int) + ?scheduling@FmBackupSettings@@QBE?AW4TFileManagerBackupSchedule@1@XZ @ 61 NONAME ; enum FmBackupSettings::TFileManagerBackupSchedule FmBackupSettings::scheduling(void) const + ?qt_metacall@FmBkupEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 62 NONAME ; int FmBkupEngine::qt_metacall(enum QMetaObject::Call, int, void * *) + ?createWeekdayEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 63 NONAME ; class FmBackupEntry * FmBackupSettings::createWeekdayEntry(void) + ?notifyBackupFilesExist@FmBkupEngine@@IAEXAA_N@Z @ 64 NONAME ; void FmBkupEngine::notifyBackupFilesExist(bool &) diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/eabi/fmbkupenginewrapperu.def --- a/filemanager/src/eabi/fmbkupenginewrapperu.def Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/eabi/fmbkupenginewrapperu.def Mon May 03 12:24:39 2010 +0300 @@ -13,56 +13,58 @@ _ZN12FmBkupEngine15notifyPreparingEb @ 12 NONAME _ZN12FmBkupEngine16RestoreSettingsLEv @ 13 NONAME _ZN12FmBkupEngine16staticMetaObjectE @ 14 NONAME DATA 16 - _ZN12FmBkupEngine19GetRestoreInfoArrayER5QListIP24FmBkupDrivesAndOperationERS0_I13FmRestoreInfoEi @ 15 NONAME - _ZN12FmBkupEngine19getStaticMetaObjectEv @ 16 NONAME - _ZN12FmBkupEngineC1EP7QObject @ 17 NONAME - _ZN12FmBkupEngineC2EP7QObject @ 18 NONAME - _ZN12FmBkupEngineD0Ev @ 19 NONAME - _ZN12FmBkupEngineD1Ev @ 20 NONAME - _ZN12FmBkupEngineD2Ev @ 21 NONAME - _ZN16FmBackupSettings10setContentEj @ 22 NONAME - _ZN16FmBackupSettings10setWeekdayENS_25TFileManagerBackupWeekdayE @ 23 NONAME - _ZN16FmBackupSettings11CreateEntryERK7QStringS2_N13FmBackupEntry12TSettingTypeE @ 24 NONAME - _ZN16FmBackupSettings11refreshListEv @ 25 NONAME - _ZN16FmBackupSettings13setSchedulingENS_26TFileManagerBackupScheduleE @ 26 NONAME - _ZN16FmBackupSettings14setTargetDriveERK7QString @ 27 NONAME - _ZN16FmBackupSettings15backupEntryListEv @ 28 NONAME - _ZN16FmBackupSettings15contentToStringEj @ 29 NONAME - _ZN16FmBackupSettings15createTimeEntryEv @ 30 NONAME - _ZN16FmBackupSettings15weekdayToStringENS_25TFileManagerBackupWeekdayE @ 31 NONAME - _ZN16FmBackupSettings18createWeekdayEntryEv @ 32 NONAME - _ZN16FmBackupSettings18schedulingToStringENS_26TFileManagerBackupScheduleE @ 33 NONAME - _ZN16FmBackupSettings19createContentsEntryEv @ 34 NONAME - _ZN16FmBackupSettings19targetDriveToStringERK7QString @ 35 NONAME - _ZN16FmBackupSettings21createSchedulingEntryEv @ 36 NONAME - _ZN16FmBackupSettings22createTargetDriveEntryEv @ 37 NONAME - _ZN16FmBackupSettings26resetAndDestoryBackupEntryEv @ 38 NONAME - _ZN16FmBackupSettings4loadEv @ 39 NONAME - _ZN16FmBackupSettings4saveEv @ 40 NONAME - _ZN16FmBackupSettings7setTimeERK5QTime @ 41 NONAME - _ZN16FmBackupSettingsC1Ev @ 42 NONAME - _ZN16FmBackupSettingsC2Ev @ 43 NONAME - _ZN16FmBackupSettingsD1Ev @ 44 NONAME - _ZN16FmBackupSettingsD2Ev @ 45 NONAME - _ZN17FmRestoreSettings11CreateEntryERK13FmRestoreInfo @ 46 NONAME - _ZN17FmRestoreSettings11refreshListER5QListIP24FmBkupDrivesAndOperationE @ 47 NONAME - _ZN17FmRestoreSettings12SetSelectionERKy @ 48 NONAME - _ZN17FmRestoreSettings16restoreEntryListEv @ 49 NONAME - _ZN17FmRestoreSettings27resetAndDestoryRestoreEntryEv @ 50 NONAME - _ZN17FmRestoreSettings4loadE5QListIP24FmBkupDrivesAndOperationE @ 51 NONAME - _ZN17FmRestoreSettingsC1ER12FmBkupEngine @ 52 NONAME - _ZN17FmRestoreSettingsC2ER12FmBkupEngine @ 53 NONAME - _ZN17FmRestoreSettingsD1Ev @ 54 NONAME - _ZN17FmRestoreSettingsD2Ev @ 55 NONAME - _ZNK12FmBkupEngine10metaObjectEv @ 56 NONAME - _ZNK12FmBkupEngine5errorEv @ 57 NONAME - _ZNK16FmBackupSettings10schedulingEv @ 58 NONAME - _ZNK16FmBackupSettings11targetDriveEv @ 59 NONAME - _ZNK16FmBackupSettings16contentsSelectedEv @ 60 NONAME - _ZNK16FmBackupSettings4timeEv @ 61 NONAME - _ZNK16FmBackupSettings7contentEv @ 62 NONAME - _ZNK16FmBackupSettings7weekdayEv @ 63 NONAME - _ZNK17FmRestoreSettings13GetSelectionLER5QListI13FmRestoreInfoE @ 64 NONAME - _ZTI12FmBkupEngine @ 65 NONAME - _ZTV12FmBkupEngine @ 66 NONAME + _ZN12FmBkupEngine18getBackupDriveListER11QStringList @ 15 NONAME + _ZN12FmBkupEngine19GetRestoreInfoArrayER5QListIP24FmBkupDrivesAndOperationERS0_I13FmRestoreInfoEi @ 16 NONAME + _ZN12FmBkupEngine19getStaticMetaObjectEv @ 17 NONAME + _ZN12FmBkupEngineC1EP7QObject @ 18 NONAME + _ZN12FmBkupEngineC2EP7QObject @ 19 NONAME + _ZN12FmBkupEngineD0Ev @ 20 NONAME + _ZN12FmBkupEngineD1Ev @ 21 NONAME + _ZN12FmBkupEngineD2Ev @ 22 NONAME + _ZN16FmBackupSettings10setContentEj @ 23 NONAME + _ZN16FmBackupSettings10setWeekdayENS_25TFileManagerBackupWeekdayE @ 24 NONAME + _ZN16FmBackupSettings11CreateEntryERK7QStringS2_N13FmBackupEntry12TSettingTypeE @ 25 NONAME + _ZN16FmBackupSettings11refreshListEv @ 26 NONAME + _ZN16FmBackupSettings13setSchedulingENS_26TFileManagerBackupScheduleE @ 27 NONAME + _ZN16FmBackupSettings14setTargetDriveERK7QString @ 28 NONAME + _ZN16FmBackupSettings15backupEntryListEv @ 29 NONAME + _ZN16FmBackupSettings15contentToStringEj @ 30 NONAME + _ZN16FmBackupSettings15createTimeEntryEv @ 31 NONAME + _ZN16FmBackupSettings15weekdayToStringENS_25TFileManagerBackupWeekdayE @ 32 NONAME + _ZN16FmBackupSettings18createWeekdayEntryEv @ 33 NONAME + _ZN16FmBackupSettings18schedulingToStringENS_26TFileManagerBackupScheduleE @ 34 NONAME + _ZN16FmBackupSettings19createContentsEntryEv @ 35 NONAME + _ZN16FmBackupSettings19targetDriveToStringERK7QString @ 36 NONAME + _ZN16FmBackupSettings21createSchedulingEntryEv @ 37 NONAME + _ZN16FmBackupSettings22createTargetDriveEntryEv @ 38 NONAME + _ZN16FmBackupSettings26resetAndDestoryBackupEntryEv @ 39 NONAME + _ZN16FmBackupSettings4loadEv @ 40 NONAME + _ZN16FmBackupSettings4saveEv @ 41 NONAME + _ZN16FmBackupSettings7setTimeERK5QTime @ 42 NONAME + _ZN16FmBackupSettingsC1EP12FmBkupEngine @ 43 NONAME + _ZN16FmBackupSettingsC2EP12FmBkupEngine @ 44 NONAME + _ZN16FmBackupSettingsD1Ev @ 45 NONAME + _ZN16FmBackupSettingsD2Ev @ 46 NONAME + _ZN17FmRestoreSettings11CreateEntryERK13FmRestoreInfo @ 47 NONAME + _ZN17FmRestoreSettings11refreshListER5QListIP24FmBkupDrivesAndOperationE @ 48 NONAME + _ZN17FmRestoreSettings12SetSelectionERKy @ 49 NONAME + _ZN17FmRestoreSettings16restoreEntryListEv @ 50 NONAME + _ZN17FmRestoreSettings27resetAndDestoryRestoreEntryEv @ 51 NONAME + _ZN17FmRestoreSettings4loadE5QListIP24FmBkupDrivesAndOperationE @ 52 NONAME + _ZN17FmRestoreSettingsC1ER12FmBkupEngine @ 53 NONAME + _ZN17FmRestoreSettingsC2ER12FmBkupEngine @ 54 NONAME + _ZN17FmRestoreSettingsD1Ev @ 55 NONAME + _ZN17FmRestoreSettingsD2Ev @ 56 NONAME + _ZNK12FmBkupEngine10metaObjectEv @ 57 NONAME + _ZNK12FmBkupEngine5errorEv @ 58 NONAME + _ZNK16FmBackupSettings10schedulingEv @ 59 NONAME + _ZNK16FmBackupSettings11targetDriveEv @ 60 NONAME + _ZNK16FmBackupSettings16contentsSelectedEv @ 61 NONAME + _ZNK16FmBackupSettings4timeEv @ 62 NONAME + _ZNK16FmBackupSettings7contentEv @ 63 NONAME + _ZNK16FmBackupSettings7weekdayEv @ 64 NONAME + _ZNK17FmRestoreSettings13GetSelectionLER5QListI13FmRestoreInfoE @ 65 NONAME + _ZTI12FmBkupEngine @ 66 NONAME + _ZTV12FmBkupEngine @ 67 NONAME + _ZN12FmBkupEngine22notifyBackupFilesExistERb @ 68 NONAME diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/filemanager.pri --- a/filemanager/src/filemanager/filemanager.pri Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/filemanager.pri Mon May 03 12:24:39 2010 +0300 @@ -18,16 +18,6 @@ INCLUDEPATH += ./src/components INCLUDEPATH += ./src/backuprestore INCLUDEPATH += ./src/operationservice -INCLUDEPATH += ./src/fmdrivewatcher - -win32 { - INCLUDEPATH += ./src/fmdrivewatcher/private/win32 -} - - -symbian { - INCLUDEPATH += ./src/fmdrivewatcher/private/symbian -} HEADERS += src/fmdriverlistwidget.h \ src/listviewitems.h \ @@ -49,6 +39,7 @@ src/operationservice/fmoperationcopy.h \ src/operationservice/fmoperationmove.h \ src/operationservice/fmoperationremove.h \ + src/operationservice/fmoperationformat.h \ src/backuprestore/fmbackupview.h \ src/backuprestore/fmbackupwidget.h \ src/backuprestore/fmrestoreview.h \ @@ -67,16 +58,6 @@ src/components/fmviewdetailsdialog.h \ src/components/fmviewdetailsitem.h \ src/components/fmdrivedetailstype.h \ - src/fmdrivewatcher/fmdrivewatcher.h \ - -win32 { - HEADERS += src/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h \ - -} -symbian { - HEADERS += src/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h \ - src/fmdrivewatcher/private/symbian/fmdriveevent.h -} SOURCES += src/main.cpp \ src/fmdriverlistwidget.cpp \ @@ -116,14 +97,11 @@ src/components/fmmultitextquery.cpp \ src/components/fmviewdetailsdialog.cpp \ src/components/fmviewdetailsitem.cpp \ - src/components/fmdrivedetailstype.cpp \ - src/fmdrivewatcher/fmdrivewatcher.cpp - + src/components/fmdrivedetailstype.cpp win32 { - SOURCES += src/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp + SOURCES += src/operationservice/fmoperationformat_win.cpp } symbian { - SOURCES += src/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp \ - src/fmdrivewatcher/private/symbian/fmdriveevent.cpp + SOURCES += src/operationservice/fmoperationformat_s60.cpp } \ No newline at end of file diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/filemanager.pro --- a/filemanager/src/filemanager/filemanager.pro Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/filemanager.pro Mon May 03 12:24:39 2010 +0300 @@ -18,7 +18,7 @@ CONFIG += hb TEMPLATE = app TARGET = filemngr - +RESOURCES += filemanager.qrc INCLUDEPATH += ../fmbkupenginewrapper/inc # remove this path when export plat header to app layer path INCLUDEPATH += ../../filemanager_plat/inc @@ -37,7 +37,11 @@ -lapmime \ -lxqservice \ -lxqutils \ - -lshareui + -lshareui \ + -lefsrv \ + -lapgrfx \ + -lcone \ + -ldirectorylocalizer TARGET.UID3 = 0x2002BCC0 TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/filemanager.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/filemanager.qrc Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,11 @@ + + + image/qtg_indi_status_back.svg + image/qgn_prop_mmc_locked.svg + image/qgn_prop_mmc_memc.svg + image/qgn_prop_fmgr_mmc_no_sub.svg + image/qgn_prop_phone_memc.svg + image/qgn_prop_usb_memc.svg + image/qgn_prop_fmgr_ms.svg + + \ No newline at end of file diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/image/qgn_prop_fmgr_mmc_no_sub.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_fmgr_mmc_no_sub.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/image/qgn_prop_fmgr_ms.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_fmgr_ms.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/image/qgn_prop_mmc_locked.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_mmc_locked.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/image/qgn_prop_mmc_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_mmc_memc.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/image/qgn_prop_phone_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_phone_memc.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/image/qgn_prop_usb_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qgn_prop_usb_memc.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/image/qtg_indi_status_back.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/image/qtg_indi_status_back.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,17 @@ + + + +]> + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Mon May 03 12:24:39 2010 +0300 @@ -40,6 +40,8 @@ this, SLOT( onNotifyFinish(int) ), Qt::QueuedConnection ); connect( mBkupEngine, SIGNAL( notifyMemoryLow(int, int& ) ), this, SLOT( onNotifyMemoryLow(int, int&) ) ); + connect( mBkupEngine, SIGNAL( notifyBackupFilesExist( bool& )), this, SLOT( onNotifyBackupFilesExist( bool& ))); + } FmBackupRestoreHandler::~FmBackupRestoreHandler() { @@ -74,10 +76,8 @@ mBkupEngine->BackupSettingsL()->targetDrive(), mBkupEngine->BackupSettingsL()->content() ); - if( !ret ) - { + if( !ret ) { mCurrentProcess = ProcessNone; - HbMessageBox::information(tr("backup failed")); } return ret; } @@ -90,10 +90,8 @@ mCurrentProcess = ProcessRestore; mBkupEngine->RestoreSettingsL()->SetSelection( operationRestore->selection() ); bool ret = mBkupEngine->startRestore( backupConfigLoader()->driversAndOperationList() ); - if( !ret ) - { + if( !ret ) { mCurrentProcess = ProcessNone; - HbMessageBox::information(tr("restore failed")); } return ret; } @@ -116,6 +114,17 @@ } } } +void FmBackupRestoreHandler::onNotifyBackupFilesExist( bool &isContinue ) + { + if ( HbMessageBox::question( "some bacup files exist, continue?" ) ) + { + isContinue = true; + } + else + { + isContinue = false; + } + } void FmBackupRestoreHandler::onNotifyPreparing( bool cancelable ) @@ -140,3 +149,8 @@ emit notifyError( err, QString("") ); } } + +void FmBackupRestoreHandler::getBackupDriveList( QStringList &driveList ) +{ + mBkupEngine->getBackupDriveList( driveList ); +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.h --- a/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.h Mon May 03 12:24:39 2010 +0300 @@ -47,6 +47,7 @@ int deleteBackup( quint64 selection ); FmBkupEngine *bkupEngine(); FmBackupConfigLoader *backupConfigLoader(); + void getBackupDriveList( QStringList &driveList ); signals: void notifyPreparing( bool cancelable ); @@ -64,6 +65,8 @@ void onNotifyStart( bool cancelable, int maxSteps ); void onNotifyUpdate( int currentStep ); void onNotifyFinish( int err ); + + void onNotifyBackupFilesExist( bool &isContinue ); private: enum Process{ ProcessNone = 0, diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Mon May 03 12:24:39 2010 +0300 @@ -55,18 +55,18 @@ #ifdef FM_CHANGE_ORIENT_ENABLE action = new HbAction( this ); action->setObjectName( "rotateAction" ); - action->setText( tr( "Change orientation" ) ); + action->setText( hbTrId( "Change orientation" ) ); menu()->addAction( action ); #endif action = new HbAction( this ); action->setObjectName( "backupAction" ); - action->setText( tr( "Start backup" ) ); + action->setText( hbTrId( "Start backup" ) ); menu()->addAction( action ); action = new HbAction( this ); action->setObjectName( "deleteBackupAction" ); - action->setText( tr( "Delete backup" ) ); + action->setText( hbTrId( "Delete backup" ) ); menu()->addAction( action ); } @@ -96,13 +96,19 @@ case FmErrNone: break; case FmErrWrongParam: - HbMessageBox::information( QString( tr("Operation canceled with wrong param!") ) ); + HbMessageBox::information( QString( hbTrId("Operation canceled with wrong param!") ) ); break; case FmErrAlreadyStarted: - HbMessageBox::information( QString( tr("Operation canceled because already started!") ) ); + HbMessageBox::information( QString( hbTrId("Operation canceled because already started!") ) ); + break; + case FmErrPathNotFound: + HbMessageBox::information( QString( hbTrId("Operation canceled because can not find target drive!") ) ); + break; + case FmErrAlreadyExists: + HbMessageBox::information( QString( hbTrId("backup canceled") ) ); break; default: - HbMessageBox::information( QString( tr("Operation canceled with error!") ) ); + HbMessageBox::information( QString( hbTrId("backup failed") ) ); break; } } @@ -120,21 +126,7 @@ void FmBackupView::on_backupAction_triggered() { - int ret = mOperationService->asyncBackup(); - switch( ret ) - { - case FmErrNone: - break; - case FmErrWrongParam: - HbMessageBox::information( QString( tr("Operation canceled with wrong param!") ) ); - break; - case FmErrAlreadyStarted: - HbMessageBox::information( QString( tr("Operation canceled because already started!") ) ); - break; - default: - HbMessageBox::information( QString( tr("Operation canceled with error!") ) ); - break; - } + on_leftAction_triggered(); } void FmBackupView::on_deleteBackupAction_triggered() diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Mon May 03 12:24:39 2010 +0300 @@ -115,20 +115,27 @@ void FmBackupWidget::expandAllGroup() { + FmLogger::log( QString( "function expandAllGroup start" ) ); + mDataForm->setModel( 0 ); mDataForm->setModel( mModel ); HbDataFormViewItem *itemScheduling = (HbDataFormViewItem *)(mDataForm->itemByIndex(mModel->indexFromItem(mSchedulingGroup))); if( itemScheduling ){ + FmLogger::log( QString( "expand itemScheduling start" ) ); itemScheduling->setExpanded( true ); + FmLogger::log( QString( "expand itemScheduling end" ) ); } HbDataFormViewItem *itemGroup = (HbDataFormViewItem *)(mDataForm->itemByIndex(mModel->indexFromItem(mContentsGroup))); if( itemGroup ){ + FmLogger::log( QString( "expand itemGroup start" ) ); itemGroup->setExpanded( true ); + FmLogger::log( QString( "expand itemGroup end" ) ); } + FmLogger::log( QString( "function expandAllGroup end" ) ); } void FmBackupWidget::initModel() @@ -167,8 +174,25 @@ mBackupSettings->load(); - bool isWeekdayExist = false; - bool isTimeExist = false; + int index = 0; + + index = mSchedulingGroup->indexOf( mWeekdayItem ); + if( index >=0 ){ + mSchedulingGroup->removeChild( index ); + mWeekdayItem = 0; + } + + index = mSchedulingGroup->indexOf( mTimeItem ); + if( index >=0 ){ + mSchedulingGroup->removeChild( index ); + mTimeItem = 0; + } + + index = mContentsGroup->indexOf( mTargetItem ); + if( index >=0 ){ + mContentsGroup->removeChild( index ); + mTargetItem = 0; + } QList< FmBackupEntry* > backupEntryList = mBackupSettings->backupEntryList(); @@ -191,6 +215,9 @@ } case FmBackupEntry::ETarget: { + mTargetItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup ); + mTargetItem->setContentWidgetData( QString("readOnly"), QString("true") ); mTargetItem->setLabel(title); mTargetItem->setContentWidgetData( QString("text"), tips ); break; @@ -203,39 +230,24 @@ } case FmBackupEntry::EWeekday: { + mWeekdayItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup ); + mWeekdayItem->setContentWidgetData( QString("readOnly"), QString("true") ); mWeekdayItem->setLabel(title); mWeekdayItem->setContentWidgetData( QString("text"), tips ); - isWeekdayExist = true; break; } case FmBackupEntry::ETime: { + mTimeItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup ); + mTimeItem->setContentWidgetData( QString("readOnly"), QString("true") ); mTimeItem->setLabel(title); mTimeItem->setContentWidgetData( QString("text"), tips ); - isTimeExist = true; break; } } } - int index = 0; - - index = mSchedulingGroup->indexOf( mWeekdayItem ); - if( index >=0 ){ - mSchedulingGroup->removeChild( index ); - } - - index = mSchedulingGroup->indexOf( mTimeItem ); - if( index >=0 ){ - mSchedulingGroup->removeChild( index ); - } - - if( isWeekdayExist ) { - mSchedulingGroup->appendChild( mWeekdayItem ); - } - - if( isTimeExist ){ - mSchedulingGroup->appendChild( mTimeItem ); - } mDataForm->setModel( mModel ); @@ -329,11 +341,13 @@ QStringList driveStringList; QStringList driveList; - FmUtils::getDriveList( driveList, true ); + //FmUtils::getDriveList( driveList, true ); + FmViewManager::viewManager()->operationService()->backupRestoreHandler()->getBackupDriveList( driveList ); QString targetDrive = mBackupSettings->targetDrive(); int selectIndex = -1; int currentIndex = 0; + QString associatedDrives; for( QStringList::const_iterator it = driveList.begin(); it != driveList.end(); ++it ) { QString drive = (*it); @@ -342,7 +356,7 @@ driveStringList.push_back( drive ); queryStringList.push_back( driveWithVolume ); - + associatedDrives += FmUtils::getDriveLetterFromPath(drive); if( drive == targetDrive ) { @@ -352,7 +366,7 @@ ++currentIndex; } - if( FmDlgUtils::showSingleSettingQuery( title, queryStringList, selectIndex ) ) + if( FmDlgUtils::showSingleSettingQuery( title, queryStringList, selectIndex, associatedDrives ) ) { mBackupSettings->setTargetDrive( driveStringList.at( selectIndex ) ); emit doModelRefresh(); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Mon May 03 12:24:39 2010 +0300 @@ -33,7 +33,7 @@ FmDeleteBackupView::FmDeleteBackupView() : FmViewBase( EDeleteBackupView ) { - setTitle( tr( "Delete Backup" ) ); + setTitle( hbTrId( "Delete Backup" ) ); initMainWidget(); initToolBar(); @@ -55,13 +55,13 @@ HbAction *action = 0; action = new HbAction( this ); action->setObjectName( "rotateAction" ); - action->setText( tr( "Change orientation" ) ); + action->setText( hbTrId( "Change orientation" ) ); menu()->addAction( action ); #endif mDeleteAction = new HbAction( this ); mDeleteAction->setObjectName( "deleteAction" ); - mDeleteAction->setText( tr( "Delete backups" ) ); + mDeleteAction->setText( hbTrId( "Delete backups" ) ); menu()->addAction( mDeleteAction ); } @@ -77,7 +77,7 @@ { mLeftAction = new HbAction( this ); mLeftAction->setObjectName( "leftAction" ); - mLeftAction->setText( tr( "delete" ) ); + mLeftAction->setText( hbTrId( "delete" ) ); toolBar()->addAction( mLeftAction ); toolBar()->setOrientation( Qt::Horizontal ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Mon May 03 12:24:39 2010 +0300 @@ -33,7 +33,7 @@ FmRestoreView::FmRestoreView(): FmViewBase( ERestoreView ) { - setTitle( tr( "Restore" ) ); + setTitle( hbTrId( "Restore" ) ); initMainWidget(); initToolBar(); @@ -55,13 +55,13 @@ HbAction *action = 0; action = new HbAction( this ); action->setObjectName( "rotateAction" ); - action->setText( tr( "Change orientation" ) ); + action->setText( hbTrId( "Change orientation" ) ); menu()->addAction( action ); #endif mRestoreAction = new HbAction( this ); mRestoreAction->setObjectName( "restoreAction" ); - mRestoreAction->setText( tr( "Restore data" ) ); + mRestoreAction->setText( hbTrId( "Restore data" ) ); menu()->addAction( mRestoreAction ); } @@ -77,7 +77,7 @@ { mLeftAction = new HbAction( this ); mLeftAction->setObjectName( "leftAction" ); - mLeftAction->setText( tr( "Restore" ) ); + mLeftAction->setText( hbTrId( "Restore" ) ); toolBar()->addAction( mLeftAction ); toolBar()->setOrientation( Qt::Horizontal ); @@ -92,7 +92,21 @@ selection |= ( ( quint64 ) 1 ) << ( items[ i ] ); } - mOperationService->asyncRestore( selection ); + int ret = mOperationService->asyncRestore( selection ); + switch( ret ) + { + case FmErrNone: + break; + case FmErrWrongParam: + HbMessageBox::information( QString( hbTrId("Operation canceled with wrong param!") ) ); + break; + case FmErrAlreadyStarted: + HbMessageBox::information( QString( hbTrId("Operation canceled because already started!") ) ); + break; + default: + HbMessageBox::information(tr("restore failed")); + break; + } } #ifdef FM_CHANGE_ORIENT_ENABLE diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmdlgutils.cpp --- a/filemanager/src/filemanager/src/components/fmdlgutils.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdlgutils.cpp Mon May 03 12:24:39 2010 +0300 @@ -22,6 +22,7 @@ #include "fmsingletextquery.h" #include "fmmultitextquery.h" #include "fmutils.h" +#include "fmviewmanager.h" #include #include @@ -38,11 +39,29 @@ FmDlgUtils::~FmDlgUtils( void ) { } +HbAction *FmDlgUtils::executeDialog( HbDialog *dialog, const QString &associatedDrives ) +{ + for( int i = 0; i < associatedDrives.length(); i++ ) { + QString drive( associatedDrives[i] + QString( ":/" ) ); + if( !FmUtils::isDriveAvailable( drive ) ) { + FmLogger::log( "executeDialog return 0_ " + associatedDrives ); + return 0; + } + } + + FmDlgCloseUnit dlgCloseUnit( dialog ); + dlgCloseUnit.addAssociatedDrives( associatedDrives ); + + FmViewManager::viewManager()->addDlgCloseUnit( &dlgCloseUnit ); + HbAction* action = dialog->exec(); + FmViewManager::viewManager()->removeDlgCloseUnit( &dlgCloseUnit ); + return action; +} bool FmDlgUtils::showSingleSettingQuery( const QString &title, const QStringList &textList, - int &selectedIndex ) + int &selectedIndex, const QString &associatedDrives ) { bool ret( false ); @@ -66,21 +85,23 @@ QString sk1 ( tr ( "ok" ) ); QString sk2 ( tr ("cancel" ) ); - if(sk1.isEmpty() == false) { + if( !sk1.isEmpty() ) { HbAction *primary = new HbAction( sk1 ); cQuery->setPrimaryAction( primary ); } - if( sk2.isEmpty() == false ) { + if( !sk2.isEmpty() ) { HbAction *secondary = new HbAction( sk2 ); cQuery->setSecondaryAction( secondary ); } - HbAction* action = cQuery->exec(); - if( action == cQuery->secondaryAction() ){ - ok = false; + + //HbAction* action = cQuery->exec(); + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; } else{ - ok = true; + ok = false; } if( ok ){ //get selected key list. @@ -110,7 +131,7 @@ const QString &title, const QStringList &textList, quint32 &selection, - int dominantIndex ) + int dominantIndex, const QString &associatedDrives ) { bool ret( false ); @@ -137,24 +158,25 @@ } - QString sk1 ( tr( "ok" ) ); - QString sk2 ( tr( "cancel" ) ); + QString sk1 ( hbTrId( "ok" ) ); + QString sk2 ( hbTrId( "cancel" ) ); - if(sk1.isEmpty() == false) { + if( !sk1.isEmpty() ) { HbAction *primary = new HbAction( sk1 ); cQuery->setPrimaryAction( primary ); } - if( sk2.isEmpty() == false ) { + if( !sk2.isEmpty() ) { HbAction *secondary = new HbAction( sk2 ); cQuery->setSecondaryAction( secondary ); } - HbAction* action = cQuery->exec(); - if( action == cQuery->secondaryAction() ){ - ok = false; + + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; } else{ - ok = true; + ok = false; } if( ok ) { @@ -181,7 +203,7 @@ } bool FmDlgUtils::showTimeSettingQuery( - const QString &title, QTime &time ) + const QString &title, QTime &time, const QString &associatedDrives ) { bool ret( false ); bool ok ( false ); // SK return (out parameter) @@ -190,24 +212,25 @@ cQuery->setHeadingWidget( new HbLabel( title ) ); cQuery->setTime( time ); - QString sk1 ( tr( "ok" ) ); - QString sk2 ( tr( "cancel" ) ); + QString sk1 ( hbTrId( "ok" ) ); + QString sk2 ( hbTrId( "cancel" ) ); - if(sk1.isEmpty() == false) { + if( !sk1.isEmpty() ) { HbAction *primary = new HbAction( sk1 ); cQuery->setPrimaryAction( primary ); } - if( sk2.isEmpty() == false ) { + if( !sk2.isEmpty() ) { HbAction *secondary = new HbAction( sk2 ); cQuery->setSecondaryAction( secondary ); } - HbAction* action = cQuery->exec(); - if( action == cQuery->secondaryAction() ){ - ok = false; + + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; } else{ - ok = true; + ok = false; } if( ok ) { @@ -220,42 +243,51 @@ delete cQuery; return ret; } + bool FmDlgUtils::showTextQuery( - const QString& title, QString& driveName ) + const QString& title, QString& text, bool isDimPrimaryActionWhenEmpty, int maxLength, + const QString &associatedDrives ) { bool ret( false ); bool ok ( true ); // SK return (out parameter) - FmSingleTextQuery *cQuery=new FmSingleTextQuery; + FmSingleTextQuery::Options options( 0 ); + if( isDimPrimaryActionWhenEmpty ) { + options = FmSingleTextQuery::DimPrimereActionWhenEmpty; + } + FmSingleTextQuery *cQuery = new FmSingleTextQuery( options ); + if( maxLength != -1 ){ + cQuery->setLineEditMaxLength( maxLength ); + } cQuery->setHeadingWidget( new HbLabel( title ) ); - QString sk1 ( tr ( "ok" ) ); - QString sk2 ( tr ( "cancel" ) ); + QString sk1 ( hbTrId ( "ok" ) ); + QString sk2 ( hbTrId ( "cancel" ) ); - if(sk1.isEmpty() == false) { + if( !sk1.isEmpty() ) { HbAction *primary = new HbAction( sk1 ); cQuery->setPrimaryAction( primary ); } - if( sk2.isEmpty() == false ) { + if( !sk2.isEmpty() ) { HbAction *secondary = new HbAction( sk2 ); cQuery->setSecondaryAction( secondary ); } - cQuery->setLineEditText( driveName ); + cQuery->setLineEditText( text ); cQuery->checkActions(); - HbAction* action = cQuery->exec(); - if( action == cQuery->secondaryAction() ){ - ok = false; + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ok = true; } else{ - ok = true; + ok = false; } if( ok ){ QString newName = cQuery->getLineEditText(); - if ( newName != driveName ){ - driveName = newName; + if ( newName != text ){ + text = newName; ret = true; } } @@ -263,106 +295,77 @@ return ret; } -bool FmDlgUtils::showConfirmPasswordQuery( - const QString &title, const QString &driveName, QString &pwd ) +bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, const QString &associatedDrives ) { bool ret( false ); - bool ok ( true ); // SK return (out parameter) - FmSingleTextQuery *cQuery = new FmSingleTextQuery( HbLineEdit::Password ); + FmSingleTextQuery *cQuery = new FmSingleTextQuery( FmSingleTextQuery::DimPrimereActionWhenEmpty, + HbLineEdit::Password ); cQuery->setHeadingWidget( new HbLabel( title ) ); QString sk1 ( tr ("ok" ) ); QString sk2 ( tr ("cancel" ) ); - if(sk1.isEmpty() == false) { + if( !sk1.isEmpty() ) { HbAction *primary = new HbAction( sk1 ); cQuery->setPrimaryAction( primary ); } - if( sk2.isEmpty() == false ) { + if( !sk2.isEmpty() ) { HbAction *secondary = new HbAction( sk2 ); cQuery->setSecondaryAction( secondary ); } cQuery->checkActions(); - HbAction* action = 0; - - bool pwdOk( false ); - - while( ok && !pwdOk ){ - action = cQuery->exec(); - if( action == cQuery->secondaryAction() ){ - ok = false; - } - else{ - ok = true; - } - if( ok ){ - QString inputPwd = cQuery->getLineEditText(); - if ( FmUtils::setDrivePwd( driveName, inputPwd, inputPwd ) == 0 ){ - pwd = inputPwd; - pwdOk = true; - ret = true; - } - else{ - HbMessageBox::information( tr( "The password is incorrect, try again!" ) ); - } - } + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + ret = true; + pwd = cQuery->getLineEditText(); } + else{ + ret = false; + } + delete cQuery; return ret; } -bool FmDlgUtils::showChangePasswordQuery( - const QString &firstLabel, const QString &secondLabel, QString& newPassword ) +bool FmDlgUtils::showMultiPasswordQuery( + const QString &firstLabel, const QString &secondLabel, QString &pwd, const QString &associatedDrives ) { bool ret( false ); - bool ok ( true ); // SK return (out parameter) FmMultiTextQuery *cQuery = new FmMultiTextQuery( HbLineEdit::Password ); cQuery->setFirstLabelText( firstLabel ); cQuery->setSecondLabelText( secondLabel ); - QString sk1 = ( tr( "ok" ) ); - QString sk2 = ( tr( "cancel" ) ); + QString sk1 = ( hbTrId( "ok" ) ); + QString sk2 = ( hbTrId( "cancel" ) ); - if(sk1.isEmpty() == false) { + if( !sk1.isEmpty() ) { HbAction *primary = new HbAction( sk1 ); cQuery->setPrimaryAction( primary ); } - if( sk2.isEmpty() == false ) { + if( !sk2.isEmpty() ) { HbAction *secondary = new HbAction( sk2 ); cQuery->setSecondaryAction( secondary ); } cQuery->checkActions(); - HbAction* action = 0; - bool pwdOk( false ); - - while( ok && !pwdOk ){ - action = cQuery->exec(); - if( action == cQuery->secondaryAction() ){ - ok = false; + HbAction* action = executeDialog( cQuery, associatedDrives ); + if( action == cQuery->primaryAction() ){ + QString firstPwd = cQuery->getFirstEditText(); + QString secondPwd = cQuery->getSecondEditText(); + if ( firstPwd == secondPwd ){ + pwd = secondPwd; + ret = true; } - else{ - ok = true; - } + } + else{ + ret = false; + } - if( ok ){ - QString firstPwd = cQuery->getFirstEditText(); - QString secondPwd = cQuery->getSecondEditText(); - if ( firstPwd == secondPwd ){ - newPassword = secondPwd; - pwdOk = true; - ret = true; - } - else{ - HbMessageBox::information( tr( "The passwords do not match, try again!" ) ); - } - } - } delete cQuery; return ret; } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmdlgutils.h --- a/filemanager/src/filemanager/src/components/fmdlgutils.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdlgutils.h Mon May 03 12:24:39 2010 +0300 @@ -25,6 +25,9 @@ #include #include +class HbDialog; +class HbAction; + class FmDlgUtils : public QObject { Q_OBJECT @@ -41,7 +44,8 @@ static bool showSingleSettingQuery( const QString &title, const QStringList &textList, - int &selectedIndex ); + int &selectedIndex, + const QString &associatedDrives = QString() ); /** * Shows multi select setting page @@ -56,7 +60,8 @@ const QString &title, const QStringList &textList, quint32 &selection, - int dominantIndex ); + int dominantIndex, + const QString &associatedDrives = QString() ); /** * Shows time setting page @@ -66,20 +71,25 @@ * @return true if selection made, otherwise false */ static bool showTimeSettingQuery( - const QString &title, QTime &time ); + const QString &title, QTime &time, + const QString &associatedDrives = QString() ); static bool showTextQuery( - const QString &title, QString &driveName ); + const QString &title, QString &driveName, bool isDimPrimaryActionWhenEmpty, int maxLength = -1, + const QString &associatedDrives = QString() ); - static bool showConfirmPasswordQuery( - const QString &title, const QString &driveName, QString &pwd ); + static bool showSinglePasswordQuery( + const QString &title, QString &pwd, + const QString &associatedDrives = QString() ); - static bool showChangePasswordQuery( - const QString &firstLabel, const QString &secondLabel, QString &newPassword ); + static bool showMultiPasswordQuery( + const QString &firstLabel, const QString &secondLabel, QString &pwd, + const QString &associatedDrives = QString() ); ~FmDlgUtils(void); private: FmDlgUtils(void); + static HbAction *executeDialog( HbDialog *dialog, const QString &associatedDrives ); }; diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp --- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Mon May 03 12:24:39 2010 +0300 @@ -179,7 +179,6 @@ numofFolders = 0; numofFiles = 0; totalSize = 0; - totalSize = 0; int tempNumofFolders = 0; int tempNumofFiles = 0; diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmmultitextquery.cpp --- a/filemanager/src/filemanager/src/components/fmmultitextquery.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmmultitextquery.cpp Mon May 03 12:24:39 2010 +0300 @@ -25,7 +25,7 @@ #include #include -FmMultiTextQuery::FmMultiTextQuery( HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) :\ +FmMultiTextQuery::FmMultiTextQuery( HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) : HbDialog( parent ), mEchoMode( echoMode ) { init(); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmsingletextquery.cpp --- a/filemanager/src/filemanager/src/components/fmsingletextquery.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmsingletextquery.cpp Mon May 03 12:24:39 2010 +0300 @@ -24,8 +24,9 @@ #include #include -FmSingleTextQuery::FmSingleTextQuery( HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) : - HbDialog( parent ), mEchoMode( echoMode ) +FmSingleTextQuery::FmSingleTextQuery( Options options, + HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) : + HbDialog( parent ), mOptions( options ), mEchoMode( echoMode ) { init(); } @@ -68,11 +69,18 @@ return text; } +void FmSingleTextQuery::setLineEditMaxLength( int length ) +{ + mTextEdit->setMaxLength( length ); +} + void FmSingleTextQuery::checkActions() { - if( !mTextEdit->text().isEmpty() ){ - this->primaryAction()->setEnabled( true ); - } else { - this->primaryAction()->setEnabled( false ); + if( mOptions & DimPrimereActionWhenEmpty ) { + if( !mTextEdit->text().isEmpty() ){ + this->primaryAction()->setEnabled( true ); + } else { + this->primaryAction()->setEnabled( false ); + } } } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmsingletextquery.h --- a/filemanager/src/filemanager/src/components/fmsingletextquery.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmsingletextquery.h Mon May 03 12:24:39 2010 +0300 @@ -28,12 +28,20 @@ { Q_OBJECT public: - FmSingleTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 ); + enum Option + { + DimPrimereActionWhenEmpty = 0x00000001 + }; + Q_DECLARE_FLAGS(Options, Option) + + FmSingleTextQuery( Options options = 0, + HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 ); ~FmSingleTextQuery(); public: void setLineEditText( const QString &text ); QString getLineEditText(); + void setLineEditMaxLength( int length ); public slots: void checkActions(); @@ -44,7 +52,8 @@ private: HbWidget *mContentWidget; HbLineEdit *mTextEdit; + Options mOptions; HbLineEdit::EchoMode mEchoMode; }; - +Q_DECLARE_OPERATORS_FOR_FLAGS(FmSingleTextQuery::Options) #endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp --- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Mon May 03 12:24:39 2010 +0300 @@ -21,6 +21,7 @@ #include "fmviewdetailsitem.h" #include "fmdatalistmodel.h" #include "fmdrivedetailstype.h" +#include "fmviewmanager.h" #include #include @@ -83,7 +84,7 @@ void FmViewDetailsDialog::setDriveDetails( const QString &driverName ) { const QString dataDir = "C:\\data"; - mHeaderLabel->setPlainText( tr( "Memory details: ") ); + mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_memory_details" ) ); quint64 sizeOfOthers = 0; @@ -93,19 +94,17 @@ mDataListModel->removeRows( 0, mDataListModel->rowCount() ); mDataListModel->insertRows( 0, EDriveDetailEntryEnd ); - detailString.append( tr ( "Memory name:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_memory_name" ) ); QVariant variant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryName ), variant, Qt::DisplayRole ); detailString.clear(); - detailString.append( driverInfo.name() ); - detailString.append( " " ); - detailString.append( driverInfo.volumeName() ); + detailString.append( FmUtils::fillDriveVolume( driverInfo.name(), true ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryName ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Size:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_size_memory" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemorySize ), variant, Qt::DisplayRole ); @@ -115,7 +114,7 @@ mDataListModel->setData( mDataListModel->index( EMemorySize ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Free:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_free_memory" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryFree ), variant, Qt::DisplayRole ); @@ -129,7 +128,7 @@ // getContentDetails( dataDir ); detailString.clear(); - detailString.append( tr ( "Images:" ) ); + detailString.append( hbTrId ( "Images:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryImages ), variant, Qt::DisplayRole ); @@ -141,7 +140,7 @@ sizeOfOthers -= mSizeofImage; detailString.clear(); - detailString.append( tr ( "Sounds:" ) ); + detailString.append( hbTrId ( "Sounds:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemorySounds ), variant, Qt::DisplayRole ); @@ -153,7 +152,7 @@ sizeOfOthers -= mSizeofSounds; detailString.clear(); - detailString.append( tr ( "Video:" ) ); + detailString.append( hbTrId ( "Video:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryVideos ), variant, Qt::DisplayRole ); @@ -165,7 +164,7 @@ sizeOfOthers -= mSizeofVideo; detailString.clear(); - detailString.append( tr ( "Java Files:" ) ); + detailString.append( hbTrId ( "Java Files:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryMidpJava ), variant, Qt::DisplayRole ); @@ -177,7 +176,7 @@ sizeOfOthers -= mSizeofJava; detailString.clear(); - detailString.append( tr ( "Sis files:" ) ); + detailString.append( hbTrId ( "Sis files:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryNativeApps ), variant, Qt::DisplayRole ); @@ -189,7 +188,7 @@ sizeOfOthers -= mSizeofNativeFiles; detailString.clear(); - detailString.append( tr ( "Documents:" ) ); + detailString.append( hbTrId ( "Documents:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryDocuments ), variant, Qt::DisplayRole ); @@ -201,7 +200,7 @@ sizeOfOthers -= mSizeofDocument; detailString.clear(); - detailString.append( tr ( "Calendars:" ) ); + detailString.append( hbTrId ( "Calendars:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryCalendar ), variant, Qt::DisplayRole ); @@ -213,7 +212,7 @@ sizeOfOthers -= mSizeofCalendar; detailString.clear(); - detailString.append( tr ( "Others:" ) ); + detailString.append( hbTrId ( "Others:" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EMemoryOthers ), variant, Qt::DisplayRole ); @@ -225,7 +224,7 @@ void FmViewDetailsDialog::setFolderDetails( const QString &folderPath ) { - mHeaderLabel->setPlainText( tr( "Folder details: ") ); + mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_folder_details" ) ); QString detailString( "" ); @@ -234,7 +233,7 @@ mDataListModel->removeRows( 0, mDataListModel->rowCount() ); mDataListModel->insertRows( 0, EFolderDetailEntryEnd ); - detailString.append( tr ( "Name:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_name_folder" ) ); QVariant variant( detailString ); mDataListModel->setData( mDataListModel->index( EFolderName ), variant, Qt::DisplayRole ); @@ -249,7 +248,7 @@ QTime modifiedTime = modifiedDateTime.time(); detailString.clear(); - detailString.append( tr ( "Date:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_date_folder" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EModifiedDate ), variant, Qt::DisplayRole ); @@ -259,7 +258,7 @@ mDataListModel->setData( mDataListModel->index( EModifiedDate ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Time:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_time_folder" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EModifiedTime ), variant, Qt::DisplayRole ); @@ -269,7 +268,7 @@ mDataListModel->setData( mDataListModel->index( EModifiedTime ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Size:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_size_folder" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EFolderSize ), variant, Qt::DisplayRole ); @@ -279,7 +278,7 @@ mDataListModel->setData( mDataListModel->index( EFolderSize ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Subfolders: " ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_subfolders" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( ENumofSubFolders ), variant, Qt::DisplayRole ); @@ -289,7 +288,7 @@ mDataListModel->setData( mDataListModel->index( ENumofSubFolders ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Files: " ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_files" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( ENumofFiles ), variant, Qt::DisplayRole ); @@ -301,7 +300,7 @@ void FmViewDetailsDialog::setFileDetails( const QString &filePath ) { - mHeaderLabel->setPlainText( tr( "File details: ") ); + mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_file_details") ); QString detailString( "" ); @@ -310,7 +309,7 @@ mDataListModel->removeRows( 0, mDataListModel->rowCount() ); mDataListModel->insertRows( 0, EFileDetailEntryEnd ); - detailString.append( tr ( "Name:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_name_file" ) ); QVariant variant( detailString ); mDataListModel->setData( mDataListModel->index( EFileName ), variant, Qt::DisplayRole ); @@ -320,7 +319,7 @@ mDataListModel->setData( mDataListModel->index( EFileName ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Type:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_type_file" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EFileType ), variant, Qt::DisplayRole ); @@ -340,7 +339,7 @@ QTime modifiedTime = modifiedDateTime.time(); detailString.clear(); - detailString.append( tr ( "Date:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_date_file" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EFileModifiedDate ), variant, Qt::DisplayRole ); @@ -350,7 +349,7 @@ mDataListModel->setData( mDataListModel->index( EFileModifiedDate ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Time:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_time_file" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EFileModifiedTime ), variant, Qt::DisplayRole ); @@ -360,7 +359,7 @@ mDataListModel->setData( mDataListModel->index( EFileModifiedTime ), variant, Qt::UserRole ); detailString.clear(); - detailString.append( tr ( "Size:" ) ); + detailString.append( hbTrId ( "txt_fmgr_dblist_size_file" ) ); variant = QVariant( detailString ); mDataListModel->setData( mDataListModel->index( EFileSize ), variant, Qt::DisplayRole ); @@ -438,32 +437,57 @@ } } +HbAction *FmViewDetailsDialog::executeDialog( HbDialog *dialog, const QString &associatedDrives ) +{ + for( int i = 0; i < associatedDrives.length(); i++ ) { + QString drive( associatedDrives[i] + QString( ":/" ) ); + if( !FmUtils::isDriveAvailable( drive ) ) { + FmLogger::log( "executeDialog return 0_ " + associatedDrives ); + return 0; + } + } + + FmDlgCloseUnit dlgCloseUnit( dialog ); + dlgCloseUnit.addAssociatedDrives( associatedDrives ); + + FmViewManager::viewManager()->addDlgCloseUnit( &dlgCloseUnit ); + FmLogger::log( " Exec Dialog start " ); + HbAction* action = dialog->exec(); + FmLogger::log( " Exec Dialog end " ); + FmViewManager::viewManager()->removeDlgCloseUnit( &dlgCloseUnit ); + return action; +} + void FmViewDetailsDialog::showDriveViewDetailsDialog( const QString &driverName, - QList detailsSizeList ) + QList detailsSizeList, const QString& associatedDrives ) { + FmLogger::log( "showDriveViewDetailsDialog_" + associatedDrives ); FmViewDetailsDialog viewDetailsDialog; viewDetailsDialog.setSizeofContent( detailsSizeList ); viewDetailsDialog.setDriveDetails( driverName ); - viewDetailsDialog.exec(); + //viewDetailsDialog.exec(); + executeDialog( &viewDetailsDialog , associatedDrives ); } void FmViewDetailsDialog::showFolderViewDetailsDialog( const QString &folderPath, - int numofSubFolders, int numofFiles, quint64 sizeofFolder ) + int numofSubFolders, int numofFiles, quint64 sizeofFolder, const QString& associatedDrives ) { FmViewDetailsDialog viewDetailsDialog; viewDetailsDialog.setNumofSubfolders( numofSubFolders, numofFiles, sizeofFolder ); viewDetailsDialog.setFolderDetails( folderPath ); - viewDetailsDialog.exec(); + //viewDetailsDialog.exec(); + executeDialog( &viewDetailsDialog , associatedDrives ); } -void FmViewDetailsDialog::showFileViewDetailsDialog( const QString &filePath ) +void FmViewDetailsDialog::showFileViewDetailsDialog( const QString &filePath, const QString& associatedDrives ) { FmViewDetailsDialog viewDetailsDialog; viewDetailsDialog.setFileDetails( filePath ); - viewDetailsDialog.exec(); + //viewDetailsDialog.exec(); + executeDialog( &viewDetailsDialog , associatedDrives ); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/components/fmviewdetailsdialog.h --- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Mon May 03 12:24:39 2010 +0300 @@ -73,11 +73,12 @@ virtual ~FmViewDetailsDialog(); static void showDriveViewDetailsDialog( const QString &driverName, - QList detailsSizeList ); + QList detailsSizeList, + const QString& associatedDrives = QString() ); static void showFolderViewDetailsDialog( const QString &folderPath, int numofSubFolders, int numofFiles, - quint64 sizeofFolder); - static void showFileViewDetailsDialog( const QString &filePath ); + quint64 sizeofFolder, const QString& associatedDrives = QString() ); + static void showFileViewDetailsDialog( const QString &filePath, const QString& associatedDrives = QString() ); private: FmViewDetailsDialog( QGraphicsItem *parent = 0 ); @@ -89,6 +90,7 @@ void setNumofSubfolders( int numofSubFolders, int numofFiles, quint64 sizeofFolder ); void setSizeofContent( QList detailsSizeList ); + static HbAction *executeDialog( HbDialog *dialog, const QString &associatedDrives ); private: HbListView *mListView; HbLabel *mHeaderLabel; diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdriverlistwidget.cpp --- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Mon May 03 12:24:39 2010 +0300 @@ -110,15 +110,16 @@ HbMenu *contextMenu = new HbMenu(); mCurrentItem = item; - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); + FmDriverInfo::DriveState state = driverInfo.driveState(); - quint32 state = FmUtils::getDriverState( diskName ); - FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); - - if( !( state & FmDriverInfo::EDriveNotPresent ) ) { + if( !( state & FmDriverInfo::EDriveNotPresent ) && !( state & FmDriverInfo::EDriveLocked ) && + !( state & FmDriverInfo::EDriveCorrupted ) ) { HbAction *viewAction = new HbAction(); viewAction->setObjectName( "viewAction" ); - viewAction->setText( tr( "View details" ) ); + viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_memory" ) ); contextMenu->addAction( viewAction ); //state = 0x210; @@ -127,13 +128,12 @@ this, SLOT( on_viewAction_triggered() ) ); } - HbMenu *subMenu = new HbMenu( "Memory name" ); if( ( state & FmDriverInfo::EDriveRemovable ) && !( state & FmDriverInfo::EDriveMassStorage ) ){ if ( driverInfo.volumeName().length() ){ HbAction *renameAction = new HbAction(); renameAction->setObjectName( "renameAction" ); - renameAction->setText( tr( "Rename" ) ); - subMenu->addAction( renameAction ); + renameAction->setText( hbTrId( "txt_fmgr_menu_rename" ) ); + contextMenu->addAction( renameAction ); connect( renameAction, SIGNAL( triggered() ), this, SLOT( on_renameAction_triggered() ) ); @@ -141,25 +141,23 @@ else{ HbAction *nameAction = new HbAction(); nameAction->setObjectName( "nameAction" ); - nameAction->setText( tr( "Name" ) ); - subMenu->addAction( nameAction ); + nameAction->setText( hbTrId( "txt_fmgr_menu_name" ) ); + contextMenu->addAction( nameAction ); connect( nameAction, SIGNAL( triggered() ), this, SLOT( on_nameAction_triggered() ) ); } - contextMenu->addMenu( subMenu ); - subMenu = new HbMenu( "Memory password" ); if( state & FmDriverInfo::EDrivePasswordProtected ){ HbAction *changePwdAction = new HbAction(); changePwdAction->setObjectName( "changePwdAction" ); - changePwdAction->setText( tr( "Change Password" ) ); - subMenu->addAction( changePwdAction ); + changePwdAction->setText( hbTrId( "txt_fmgr_menu_change_password" ) ); + contextMenu->addAction( changePwdAction ); HbAction *removePwdAction = new HbAction(); removePwdAction->setObjectName( "removePwdAction" ); - removePwdAction->setText( tr( "Remove Password" ) ); - subMenu->addAction( removePwdAction ); + removePwdAction->setText( hbTrId( "txt_fmgr_menu_remove_password" ) ); + contextMenu->addAction( removePwdAction ); connect( changePwdAction, SIGNAL( triggered() ), this, SLOT( on_changePwdAction_triggered() ) ); @@ -169,18 +167,17 @@ else{ HbAction *setPwdAction = new HbAction(); setPwdAction->setObjectName( "setPwdAction" ); - setPwdAction->setText( tr( "Set Password" ) ); - subMenu->addAction( setPwdAction ); + setPwdAction->setText( hbTrId( "txt_fmgr_menu_set_password" ) ); + contextMenu->addAction( setPwdAction ); connect( setPwdAction, SIGNAL( triggered() ), this, SLOT( on_setPwdAction_triggered() ) ); } - contextMenu->addMenu( subMenu ); if( state & FmDriverInfo::EDriveEjectable ){ HbAction *ejectAction = new HbAction(); ejectAction->setObjectName( "ejectAction" ); - ejectAction->setText( tr( "Eject" ) ); + ejectAction->setText( hbTrId( "txt_fmgr_menu_eject" ) ); contextMenu->addAction( ejectAction ); connect( ejectAction, SIGNAL( triggered() ), @@ -188,12 +185,13 @@ } } #ifndef _DEBUG_ENABLE_FORMATMENU_ - if ( state & FmDriverInfo::EDriveRemovable ){ - if( state & FmDriverInfo::EDriveFormattable ){ +if ( ( state & FmDriverInfo::EDriveRemovable ) || ( state & FmDriverInfo::EDriveCorrupted ) + || ( state & FmDriverInfo::EDriveLocked ) ){ + if( !( state & FmDriverInfo::EDriveNotPresent ) ){ #endif HbAction *formatAction = new HbAction(); formatAction->setObjectName( "formatAction" ); - formatAction->setText( tr( "Format" ) ); + formatAction->setText( hbTrId( "txt_fmgr_menu_format" ) ); contextMenu->addAction( formatAction ); connect( formatAction, SIGNAL( triggered() ), @@ -206,7 +204,7 @@ if( state & FmDriverInfo::EDriveLocked ){ HbAction *unLockedAction = new HbAction(); unLockedAction->setObjectName( "unLockedAction" ); - unLockedAction->setText( tr( "Unlock" ) ); + unLockedAction->setText( hbTrId( "Unlock" ) ); contextMenu->addAction( unLockedAction ); connect( unLockedAction, SIGNAL( triggered() ), @@ -218,33 +216,37 @@ void FmDriverListWidget::on_viewAction_triggered() { - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); mOperationService->asyncViewDriveDetails( diskName ); } void FmDriverListWidget::on_renameAction_triggered() { - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); - - quint32 state = FmUtils::getDriverState( diskName ); + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + FmDriverInfo::DriveState state = FmUtils::queryDriverInfo( diskName ).driveState(); FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); if ( state & FmDriverInfo::EDriveWriteProtected ){ - HbMessageBox::information( tr( "Unable to perform operation. Memory card is read only." ) ); + HbMessageBox::information( hbTrId( "Unable to perform operation. Memory card is read only." ) ); return; } QString title( tr( "Drive name ") ); QString volumeName = driverInfo.volumeName(); - if( FmDlgUtils::showTextQuery( title, volumeName ) ){ - - if ( FmUtils::renameDrive( diskName, volumeName ) == 0 ){ - HbMessageBox::information( tr( "The name has been changed!" ) ); - mModel->refresh(); - } - else{ - HbMessageBox::information( tr( "Error occurred, operation cancelled!" ) ); + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + while( FmDlgUtils::showTextQuery( title, volumeName, false, FmMaxLengthofDriveName, associatedDrives ) ){ + int err = FmUtils::renameDrive( diskName, volumeName ); + if ( err == FmErrNone ){ + HbMessageBox::information( hbTrId( "The name has been changed!" ) ); + mModel->refresh(); + break; + } else if( err == FmErrBadName ) { + HbMessageBox::information( hbTrId( "Illegal characters! Use only letters and numbers." ) ); + } else{ + HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) ); + break; } } } @@ -254,110 +256,134 @@ on_renameAction_triggered(); } -void FmDriverListWidget::on_changePwdAction_triggered() +void FmDriverListWidget::on_setPwdAction_triggered() { - QString title( tr( "Password: ") ); - QString firstLabel( tr( "New Password: ") ); - QString secondLabel( tr( "Confirm new Password: ") ); + QString firstLabel( hbTrId( "New Password: ") ); + QString secondLabel( hbTrId( "Confirm new Password: ") ); QString oldPwd; QString newPwd; - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); + FmUtils::emptyPwd( oldPwd ); + + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd, associatedDrives ) ) { + if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){ + HbMessageBox::information( hbTrId( "The password has been set!" ) ); + } + else{ + HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) ); + } + } +} + +void FmDriverListWidget::on_changePwdAction_triggered() +{ + QString title( hbTrId( "Password: ") ); + QString firstLabel( hbTrId( "New Password: ") ); + QString secondLabel( hbTrId( "Confirm new Password: ") ); - if( FmDlgUtils::showConfirmPasswordQuery( title, diskName, oldPwd ) ){ - if( FmDlgUtils::showChangePasswordQuery( firstLabel, secondLabel, newPwd ) ){ - if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){ - HbMessageBox::information( tr( "The password has been changed!" ) ); + QString oldPwd; + QString newPwd; + + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, associatedDrives ) ) { + if ( FmUtils::checkDrivePwd( diskName, oldPwd ) == 0 ){ + if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd ) ){ + if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){ + HbMessageBox::information( hbTrId( "The password has been changed!" ) ); + } else { + HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) ); + } + break; + } else { + //cancel muti password query + break; } - else{ - HbMessageBox::information( tr( "Error occurred, operation cancelled!" ) ); - } - } + } else { + HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) ); + } + } } void FmDriverListWidget::on_removePwdAction_triggered() { - QString title( tr( "Password: ") ); + QString title( hbTrId( "Password: ") ); QString oldPwd; - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); //QString password( tr( "a ") ); if( HbMessageBox::question( tr( "Do you want to remove the password? Memory card becomes unlocked." ) ) ){ - if( FmDlgUtils::showConfirmPasswordQuery( title, diskName, oldPwd ) ){ - - if ( FmUtils::removeDrivePwd( diskName, oldPwd ) == 0 ){ - HbMessageBox::information( tr( "The password has been removed!" ) ); + QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); + while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, associatedDrives ) ) { + if ( FmUtils::checkDrivePwd( diskName, oldPwd ) == 0 ) { + if ( FmUtils::removeDrivePwd( diskName, oldPwd ) == 0 ){ + HbMessageBox::information( hbTrId( "The password has been removed!" ) ); + } + else{ + HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) ); + } + break; } - else{ - HbMessageBox::information( tr( "Error occurred, operation cancelled!" ) ); + else { + HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) ); } + } } } void FmDriverListWidget::on_unLockedAction_triggered() { - QString title( tr( "Password: ") ); + QString title( hbTrId( "Password: ") ); QString oldPwd; - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); - if( FmDlgUtils::showConfirmPasswordQuery( title, diskName, oldPwd ) ){ - - if ( FmUtils::unlockDrive( diskName, oldPwd ) == 0 ){ - HbMessageBox::information( tr( "The memory is unlocked!" ) ); - } - else{ - HbMessageBox::information( tr( "Error occurred, operation cancelled!" ) ); - } - } -} - -void FmDriverListWidget::on_setPwdAction_triggered() -{ - QString firstLabel( tr( "New Password: ") ); - QString secondLabel( tr( "Confirm new Password: ") ); - - QString oldPwd; - QString newPwd; - - FmUtils::emptyPwd( oldPwd ); - - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); - - if( FmDlgUtils::showChangePasswordQuery( firstLabel, secondLabel, newPwd ) ){ - if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){ - HbMessageBox::information( tr( "The password has been set!" ) ); - } - else{ - HbMessageBox::information( tr( "Error occurred, operation cancelled!" ) ); + //Do not add associatedDrives as Locked MMC is not available Drive but only present Drive + while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd ) ) { + int err = FmUtils::unlockDrive( diskName, oldPwd ); + if( err == FmErrNone ) { + HbMessageBox::information( hbTrId( "The memory is unlocked!" ) ); + break; + } else if ( err == FmErrAccessDenied ) { + HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) ); + } else if (err == FmErrAlreadyExists ) { + HbMessageBox::information( hbTrId( "The disk has already been unlocked!" ) ); + break; + } else if( err == FmErrNotSupported ) { + HbMessageBox::information( hbTrId( "The media does not support password locking!" ) ); + break; + } else { + HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) ); + break; } } } void FmDriverListWidget::on_formatAction_triggered() { - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); - - if( HbMessageBox::question( tr( "Format? Data will be deleted during formatting." ) ) ){ + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + if( HbMessageBox::question( hbTrId( "Format? Data will be deleted during formatting." ) ) ){ if( FmErrNone != mOperationService->asyncFormat( diskName ) ) - HbMessageBox::information( tr( "Formatting failed." ) ); + HbMessageBox::information( hbTrId( "Formatting failed." ) ); } - } void FmDriverListWidget::on_ejectAction_triggered() { - QString diskName = mCurrentItem->modelIndex().data( Qt::DisplayRole ).toString(); - - if( HbMessageBox::question( tr( "Eject memory card? Some applications will be closed." ) ) ){ - if( !FmUtils::ejectDrive( diskName ) ){ - HbMessageBox::information( tr( "Error occurred, operation cancelled!") ); - } + QString diskName = mModel->driveName( mCurrentItem->modelIndex() ); + + if( HbMessageBox::question( hbTrId( "Eject memory card? Some applications will be closed." ) ) ){ + FmUtils::ejectDrive( diskName ); } } @@ -376,7 +402,7 @@ void FmDriverListWidget::on_searchPanel_searchOptionsClicked() { - mFindTargetPath = FmFileDialog::getExistingDirectory( 0, tr( "Look in:" ), + mFindTargetPath = FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""), QStringList() ); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdriverview.cpp --- a/filemanager/src/filemanager/src/fmdriverview.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverview.cpp Mon May 03 12:24:39 2010 +0300 @@ -35,6 +35,7 @@ initMenu(); initToolBar(); initDiskListWidget(); + QMetaObject::connectSlotsByName( this ); } @@ -50,28 +51,28 @@ #ifdef FM_CHANGE_ORIENT_ENABLE action = new HbAction( this ); action->setObjectName( "rotateAction" ); - action->setText( tr( "Change orientation" ) ); + action->setText( hbTrId( "Change orientation" ) ); menu()->addAction( action ); #endif action = new HbAction( this ); action->setObjectName( "findAction" ); - action->setText( tr( "Find" ) ); + action->setText( hbTrId( "txt_fmgr_opt_find" ) ); menu()->addAction( action ); action = new HbAction( this ); action->setObjectName( "backupAction" ); - action->setText( tr( "Backup" ) ); + action->setText( hbTrId( "txt_fmgr_opt_backup" ) ); menu()->addAction( action ); action = new HbAction( this ); action->setObjectName( "restoreAction" ); - action->setText( tr( "Restore" ) ); + action->setText( hbTrId( "txt_fmgr_opt_restore" ) ); menu()->addAction( action ); action = new HbAction( this ); action->setObjectName( "exitAction" ); - action->setText( tr( "Exit" ) ); + action->setText( hbTrId( "Exit" ) ); menu()->addAction( action ); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/fmdrivewatcher.cpp --- a/filemanager/src/filemanager/src/fmdrivewatcher/fmdrivewatcher.cpp Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* 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: -* The source file of drive watcher -*/ - -#include "fmdrivewatcher.h" - -#include "fmdrivewatcherprivate.h" - -FmDriveWatcher::FmDriveWatcher( QObject *parent ) : QObject( parent ) -{ - d = new FmDriveWatcherPrivate( this ); - connect( d, SIGNAL(driveAddedOrChanged()), this, SLOT( onDriveAddedOrChanged() )); -} - -FmDriveWatcher::~FmDriveWatcher() -{ - delete d; -} - - -void FmDriveWatcher::startWatch() -{ - d->startWatch(); -} -void FmDriveWatcher::cancelWatch() -{ - d->cancelWatch(); -} - -void FmDriveWatcher::onDriveAddedOrChanged() -{ - emit driveAddedOrChanged(); -} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/fmdrivewatcher.h --- a/filemanager/src/filemanager/src/fmdrivewatcher/fmdrivewatcher.h Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* 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: -* The header file of drive watcher -*/ - -#ifndef FMDRIVEWATCHER_H -#define FMDRIVEWATCHER_H - -#include - -class FmDriveWatcherPrivate; - -class FmDriveWatcher : public QObject -{ -Q_OBJECT -public: - FmDriveWatcher( QObject *parent = 0 ); - virtual ~FmDriveWatcher(); - void startWatch(); - void cancelWatch(); - -signals: - void driveAddedOrChanged(); -private slots: - void onDriveAddedOrChanged(); -private: - FmDriveWatcherPrivate *d; -}; - - -#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdriveevent.cpp --- a/filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdriveevent.cpp Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* -* 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: -* The source file of drive event watcher -*/ - - -// INCLUDE FILES -#include -#include "fmdriveevent.h" -#include "fmcommon.h" - -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CFileManagerFileSystemEvent::CFileManagerFileSystemEvent -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// - -CFmDriveEvent::CFmDriveEvent( - RFs& aFs, - MFmDriveEventObserver *aObserver ) : - CActive( CActive::EPriorityLow ), - iFs( aFs ), - iObserver( aObserver ) - { - } - -// ----------------------------------------------------------------------------- -// CFmDriveEvent::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CFmDriveEvent::ConstructL() - { - CActiveScheduler::Add( this ); - } - -// ----------------------------------------------------------------------------- -// CFmDriveEvent::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CFmDriveEvent* CFmDriveEvent::NewL( - RFs& aFs, - MFmDriveEventObserver *aObserver ) - { - CFmDriveEvent* self = - new( ELeave ) CFmDriveEvent( - aFs, - aObserver ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ------------------------------------------------------------------------------ -// CFmDriveEvent::~CFmDriveEvent -// -// ------------------------------------------------------------------------------ -CFmDriveEvent::~CFmDriveEvent() - { - Cancel(); - } - -// ----------------------------------------------------------------------------- -// CFmDriveEvent::RunError -// From CActive. Called when error occurred in asynchronous request -// Notifies the observer -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt CFmDriveEvent::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CFmDriveEvent::DoCancel -// From CActive. Called when asynchronous request is canceled -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CFmDriveEvent::DoCancel() - { - iFs.NotifyChangeCancel( iStatus ); - } - -// ------------------------------------------------------------------------------ -// CFmDriveEvent::Setup -// -// ------------------------------------------------------------------------------ -// -void CFmDriveEvent::Setup() - { - FmLogger::log( QString( "CFmDriveEvent::Setup start" ) ); - if( IsActive() ) - { - return; - } - - iFs.NotifyChange( ENotifyDisk, iStatus ); - SetActive(); - FmLogger::log( QString( "CFmDriveEvent::Setup end" ) ); - } - -// ----------------------------------------------------------------------------- -// CFmDriveEvent::RunL -// From CActive. Called when asynchronous request is completed. -// Notifies the observer -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void CFmDriveEvent::RunL() - { - if( iStatus == KErrNone ){ - if( iObserver ){ - iObserver->OnDriveAddedOrChangedL(); - } - - Setup(); - } - - /* - CAknInformationNote* informationNote; - informationNote = new ( ELeave ) CAknInformationNote; - informationNote->ExecuteLD( _L( "driveChanged!")); - */ - } - -// End of File diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdriveevent.h --- a/filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdriveevent.h Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* 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: -* The header file of drive event watcher -*/ - -#ifndef CFMDRIVEEVENT_H -#define CFMDRIVEEVENT_H - - -// INCLUDES -#include -#include - -class MFmDriveEventObserver - { - public: - virtual void OnDriveAddedOrChangedL() = 0; - }; -// CLASS DECLARATION - -/** -* This class listens file system events -* -* @lib FileManagerEngine.lib -* @since 2.0 -*/ -NONSHARABLE_CLASS(CFmDriveEvent) : public CActive - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CFmDriveEvent* NewL( RFs& aFs, MFmDriveEventObserver* aObserver ); - - /** - * Destructor. - */ - virtual ~CFmDriveEvent(); - - public: - - /** - * Sets file system event - * @since 2.0 - */ - void Setup(); - - protected: // Functions from base classes - - /** - * From CActive Called when asynchronous request has completed - * @since 2.0 - */ - void RunL(); - - /** - * From CActive Called when asynchronous request has failed - * @since 2.0 - */ - TInt RunError( TInt aError ); - - /** - * From CActive Called when asynchronous request was cancelled - * @since 2.0 - */ - void DoCancel(); - - private: - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * C++ default constructor. - */ - CFmDriveEvent( RFs& aFs, MFmDriveEventObserver* aObserver ); - - private: // Data - // Ref: Reference to opened File System session - RFs& iFs; - - // Ref: This object is called when RunL occurs - MFmDriveEventObserver *iObserver; - }; - -#endif // CFMDRIVEEVENT_H - -// End of File diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp --- a/filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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: -* The source file of drive event watcher private -*/ - -#include "fmdrivewatcherprivate.h" - -#include "fmdrivewatcher.h" -#include "fmcommon.h" - -FmDriveWatcherPrivate::FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ) : - q( driveWatcher ) -{ - fs.Connect(); - mDriveEvent = CFmDriveEvent::NewL( fs, this ); -} - -FmDriveWatcherPrivate::~FmDriveWatcherPrivate() -{ - fs.Close(); - delete mDriveEvent; -} - - -void FmDriveWatcherPrivate::startWatch() -{ - mDriveEvent->Setup(); -} - -void FmDriveWatcherPrivate::cancelWatch() -{ - mDriveEvent->Cancel(); -} - -void FmDriveWatcherPrivate::OnDriveAddedOrChangedL() -{ - FmLogger::log( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL start" ) ); - emit driveAddedOrChanged(); - FmLogger::log( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL end" ) ); -} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h --- a/filemanager/src/filemanager/src/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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: -* The header file of drive event watcher private -*/ - -#ifndef FMDRIVEWATCHERPRIVATE_H -#define FMDRIVEWATCHERPRIVATE_H - -#include - -#include "fmdriveevent.h" - -#include - -class FmDriveWatcher; - -class FmDriveWatcherPrivate : public QObject, public MFmDriveEventObserver -{ -Q_OBJECT -public: - FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ); - virtual ~FmDriveWatcherPrivate(); - - void startWatch(); - void cancelWatch(); - - void onDriveAdded(); - void onDriveRemoved(); - - void OnDriveAddedOrChangedL(); -signals: - void driveAddedOrChanged(); - -private: - FmDriveWatcher *q; - CFmDriveEvent *mDriveEvent; - RFs fs; -}; - -#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp --- a/filemanager/src/filemanager/src/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* 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: -* The source file of drive event watcher private -*/ - -#include "fmdrivewatcherprivate.h" - -#include "fmdrivewatcher.h" - -FmDriveWatcherPrivate::FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ) : - q( driveWatcher ) -{ -} - -FmDriveWatcherPrivate::~FmDriveWatcherPrivate() -{ -} - - -void FmDriveWatcherPrivate::startWatch() -{ - -} - -void FmDriveWatcherPrivate::cancelWatch() -{ - -} - -void FmDriveWatcherPrivate::onDriveAdded() -{ - -} -void FmDriveWatcherPrivate::onDriveRemoved() -{ - -} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h --- a/filemanager/src/filemanager/src/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h Fri Apr 16 14:53:38 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* 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: -* The header file of drive event watcher private -*/ - -#ifndef FMDRIVEWATCHERPRIVATE_H -#define FMDRIVEWATCHERPRIVATE_H - -#include - -class FmDriveWatcher; - -class FmDriveWatcherPrivate : public QObject -{ -Q_OBJECT -public: - FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ); - virtual ~FmDriveWatcherPrivate(); - - void startWatch(); - void cancelWatch(); - - void onDriveAdded(); - void onDriveRemoved(); - -signals: - void driveAddedOrChanged(); - -private: - FmDriveWatcher *q; -}; - -#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfilebrowsewidget.cpp --- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Mon May 03 12:24:39 2010 +0300 @@ -37,6 +37,7 @@ #include #include #include +#include FmFileBrowseWidget::FmFileBrowseWidget( HbWidget *parent, FmFileBrowseWidget::Style style ) : HbWidget( parent ), @@ -46,15 +47,16 @@ mModel( 0 ), mSelectable( false ), mStyle( NoStyle ), + mFileBrowseStyle( style ), mCurrentItem( 0 ), mOperationService( 0 ), mSearchPanel( 0 ) - { initFileModel(); initListView(); initTreeView(); initSearchPanel(); + initEmptyTipsLabel(); initLayout(); mOperationService = FmViewManager::viewManager()->operationService(); @@ -68,10 +70,14 @@ //since there is a thread running in background //if the model destroy later, the thread might not quit properly. - QFileInfo oldFileInfo = mModel->fileInfo( mListView->rootIndex() ); - FmViewManager *viewManager = FmViewManager::viewManager(); - if( viewManager ) { - viewManager->removeWatchPath( oldFileInfo.absoluteFilePath() ); + if( mStyle == ListStyle || mStyle == TreeStyle ) { + QFileInfo oldFileInfo = mModel->fileInfo( mListView->rootIndex() ); + if( oldFileInfo.exists() ) { + FmViewManager *viewManager = FmViewManager::viewManager(); + if( viewManager ) { + viewManager->removeWatchPath( oldFileInfo.absoluteFilePath() ); + } + } } mTreeView->setModel( 0 ); @@ -117,35 +123,19 @@ QString logString = "FmFileBrowseWidget::setRootPath(" + pathName + ')'; FmLogger::log( logString ); - QModelIndex modelIndex = mModel->index( pathName ); - bool i = QFileInfo(pathName).exists(); - QString string2; - if( i ) - { - string2 = QString( "true" ) ; - } - else - { - string2 = QString( "false" ) ; - } - - logString = "FmFileBrowseWidget::setRootPath exists(" + string2 + ')'; - FmLogger::log( logString ); - - mModel->refresh(modelIndex); - QString string = mModel->fileName( modelIndex ); - logString = "FmFileBrowseWidget::setRootPath:filename(" + string + ')'; - FmLogger::log( logString ); - - string = mModel->filePath( modelIndex ); - logString = "FmFileBrowseWidget::setRootPath:filepath(" + string + ')'; - FmLogger::log( logString ); - - - FmViewManager::viewManager()->addWatchPath( pathName ); - - mListView->setRootIndex( mModel->index( pathName ) ); - mTreeView->setRootIndex( mModel->index( pathName ) ); + if( checkPathAndSetStyle( pathName ) ) { + mListView->setModel(0); + mTreeView->setModel(0); + delete mModel; + mModel = new QDirModel(this); + mListView->setModel(mModel); + mTreeView->setModel(mModel); + + mListView->setRootIndex( mModel->index( pathName ) ); + mTreeView->setRootIndex( mModel->index( pathName ) ); + FmViewManager::viewManager()->addWatchPath( pathName ); + } + mCurrentDrive = pathName.left( 3 ); } void FmFileBrowseWidget::setStyle( FmFileBrowseWidget::Style style ) @@ -160,14 +150,22 @@ } else if ( mStyle == TreeStyle ) { mLayout->removeItem( mTreeView ); mTreeView->hide(); - } + } else if( mStyle == LabelStyle ){ + mLayout->removeItem( mEmptyTipLabel ); + mEmptyTipLabel->hide(); + } if ( style == ListStyle ) { mLayout->addItem( mListView ); mListView->show(); + mFileBrowseStyle = ListStyle; } else if ( style == TreeStyle ) { mLayout->addItem( mTreeView ); mTreeView->show(); + mFileBrowseStyle = TreeStyle; + } else if ( style == LabelStyle ){ + mLayout->addItem( mEmptyTipLabel ); + mEmptyTipLabel->show(); } mStyle = style; @@ -199,7 +197,10 @@ selectionModel = mTreeView->selectionModel(); } - selectionModel->clear(); + if( selectionModel ){ + selectionModel->clear(); + } + } @@ -262,7 +263,7 @@ HbAction *viewAction = new HbAction(); viewAction->setObjectName( "viewAction" ); - viewAction->setText( tr( "View details" ) ); + viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_file" ) ); contextMenu->addAction( viewAction ); connect( viewAction, SIGNAL( triggered() ), @@ -271,47 +272,55 @@ //copy HbAction *copyAction = new HbAction(); copyAction->setObjectName( "copyAction" ); - copyAction->setText( tr( "Copy" ) ); + copyAction->setText( hbTrId( "txt_fmgr_menu_copy" ) ); contextMenu->addAction( copyAction ); connect( copyAction, SIGNAL( triggered() ), this, SLOT( on_copyAction_triggered() ) ); - //Move - HbAction *moveAction = new HbAction(); - moveAction->setObjectName( "moveAction" ); - moveAction->setText( tr( "Move" ) ); - contextMenu->addAction( moveAction ); - - connect( moveAction, SIGNAL( triggered() ), - this, SLOT( on_moveAction_triggered() ) ); - - //Delete - HbAction *deleteAction = new HbAction(); - deleteAction->setObjectName( "deleteAction" ); - deleteAction->setText( tr( "Delete" ) ); - contextMenu->addAction( deleteAction ); - - connect( deleteAction, SIGNAL( triggered() ), - this, SLOT( on_deleteAction_triggered() ) ); - - //rename - HbAction *renameAction = new HbAction(); - renameAction->setObjectName( "renameAction" ); - renameAction->setText( tr( "Rename" ) ); - contextMenu->addAction( renameAction ); - - connect( renameAction, SIGNAL( triggered() ), - this, SLOT( on_renameAction_triggered() ) ); + + QString filePath( mModel->filePath( item->modelIndex() ) ); + QString formatFilePath( FmUtils::formatPath( filePath ) ); + QFileInfo fileInfo( filePath ); + + if( ( fileInfo.isFile() ) || ( fileInfo.isDir() && !( FmUtils::isDefaultFolder( formatFilePath ) ) ) ){ + //Move + HbAction *moveAction = new HbAction(); + moveAction->setObjectName( "moveAction" ); + moveAction->setText( hbTrId( "txt_fmgr_menu_move" ) ); + contextMenu->addAction( moveAction ); + + connect( moveAction, SIGNAL( triggered() ), + this, SLOT( on_moveAction_triggered() ) ); + + //Delete + HbAction *deleteAction = new HbAction(); + deleteAction->setObjectName( "deleteAction" ); + deleteAction->setText( hbTrId( "txt_fmgr_menu_delete" ) ); + contextMenu->addAction( deleteAction ); -//remove send action as it can not be used -// HbAction *sendAction = new HbAction(); -// sendAction->setObjectName( "sendAction" ); -// sendAction->setText( tr( "Send" ) ); -// contextMenu->addAction( sendAction ); -// -// connect( sendAction, SIGNAL( triggered() ), -// this, SLOT( on_sendAction_triggered() ) ); + connect( deleteAction, SIGNAL( triggered() ), + this, SLOT( on_deleteAction_triggered() ) ); + + //rename + HbAction *renameAction = new HbAction(); + renameAction->setObjectName( "renameAction" ); + renameAction->setText( hbTrId( "txt_fmgr_menu_rename" ) ); + contextMenu->addAction( renameAction ); + + connect( renameAction, SIGNAL( triggered() ), + this, SLOT( on_renameAction_triggered() ) ); + } + +// if( fileInfo.isFile() ){ +// HbAction *sendAction = new HbAction(); +// sendAction->setObjectName( "sendAction" ); +// sendAction->setText( hbTrId( "txt_fmgr_menu_send" ) ); +// contextMenu->addAction( sendAction ); +// +// connect( sendAction, SIGNAL( triggered() ), +// this, SLOT( on_sendAction_triggered() ) ); +// } contextMenu->exec( coords ); } @@ -397,6 +406,13 @@ this, SLOT( on_searchPanel_exitClicked() ) ); } +void FmFileBrowseWidget::initEmptyTipsLabel() +{ + mEmptyTipLabel = new HbLabel( this ); + mEmptyTipLabel->setObjectName( "searchPanel" ); + mEmptyTipLabel->hide(); +} + void FmFileBrowseWidget::changeRootIndex( const QModelIndex &index ) { @@ -437,11 +453,59 @@ void FmFileBrowseWidget::refreshModel( const QString& path ) { - if( !path.isEmpty() ) { - mModel->refresh( mModel->index( path ) ); + QString currPath( currentPath().absoluteFilePath() ); + QString refreshPath( path ); + + if( !currPath.isEmpty() ) { + if( refreshPath.isEmpty() ) { + refreshPath = currPath; + } + if( !FmUtils::isPathEqual( refreshPath, currPath ) ) { + // no need refresh other path + return; + } + if( checkPathAndSetStyle( refreshPath ) ) { + mModel->refresh( mModel->index( refreshPath ) ); + } else { + FmViewManager *viewManager = FmViewManager::viewManager(); + if( viewManager ) { + viewManager->removeWatchPath( currentPath().absoluteFilePath() ); + } + } + } else { + // current path is empty, so change root path to Drive root. + refreshPath = mCurrentDrive; + setRootPath( refreshPath ); + emit setTitle( FmUtils::fillDriveVolume( mCurrentDrive, true ) ); } } +bool FmFileBrowseWidget::checkPathAndSetStyle( const QString& path ) +{ + if( !FmUtils::isPathAccessabel( path ) ){ + QString driveName = FmUtils::getDriveNameFromPath( path ); + FmDriverInfo::DriveState state = FmUtils::queryDriverInfo( driveName ).driveState(); + + if( state & FmDriverInfo::EDriveLocked ) { + mEmptyTipLabel->setPlainText( hbTrId( "Memory Card is locked" ) ); + } else if( state & FmDriverInfo::EDriveNotPresent ) { + mEmptyTipLabel->setPlainText( hbTrId( "Memory Card is not present" ) ); + } else if( state & FmDriverInfo::EDriveCorrupted ) { + mEmptyTipLabel->setPlainText( hbTrId( "Drive is Corrupted" ) ); + } else { + mEmptyTipLabel->setPlainText( hbTrId( "Drive can not be opened " ) ); + } + setStyle( LabelStyle ); + emit setEmptyMenu( true ); + return false; + } else { + setStyle( mFileBrowseStyle ); + emit setEmptyMenu( false ); + return true; + } + +} + void FmFileBrowseWidget::sortFiles( TSortType sortType ) { switch( sortType ){ @@ -458,7 +522,7 @@ } break; case ESortByType:{ - mModel->setSorting( QDir::Type ); + mModel->setSorting( QDir::Type | QDir::DirsFirst ); } break; default: @@ -475,7 +539,7 @@ void FmFileBrowseWidget::on_searchPanel_searchOptionsClicked() { - mFindTargetPath = FmFileDialog::getExistingDirectory( 0, tr( "Look in:" ), QString(""), + mFindTargetPath = FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""), QStringList() ); } @@ -499,8 +563,8 @@ void FmFileBrowseWidget::on_sendAction_triggered() { QString filePath = mModel->filePath( mCurrentItem->modelIndex() ); - QList list; - list.append( QVariant(filePath ) ); + QStringList list; + list.append( filePath ); FmUtils::sendFiles( list ); } @@ -513,7 +577,7 @@ mOperationService->asyncViewFolderDetails( filePath ); } else if( fileInfo.isFile() ){ - FmViewDetailsDialog::showFileViewDetailsDialog( filePath ); + FmViewDetailsDialog::showFileViewDetailsDialog( filePath, FmUtils::getDriveLetterFromPath( filePath ) ); } } @@ -521,7 +585,7 @@ { QStringList fileList; fileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) ); - if ( HbMessageBox::question( tr("Confirm Deletion?" ) )) { + if ( HbMessageBox::question( hbTrId("Confirm Deletion?" ) )) { int ret = mOperationService->asyncRemove( fileList ); switch( ret ) { case FmErrNone: @@ -529,13 +593,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - HbMessageBox::information( tr( "Operatin already started!" ) ); + HbMessageBox::information( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - HbMessageBox::information( tr( "Wrong parameters!" ) ); + HbMessageBox::information( hbTrId( "Wrong parameters!" ) ); break; default: - HbMessageBox::information( tr( "Operation fail to start!" ) ); + HbMessageBox::information( hbTrId( "Operation fail to start!" ) ); } } } @@ -545,7 +609,7 @@ QStringList srcFileList; srcFileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) ); - QString targetPathName = FmFileDialog::getExistingDirectory( 0, tr( "copy to" ), + QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "copy to" ), QString(""), QStringList() ); if( !targetPathName.isEmpty() ) { targetPathName = FmUtils::fillPathWithSplash( targetPathName ); @@ -558,13 +622,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - HbMessageBox::information( tr( "Operatin already started!" ) ); + HbMessageBox::information( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - HbMessageBox::information( tr( "Wrong parameters!" ) ); + HbMessageBox::information( hbTrId( "Wrong parameters!" ) ); break; default: - HbMessageBox::information( tr( "Operation fail to start!" ) ); + HbMessageBox::information( hbTrId( "Operation fail to start!" ) ); } } @@ -588,13 +652,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - HbMessageBox::information( tr( "Operatin already started!" ) ); + HbMessageBox::information( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - HbMessageBox::information( tr( "Wrong parameters!" ) ); + HbMessageBox::information( hbTrId( "Wrong parameters!" ) ); break; default: - HbMessageBox::information( tr( "Operation fail to start!" ) ); + HbMessageBox::information( hbTrId( "Operation fail to start!" ) ); } } } @@ -607,20 +671,18 @@ QString newName( fileInfo.fileName() ); - while( FmDlgUtils::showTextQuery( tr( "Enter new name for %1" ).arg( newName ), newName ) ){ + while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true ) ){ QString newTargetPath = FmUtils::fillPathWithSplash( fileInfo.absolutePath() ) + newName; QFileInfo newFileInfo( newTargetPath ); if( newFileInfo.exists() ) { - HbMessageBox::information( tr( "%1 already exist!" ).arg( newName ) ); + HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( newName ) ); continue; } if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) { - HbMessageBox::information( tr("Rename failed!") ); + HbMessageBox::information( hbTrId("Rename failed!") ); } break; - } - - + } } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfilebrowsewidget.h --- a/filemanager/src/filemanager/src/fmfilebrowsewidget.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.h Mon May 03 12:24:39 2010 +0300 @@ -34,6 +34,7 @@ class HbTreeView; class HbAbstractViewItem; class HbSearchPanel; +class HbLabel; class FmFileBrowseWidget : public HbWidget { @@ -43,7 +44,8 @@ enum Style { NoStyle, ListStyle, - TreeStyle + TreeStyle, + LabelStyle }; enum TSortType{ @@ -67,6 +69,7 @@ bool rename( const QString &oldName, const QString &newName ); void setModelFilter( QDir::Filters filters ); + bool checkPathAndSetStyle( const QString& path ); void refreshModel( const QString& path ); void sortFiles( TSortType sortType ); void activeSearchPanel(); @@ -82,6 +85,8 @@ signals: void currentPathChanged( QString& ); void startSearch( const QString &targetPath, const QString &criteria ); + void setEmptyMenu( bool isMenuEmpty ); + void setTitle( const QString &title ); private slots: void on_list_activated( const QModelIndex &index ); @@ -102,6 +107,7 @@ void initFileModel(); void initLayout(); void initSearchPanel(); + void initEmptyTipsLabel(); void changeRootIndex( const QModelIndex &index ); bool isDriver(const QModelIndex &index) const; @@ -113,13 +119,20 @@ QDirModel *mModel; bool mSelectable; + + //currentStyle Style mStyle; + //used to store orignal tree/list style + Style mFileBrowseStyle; HbAbstractViewItem* mCurrentItem; FmOperationService *mOperationService; QString mFindTargetPath; - HbSearchPanel* mSearchPanel; + HbSearchPanel *mSearchPanel; + HbLabel *mEmptyTipLabel; + + QString mCurrentDrive; }; #endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfileview.cpp --- a/filemanager/src/filemanager/src/fmfileview.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfileview.cpp Mon May 03 12:24:39 2010 +0300 @@ -37,14 +37,10 @@ #include #include #include -#include -#include - - FmFileView::FmFileView() : FmViewBase( EFileView ), mWidget( 0 ), mUpButton( 0 ), mStyleAction( 0 ), mSelectableAction( 0 ), - mFindAction( 0 ), mOperationService( 0 ) + mFindAction( 0 ), mOperationService( 0 ), mMenu( 0 ) { mOperationService = FmViewManager::viewManager()->operationService(); initMenu(); @@ -66,26 +62,28 @@ } mWidget->setRootPath( pathName ); QString driveName = FmUtils::getDriveNameFromPath( pathName ); + /* FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName ); - QString volumeName = driverInfo.volumeName(); + QString volumeName = driverInfo.volumeName(); if( volumeName.isEmpty() ){ - quint32 driveState = FmUtils::getDriverState( driveName ); + FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( driveName ).driveState(); if( !( driveState & FmDriverInfo::EDriveNotPresent ) ){ if( driveState & FmDriverInfo::EDriveRemovable ) { if( driveState & FmDriverInfo::EDriveMassStorage ) { - volumeName.append( tr( "Mass Storage" ) ); + volumeName.append( hbTrId( "Mass Storage" ) ); } else{ - volumeName.append( tr( "Memory Card" ) ); + volumeName.append( hbTrId( "Memory Card" ) ); } } else{ - volumeName.append( tr( "Phone Memory" ) ); + volumeName.append( hbTrId( "Phone Memory" ) ); } } } - - QString titleText = FmUtils::removePathSplash( driverInfo.name() ) + ' ' + volumeName; + */ + //QString titleText = FmUtils::removePathSplash( driverInfo.name() ) + ' ' + volumeName; + QString titleText( FmUtils::fillDriveVolume( driveName, true ) ); setTitle( titleText ); } @@ -107,7 +105,7 @@ #ifdef FM_CHANGE_ORIENT_ENABLE action = new HbAction( this ); action->setObjectName( "rotateAction" ); - action->setText( tr( "Change orientation" ) ); + action->setText( hbTrId( "Change orientation" ) ); menu()->addAction( action ); #endif @@ -121,39 +119,43 @@ action = new HbAction( this ); action->setObjectName( "delete" ); - action->setText( tr( "delete" ) ); + action->setText( hbTrId( "txt_fmgr_menu_delete" ) ); menu()->addAction( action ); action = new HbAction( this ); action->setObjectName( "copy" ); - action->setText( tr( "copy to" ) ); + action->setText( hbTrId( "txt_fmgr_menu_copy" ) ); menu()->addAction( action ); action = new HbAction( this ); action->setObjectName( "move" ); - action->setText( tr( "move to" ) ); + action->setText( hbTrId( "txt_fmgr_menu_move" ) ); menu()->addAction( action ); + action = new HbAction( this ); + action->setObjectName( "newFolder" ); + action->setText( hbTrId( "New Folder" ) ); + menu()->addAction( action ); - HbMenu *subMenu = new HbMenu( "Sort" ); + HbMenu *subMenu = new HbMenu( hbTrId( "Sort" ) ); HbAction *sortNameAction = new HbAction( subMenu ); sortNameAction->setObjectName( "sortNameAction" ); - sortNameAction->setText( tr( "Sort by name" ) ); + sortNameAction->setText( hbTrId( "Sort by name" ) ); subMenu->addAction( sortNameAction ); HbAction *sortTimeAction = new HbAction( subMenu ); sortTimeAction->setObjectName( "sortTimeAction" ); - sortTimeAction->setText( tr( "Sort by time" ) ); + sortTimeAction->setText( hbTrId( "Sort by time" ) ); subMenu->addAction( sortTimeAction ); HbAction *sortSizeAction = new HbAction( subMenu ); sortSizeAction->setObjectName( "sortSizeAction" ); - sortSizeAction->setText( tr( "Sort by size" ) ); + sortSizeAction->setText( hbTrId( "Sort by size" ) ); subMenu->addAction( sortSizeAction ); HbAction* sortTypeAction = new HbAction( subMenu ); sortTypeAction->setObjectName( "sortTypeAction" ); - sortTypeAction->setText( tr( "Sort by type" ) ); + sortTypeAction->setText( hbTrId( "Sort by type" ) ); subMenu->addAction( sortTypeAction ); menu()->addMenu( subMenu ); @@ -166,6 +168,8 @@ this, SLOT( on_sortSizeAction_triggered() ) ); connect( sortTypeAction, SIGNAL( triggered() ), this, SLOT( on_sortTypeAction_triggered() ) ); + + mMenu = takeMenu(); } void FmFileView::initMainWidget() @@ -174,6 +178,7 @@ vLayout->setOrientation( Qt::Vertical ); mWidget = new FmFileBrowseWidget( this ); + mWidget->setObjectName( "mainWidget" ); setStyle( FmFileBrowseWidget::ListStyle ); setSelectable( false ); @@ -185,13 +190,18 @@ connect( mWidget, SIGNAL( startSearch( const QString&, const QString& ) ), this, SLOT( startSearch( const QString&, const QString& ) ) ); + connect( mWidget, SIGNAL( setEmptyMenu( bool ) ), + this, SLOT( on_mainWidget_setEmptyMenu( bool ) ) ); + connect( mWidget, SIGNAL( setTitle( const QString & ) ), + this, SLOT( on_mainWidget_setTitle( const QString & ) ) ); } void FmFileView::initToolBar() { + toolBar()->clearActions(); mFindAction = new HbAction( this ); mFindAction->setObjectName( "leftAction" ); - mFindAction->setText( tr("find") ); + mFindAction->setText( hbTrId("txt_fmgr_opt_find") ); toolBar()->addAction( mFindAction ); mToolBarRightAction = new HbAction( this ); @@ -200,14 +210,21 @@ toolBar()->addAction( mToolBarRightAction ); toolBar()->setOrientation( Qt::Horizontal ); + + //mToolBar = takeToolBar(); + connect( mFindAction, SIGNAL( triggered() ), + this, SLOT( on_leftAction_triggered() ) ); + connect( mToolBarRightAction, SIGNAL( triggered() ), + this, SLOT( on_rightAction_triggered() ) ); + } void FmFileView::setStyle( FmFileBrowseWidget::Style style ) { if ( style == FmFileBrowseWidget::ListStyle ) { - mStyleAction->setText( tr("Tree") ); + mStyleAction->setText( hbTrId("Tree") ); } else if ( style == FmFileBrowseWidget::TreeStyle ) { - mStyleAction->setText( tr("List") ); + mStyleAction->setText( hbTrId("List") ); } mWidget->setStyle( style ); @@ -216,9 +233,9 @@ void FmFileView::setSelectable( bool enable ) { if (enable) { - mSelectableAction->setText( tr("No Select") ); + mSelectableAction->setText( hbTrId("No Select") ); } else { - mSelectableAction->setText( tr("Select") ); + mSelectableAction->setText( hbTrId("Select") ); } mWidget->setSelectable( enable ); @@ -273,13 +290,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - HbMessageBox::information( tr( "Operatin already started!" ) ); + HbMessageBox::information( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - HbMessageBox::information( tr( "Wrong parameters!" ) ); + HbMessageBox::information( hbTrId( "Wrong parameters!" ) ); break; default: - HbMessageBox::information( tr( "Operation fail to start!" ) ); + HbMessageBox::information( hbTrId( "Operation fail to start!" ) ); } setSelectable( false ); } @@ -294,7 +311,7 @@ if (files.size() == 0) { infoNoFileSelected(); } else { - QString targetPathName = FmFileDialog::getExistingDirectory( 0, tr( "copy to" ), + QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "copy to" ), QString(""), QStringList() ); if( !targetPathName.isEmpty() && files.size() > 0 ) { targetPathName = FmUtils::fillPathWithSplash( targetPathName ); @@ -311,13 +328,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - HbMessageBox::information( tr( "Operatin already started!" ) ); + HbMessageBox::information( hbTrId( "Operatin already started!" ) ); break; case FmErrWrongParam: - HbMessageBox::information( tr( "Wrong parameters!" ) ); + HbMessageBox::information( hbTrId( "Wrong parameters!" ) ); break; default: - HbMessageBox::information( tr( "Operation fail to start!" ) ); + HbMessageBox::information( hbTrId( "Operation fail to start!" ) ); } setSelectable( false ); } @@ -362,6 +379,30 @@ } } +void FmFileView::on_newFolder_triggered() +{ + QString dirName; + QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() ); + QDir dir( path ); + if( dir.exists() ) { + while( FmDlgUtils::showTextQuery( hbTrId( "Enter name for " ), dirName, true ) ){ + QString newTargetPath = FmUtils::fillPathWithSplash( + dir.absolutePath() ) + dirName; + QFileInfo newFileInfo( newTargetPath ); + if( newFileInfo.exists() ) { + HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( dirName ) ); + continue; + } + + if( !dir.mkdir( dirName ) ) { + HbMessageBox::information( hbTrId("Operation failed!") ); + } + refreshModel( path ); + break; + } + + } +} void FmFileView::on_upAction_triggered() { mWidget->cdUp(); @@ -426,7 +467,29 @@ void FmFileView::removeToolBarAction() { - toolBar()->removeAction( mFindAction ); - toolBar()->removeAction( mToolBarRightAction ); + toolBar()->clearActions(); } +void FmFileView::on_mainWidget_setEmptyMenu( bool isMenuEmpty ) +{ + if( isMenuEmpty ){ + FmLogger::log( "setEmptyMenu true" ); + if( !mMenu ) { + mMenu = takeMenu(); + } + toolBar()->clearActions(); + } + else { + FmLogger::log( "setEmptyMenu false" ); + if( mMenu ) { + setMenu( mMenu ); + mMenu = 0; + } + initToolBar(); + } +} + +void FmFileView::on_mainWidget_setTitle( const QString &title ) +{ + this->setTitle( title ); +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfileview.h --- a/filemanager/src/filemanager/src/fmfileview.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfileview.h Mon May 03 12:24:39 2010 +0300 @@ -27,6 +27,7 @@ class HbLineEdit; class HbPushButton; +class HbMenu; class FmOperationService; class FmFileView : public FmViewBase @@ -54,6 +55,7 @@ void on_delete_triggered(); void on_copy_triggered(); void on_move_triggered(); + void on_newFolder_triggered(); void on_upAction_triggered(); void on_leftAction_triggered(); void on_rightAction_triggered(); @@ -63,6 +65,8 @@ void on_sortTypeAction_triggered(); void startSearch( const QString &targetPath, const QString &criteria ); + void on_mainWidget_setEmptyMenu( bool isMenuEmpty ); + void on_mainWidget_setTitle( const QString &title ); #ifdef FM_CHANGE_ORIENT_ENABLE void on_rotateAction_triggered(); @@ -90,6 +94,7 @@ FmOperationService *mOperationService; HbAction *mToolBarRightAction; + HbMenu *mMenu; }; #endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfindresultmodel.cpp --- a/filemanager/src/filemanager/src/fmfindresultmodel.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindresultmodel.cpp Mon May 03 12:24:39 2010 +0300 @@ -26,7 +26,8 @@ : QAbstractListModel( parent ) { init(); - QMetaObject::connectSlotsByName( this ); + connect( mFindThread, SIGNAL(finished()), this, SIGNAL(finished()) ); + connect( mFindThread, SIGNAL(found(int)), this, SLOT(on_findThread_found( int) ), Qt::BlockingQueuedConnection ); } FmFindResultModel::~FmFindResultModel() @@ -187,6 +188,7 @@ void FmFindResultModel::on_findThread_found( int count ) { + int size = mFindResult.size(); insertRows( mFindResult.size() - count, count ); emit modelCountChanged( mFindResult.size() ); } @@ -201,9 +203,6 @@ { mFindThread = new FmFindThread( &mFindResult, this ); mFindThread->setObjectName( "findThread" ); - - connect( mFindThread, SIGNAL(finished()), this, SIGNAL(finished()) ); - mIconProvider = new QFileIconProvider(); } @@ -235,29 +234,37 @@ { QFileInfo info1( s1 ); QFileInfo info2( s2 ); - - return info1.suffix().toLower() < info2.suffix().toLower(); + + if( info1.isDir() != info2.isDir() ){ + return info1.isDir(); + } + else{ + return info1.suffix().toLower() < info2.suffix().toLower(); + } } void FmFindResultModel::sort ( int column, Qt::SortOrder order ) { Q_UNUSED( order ); + +// emit layoutAboutToBeChanged(); switch( ( SortFlag )column ) { case Name: - qSort(mFindResult.begin(), mFindResult.end(), caseNameLessThan); + qSort( mFindResult.begin(), mFindResult.end(), caseNameLessThan ); break; case Time: - qSort(mFindResult.begin(), mFindResult.end(), caseTimeLessThan); + qSort( mFindResult.begin(), mFindResult.end(), caseTimeLessThan ); break; case Size: - qSort(mFindResult.begin(), mFindResult.end(), caseSizeLessThan); + qSort( mFindResult.begin(), mFindResult.end(), caseSizeLessThan ); break; case Type: - qSort(mFindResult.begin(), mFindResult.end(), caseTypeLessThan); + qSort( mFindResult.begin(), mFindResult.end(), caseTypeLessThan ); break; } - emit layoutChanged(); +// emit layoutChanged(); + emit refresh(); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfindresultmodel.h --- a/filemanager/src/filemanager/src/fmfindresultmodel.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindresultmodel.h Mon May 03 12:24:39 2010 +0300 @@ -79,6 +79,7 @@ // pass modelCountChanged signal to parent widget // so parent widget could change contentWiget between emptyTipsWidget and listWidget void modelCountChanged( int count ); + void refresh(); private slots: void on_findThread_found( int count ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfindview.cpp --- a/filemanager/src/filemanager/src/fmfindview.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindview.cpp Mon May 03 12:24:39 2010 +0300 @@ -21,12 +21,13 @@ #include "fmfindwidget.h" #include "fmviewmanager.h" -#include +#include #include #include FmFindView::FmFindView() : FmViewBase( EFindView ), - mWaitNote( 0 ) + mWaitNote( 0 ), + mMenu( 0 ) { initMenu(); initMainWidget(); @@ -43,6 +44,7 @@ void FmFindView::activated( const QString& pathName ) { + FmLogger::log( QString( "activate path from findview:" ) + pathName ); FmViewManager::viewManager()->createFileView( pathName, true, true ); } @@ -68,30 +70,37 @@ void FmFindView::initMenu() { - HbMenu *subMenu = new HbMenu( "Sort" ); + HbAction *findAction = new HbAction( this ); + findAction->setObjectName( "findAction" ); + findAction->setText( hbTrId( "Find" ) ); + menu()->addAction( findAction ); + + HbMenu *subMenu = new HbMenu( hbTrId( "Sort" ) ); HbAction *sortNameAction = new HbAction( subMenu ); sortNameAction->setObjectName( "sortNameAction" ); - sortNameAction->setText( tr( "Sort by name" ) ); + sortNameAction->setText( hbTrId( "Sort by name" ) ); subMenu->addAction( sortNameAction ); HbAction *sortTimeAction = new HbAction( subMenu ); sortTimeAction->setObjectName( "sortTimeAction" ); - sortTimeAction->setText( tr( "Sort by time" ) ); + sortTimeAction->setText( hbTrId( "Sort by time" ) ); subMenu->addAction( sortTimeAction ); HbAction *sortSizeAction = new HbAction( subMenu ); sortSizeAction->setObjectName( "sortSizeAction" ); - sortSizeAction->setText( tr( "Sort by size" ) ); + sortSizeAction->setText( hbTrId( "Sort by size" ) ); subMenu->addAction( sortSizeAction ); HbAction *sortTypeAction = new HbAction( subMenu ); sortTypeAction->setObjectName( "sortTypeAction" ); - sortTypeAction->setText( tr( "Sort by type" ) ); + sortTypeAction->setText( hbTrId( "Sort by type" ) ); subMenu->addAction( sortTypeAction ); menu()->addMenu( subMenu ); + connect( findAction, SIGNAL( triggered() ), + this, SLOT( on_findAction_triggered() ) ); connect( sortNameAction, SIGNAL( triggered() ), this, SLOT( on_sortNameAction_triggered() ) ); connect( sortTimeAction, SIGNAL( triggered() ), @@ -100,6 +109,8 @@ this, SLOT( on_sortSizeAction_triggered() ) ); connect( sortTypeAction, SIGNAL( triggered() ), this, SLOT( on_sortTypeAction_triggered() ) ); + + mMenu = takeMenu(); } void FmFindView::initMainWidget() @@ -109,13 +120,15 @@ setWidget( mFindWidget ); if( !mWaitNote ){ - mWaitNote = new HbProgressNote( HbProgressNote::WaitNote ); - mWaitNote->setText( tr( "Finding..." ) ); + mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog ); + mWaitNote->setText( hbTrId( "Finding..." ) ); } connect( mWaitNote, SIGNAL(cancelled()), this, SLOT(stopFind()) ); connect( mFindWidget, SIGNAL(activated( const QString&)), this, SLOT( activated(const QString&)) ); connect( mFindWidget, SIGNAL( startSearch( const QString&, const QString& ) ), this, SLOT( startSearch( const QString&, const QString& ) ) ); + connect( mFindWidget, SIGNAL( setEmptyMenu( bool ) ), + this, SLOT( on_findWidget_setEmptyMenu( bool ) ) ); } void FmFindView::initToolBar() @@ -148,3 +161,23 @@ find( criteria, targetPath ); } } + +void FmFindView::on_findAction_triggered() +{ + mFindWidget->activeSearchPanel(); +} + +void FmFindView::on_findWidget_setEmptyMenu( bool isMenuEmpty ) +{ + if( isMenuEmpty ){ + if( !mMenu ) { + mMenu = takeMenu(); + } + } + else{ + if( mMenu ) { + setMenu( mMenu ); + mMenu = 0; + } + } +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfindview.h --- a/filemanager/src/filemanager/src/fmfindview.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindview.h Mon May 03 12:24:39 2010 +0300 @@ -23,7 +23,8 @@ #include "fmcommon.h" #include "fmviewbase.h" -class HbProgressNote; +class HbProgressDialog; +class HbMenu; class FmFindWidget; class FmFindView : public FmViewBase @@ -41,6 +42,7 @@ private slots: void findFinished(); + void on_findAction_triggered(); void on_sortNameAction_triggered(); void on_sortTimeAction_triggered(); void on_sortSizeAction_triggered(); @@ -48,13 +50,16 @@ void startSearch( const QString &targetPath, const QString &criteria ); + void on_findWidget_setEmptyMenu( bool isMenuEmpty ); + private: void initMenu(); void initMainWidget(); void initToolBar(); FmFindWidget *mFindWidget; - HbProgressNote *mWaitNote; + HbProgressDialog *mWaitNote; + HbMenu *mMenu; }; #endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfindwidget.cpp --- a/filemanager/src/filemanager/src/fmfindwidget.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindwidget.cpp Mon May 03 12:24:39 2010 +0300 @@ -61,6 +61,7 @@ QRegExp regExp( '*' + keyword + '*' ); regExp.setPatternSyntax( QRegExp::Wildcard ); + regExp.setCaseSensitivity( Qt::CaseInsensitive ); mModel->setPattern( regExp ); mModel->find(); @@ -74,6 +75,8 @@ void FmFindWidget::on_resultModel_finished() { emit finished(); + //Since layout problem is found, refresh it + on_resultModel_refresh(); } void FmFindWidget::on_resultModel_modelCountChanged( int count ) @@ -102,6 +105,7 @@ mListView->hide(); mEmptyTipWidget->show(); deActiveSearchPanel(); + emit setEmptyMenu( true ); } break; case ResultListView: @@ -117,6 +121,7 @@ mEmptyTipWidget->hide(); mListView->show(); activeSearchPanel(); + emit setEmptyMenu( false ); } break; } @@ -134,13 +139,16 @@ connect( mModel, SIGNAL( modelCountChanged( int )), this, SLOT( on_resultModel_modelCountChanged( int )) ); + + connect( mModel, SIGNAL( refresh()), + this, SLOT( on_resultModel_refresh()) ); mListView = new HbListView( this ); mListView->setModel( mModel ); mEmptyTipWidget = new HbWidget( this ); QGraphicsLinearLayout *emptyTipLayout = new QGraphicsLinearLayout( mEmptyTipWidget ); - HbLabel *emptyTipLable = new HbLabel( tr( "No found files or folders" ), mEmptyTipWidget ); + HbLabel *emptyTipLable = new HbLabel( hbTrId( "No found files or folders" ), mEmptyTipWidget ); emptyTipLayout->addItem( emptyTipLable ); initSearchPanel(); @@ -196,5 +204,11 @@ } +void FmFindWidget::on_resultModel_refresh() +{ + mListView->setModel( 0 ); + mListView->setModel( mModel ); +} + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmfindwidget.h --- a/filemanager/src/filemanager/src/fmfindwidget.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfindwidget.h Mon May 03 12:24:39 2010 +0300 @@ -55,6 +55,7 @@ void activated( const QString &pathName ); void startSearch( const QString &targetPath, const QString &criteria ); + void setEmptyMenu( bool isMenuEmpty ); private slots: void itemActivated(const QModelIndex &index); @@ -64,6 +65,7 @@ void on_resultModel_finished(); void on_resultModel_modelCountChanged( int count ); + void on_resultModel_refresh(); private: void init(); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmsplitview.cpp --- a/filemanager/src/filemanager/src/fmsplitview.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmsplitview.cpp Mon May 03 12:24:39 2010 +0300 @@ -59,13 +59,13 @@ #ifdef FM_CHANGE_ORIENT_ENABLE action = new HbAction( this ); action->setObjectName( "rotateAction" ); - action->setText( tr( "Change orientation" ) ); + action->setText( hbTrId( "Change orientation" ) ); menu()->addAction( action ); #endif action = new HbAction( this ); action->setObjectName( "normalViewAction" ); - action->setText( tr( "Switch to normal view" ) ); + action->setText( hbTrId( "Switch to normal view" ) ); menu()->addAction( action ); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmviewmanager.cpp --- a/filemanager/src/filemanager/src/fmviewmanager.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewmanager.cpp Mon May 03 12:24:39 2010 +0300 @@ -33,9 +33,42 @@ #include #include #include +#include FmViewManager *FmViewManager::mViewManager = 0; + +FmDlgCloseUnit::FmDlgCloseUnit( HbDialog *dialog ) : mDialog( dialog ) +{ +} +FmDlgCloseUnit::~FmDlgCloseUnit() +{ +} + +void FmDlgCloseUnit::addAssociatedDrives( QString drives ) +{ + for( int i = 0; i< drives.length(); ++i ) { + if( !mAssociatedDrives.contains( drives[i], Qt::CaseInsensitive ) ) { + mAssociatedDrives += drives[i]; + } + } +} +void FmDlgCloseUnit::removeAssociatedDrives( QString drives ) +{ + for( int i = 0; i < drives.length(); ++i ){ + mAssociatedDrives.remove( drives[i], Qt::CaseInsensitive ); + } +} +QString FmDlgCloseUnit::associatedDrives() +{ + return mAssociatedDrives; +} + +HbDialog *FmDlgCloseUnit::dialog() +{ + return mDialog; +} + FmViewManager::FmViewManager( FmMainWindow* mainWindow ) { mMainWindow = mainWindow; @@ -70,6 +103,7 @@ mDriveWatcher->cancelWatch(); delete mDriveWatcher; mDriveWatcher = 0; + } FmViewManager *FmViewManager::CreateViewManager( FmMainWindow* mainWindow ) @@ -141,12 +175,15 @@ QString absolutePath = fileInfo.absoluteFilePath(); QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath ); - - if( !FmUtils::isPathAccessabel( checkedPath ) ) { - checkedPath.clear(); + FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( path ).driveState(); + if( driveState & FmDriverInfo::EDriveAvailable ) { + if( !FmUtils::isPathAccessabel( checkedPath ) ) { + checkedPath.clear(); + } } + if( checkedPath.isEmpty() ) { - HbMessageBox::information( QString( tr("Path: %1 is unavailable!").arg( path )) ); + HbMessageBox::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) ); return; } @@ -242,7 +279,23 @@ { FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) ); emit refreshModel( QString("") ); + checkDlgCloseUnit(); FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) ); } + +void FmViewManager::checkDlgCloseUnit() +{ + foreach( FmDlgCloseUnit* unit, mDlgCloseUnitList ) { + QString drives( unit->associatedDrives() ); + for( int i = 0; i < drives.length(); i++ ) { + QString drive( drives[i] + QString( ":/" ) ); + if( !FmUtils::isDriveAvailable( drive ) ) { + FmLogger::log( " close Dialog start " ); + unit->dialog()->close(); + FmLogger::log( " close Dialog end " ); + } + } + } +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/fmviewmanager.h --- a/filemanager/src/filemanager/src/fmviewmanager.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewmanager.h Mon May 03 12:24:39 2010 +0300 @@ -20,6 +20,8 @@ #define FMVIEWMANAGER_H #include +#include +#include "fmcommon.h" class FmMainWindow; class HbView; @@ -28,6 +30,23 @@ class FmOperationBase; class QFileSystemWatcher; class FmDriveWatcher; +class HbDialog; + +class FmDlgCloseUnit +{ +public: + FmDlgCloseUnit( HbDialog *dialog ); + ~FmDlgCloseUnit(); + + void addAssociatedDrives( QString drives ); + void removeAssociatedDrives( QString drives ); + QString associatedDrives(); + HbDialog *dialog(); + +private: + HbDialog *mDialog; + QString mAssociatedDrives; +}; class FmViewManager : public QObject { @@ -54,6 +73,18 @@ void addWatchPath( const QString &path ); void removeWatchPath( const QString &path ); + // dialog close utils: + void addDlgCloseUnit( FmDlgCloseUnit* unit ) + { + FmLogger::log( "FmViewManager::addDlgCloseUnit_" + unit->associatedDrives() ); + mDlgCloseUnitList.append( unit ); + } + void removeDlgCloseUnit( FmDlgCloseUnit* unit ) + { + FmLogger::log( "FmViewManager::removeDlgCloseUnit_" + unit->associatedDrives() ); + mDlgCloseUnitList.removeOne( unit ); + } + protected: explicit FmViewManager( FmMainWindow* mainWindow ); ~FmViewManager(); @@ -73,6 +104,8 @@ // HbView *createView( FmViewType viewType ); // void adjustSecondarySoftKey(); + + void checkDlgCloseUnit(); private: static FmViewManager *mViewManager; @@ -82,6 +115,8 @@ FmOperationService *mOperationService; QFileSystemWatcher *mFsWatcher; FmDriveWatcher *mDriveWatcher; + + QList mDlgCloseUnitList; }; diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/listviewitems.cpp --- a/filemanager/src/filemanager/src/listviewitems.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/listviewitems.cpp Mon May 03 12:24:39 2010 +0300 @@ -79,8 +79,8 @@ FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); mDiskNameLabel->setPlainText( displayString ); - mSizeLabel->setPlainText( tr ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) ); - mFreeLabel->setPlainText( tr ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) ); + mSizeLabel->setPlainText( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) ); + mFreeLabel->setPlainText( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) ); // mCheckBox->setCheckState( checkState() ); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/main.cpp --- a/filemanager/src/filemanager/src/main.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/main.cpp Mon May 03 12:24:39 2010 +0300 @@ -38,11 +38,9 @@ translator.load( path + "filemanager_" + lang ); app.installTranslator(&translator); - FmMainWindow mw; mw.show(); - return app.exec(); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp Mon May 03 12:24:39 2010 +0300 @@ -35,20 +35,20 @@ //FmOperationFormat -FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), - mDriverName( mDriverName ) -{ -} -FmOperationFormat::~FmOperationFormat() -{ -} +//FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), +// mDriverName( mDriverName ) +//{ +//} +//FmOperationFormat::~FmOperationFormat() +//{ +//} +// +//QString FmOperationFormat::driverName() +//{ +// return mDriverName; +//} -QString FmOperationFormat::driverName() -{ - return mDriverName; -} - -//FmOperationFormat +//FmOperationDriveDetails FmOperationDriveDetails::FmOperationDriveDetails( QObject *parent, QString driverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeDriveDetails ), mDriverName( driverName ) diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationbase.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationbase.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.h Mon May 03 12:24:39 2010 +0300 @@ -37,15 +37,15 @@ }; -class FmOperationFormat : public FmOperationBase -{ -public: - explicit FmOperationFormat( QObject *parent, QString mDriverName ); - virtual ~FmOperationFormat(); - QString driverName(); -private: - QString mDriverName; -}; +//class FmOperationFormat : public FmOperationBase +//{ +//public: +// explicit FmOperationFormat( QObject *parent, QString mDriverName ); +// virtual ~FmOperationFormat(); +// QString driverName(); +//private: +// QString mDriverName; +//}; class FmOperationDriveDetails : public FmOperationBase { diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp Mon May 03 12:24:39 2010 +0300 @@ -80,15 +80,40 @@ return ret; } QString newName; + bool isAcceptReplace = false; QFileInfo destFi( mTargetPath + fi.fileName() ); + + // while for duplicated file/dir while( destFi.exists() ) { - emit askForRename( destFi.absoluteFilePath(), &newName ); - if( newName.isEmpty() ) { - ret = FmErrCancel; - break; + if( destFi.isFile() && destFi.absoluteFilePath().compare( fi.absoluteFilePath(), Qt::CaseInsensitive ) != 0 ) { + emit askForReplace( destFi.absoluteFilePath(), fi.absoluteFilePath(), &isAcceptReplace ); + if( isAcceptReplace ) { + //delete src file + if( !QFile::remove( destFi.absoluteFilePath() ) ) { + *mErrString = destFi.absoluteFilePath(); + ret = FmErrCannotRemove; + break; + } + destFi.setFile( destFi.absoluteFilePath() ); + } else { + emit askForRename( destFi.absoluteFilePath(), &newName ); + if( newName.isEmpty() ) { + ret = FmErrCancel; + break; + } + QString targetName = mTargetPath + newName; + destFi.setFile( targetName ); + } + } else{ + // destination is dir + emit askForRename( destFi.absoluteFilePath(), &newName ); + if( newName.isEmpty() ) { + ret = FmErrCancel; + break; + } + QString targetName = mTargetPath + newName; + destFi.setFile( targetName ); } - QString targetName = mTargetPath + newName; - destFi.setFile( targetName ); } if( ret != FmErrNone ) { return ret; @@ -212,6 +237,9 @@ void FmOperationCopy::IncreaseProgress( quint64 size ) { + if( mTotalSize <=0 ) { + return; + } mCopiedSize += size; int step = ( mCopiedSize * 100 ) / mTotalSize; if( step > mCurrentStep ) { diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationcopy.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopy.h Mon May 03 12:24:39 2010 +0300 @@ -35,6 +35,7 @@ signals: void askForRename( const QString &srcFile, QString *destFile ); + void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void notifyPreparing( bool cancelable ); void notifyStart( bool cancelable, int maxSteps ); void notifyProgress( int currentStep ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationformat.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat.h Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,48 @@ +/* +* 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: +* The header file of the operation param of file manager +* +*/ + +#ifndef FMOPERATIONFORMAT_H +#define FMOPERATIONFORMAT_H + +#include "fmoperationbase.h" + +#include +#include + +class FmOperationFormat : public FmOperationBase +{ + Q_OBJECT +public: + explicit FmOperationFormat( QObject *parent, QString mDriverName ); + virtual ~FmOperationFormat(); + QString driverName(); + + int start(); + +signals: + void notifyStart( bool cancelable, int maxSteps ); + void notifyProgress( int currentStep ); + void notifyPreparing( bool cancelable ); + +private: + QString mDriverName; + + int mTotalSteps; +}; + +#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationformat_s60.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat_s60.cpp Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,185 @@ +/* +* 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: +* +*/ + +#include "fmoperationformat.h" +#include "fmcommon.h" +#include "fmoperationbase.h" +#include "fmutils.h" + +#include + +#include +#include +#include + +FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), + mDriverName( mDriverName ) +{ +} +FmOperationFormat::~FmOperationFormat() +{ +} + +QString FmOperationFormat::driverName() +{ + return mDriverName; +} + +int FmOperationFormat::start() +{ + QString logString = "FmOperationFormat::start"; + FmLogger::log( logString ); + + emit notifyPreparing( false ); + + if( mDriverName.isEmpty() ) { + return FmErrWrongParam; + } + + RFormat format; + + RFs fs; + int err = fs.Connect(); + + if( err != KErrNone ){ + return FmErrTypeFormatFailed; + } + + TInt drive = 0; + drive = mDriverName[0].toUpper().toAscii() - 'A' + EDriveA; + + TDriveName formatDriveName( TDriveUnit( drive ).Name() ); + + int finalValue = 0; + + format.Close(); + + err = format.Open( + fs, formatDriveName, EFullFormat | ESpecialFormat, finalValue ); + + if( err == KErrNone ){ + logString = "emit notifyStart"; + FmLogger::log( logString ); + mTotalSteps = finalValue; + emit notifyStart( false, finalValue ); + } + + logString = "Format open error:" + QString::number( err ); + FmLogger::log( logString ); + + if( err == KErrLocked ){ + err = fs.ErasePassword( drive ); + + logString = "ErasePassword error:" + QString::number( err ); + FmLogger::log( logString ); + + if( err == KErrNone ){ + err = format.Open( + fs, formatDriveName, EFullFormat, finalValue ); + + if( err == KErrNone ){ + logString = "emit notifyStart"; + FmLogger::log( logString ); + mTotalSteps = finalValue; + emit notifyStart( false, finalValue ); + } + logString = "Second format open error:" + QString::number( err ); + FmLogger::log( logString ); + } + } + + if (err == KErrInUse){ + TBool reallyFormat = ETrue; + if (reallyFormat){ + err = format.Open( + fs, formatDriveName, EFullFormat | EForceFormat, finalValue ); + + if( err == KErrNone ){ + logString = "emit notifyStart"; + FmLogger::log( logString ); + mTotalSteps = finalValue; + emit notifyStart( false, finalValue ); + } + + logString = "Reallyformat open error:" + QString::number( err ); + FmLogger::log( logString ); + } + } + + TFullName fsName; + if ( err == KErrNone ) + { + err = fs.FileSystemName( fsName, drive ); + + logString = "FileSystemName error:" + QString::number( err ); + FmLogger::log( logString ); + + if ( err == KErrNone && fsName.Length() > 0 ) + { + // Prevent SysAp shutting down applications + RProperty::Set( + KPSUidCoreApplicationUIs, + KCoreAppUIsMmcRemovedWithoutEject, + ECoreAppUIsEjectCommandUsed ); + + logString = "Prevent SysAp shutting down applications" ; + FmLogger::log( logString ); + } + else + { + // Don't continue with format if there is no file system name + // or file system name could not be obtained. + err = KErrCancel; + + logString = QString( "Format cancel" ); + FmLogger::log( logString ); + } + } + + if( err == KErrNone && finalValue ){ + + while ( finalValue ){ + logString = "Format tracks:" + QString::number( finalValue ); + FmLogger::log( logString ); + err = format.Next( finalValue ); + + if( err != KErrNone ){ + logString = "Format error:" + QString::number( err ); + FmLogger::log( logString ); + break; + } + + logString = "emit notifyProgress"; + FmLogger::log( logString ); + emit notifyProgress( mTotalSteps - finalValue ); + } + } + + if( !finalValue || err != KErrNone ){ + format.Close(); + fs.Close(); + + FmUtils::createDefaultFolders( mDriverName ); + } + + if( err == KErrNone ){ + return FmErrNone; + } + else{ + return FmErrTypeFormatFailed; + } +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,54 @@ +/* +* 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: +* +*/ + +#include "fmoperationformat.h" +#include "fmcommon.h" +#include "fmoperationbase.h" +#include "fmutils.h" + +#include + +FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), + mDriverName( mDriverName ) +{ +} +FmOperationFormat::~FmOperationFormat() +{ +} + +QString FmOperationFormat::driverName() +{ + return mDriverName; +} + +int FmOperationFormat::start() +{ + QString logString = "FmOperationFormat::start"; + FmLogger::log( logString ); + + if( mDriverName.isEmpty() ) { + return FmErrWrongParam; + } + int totalCount( 100 ); + emit notifyStart( totalCount, false ); + for( int i = 0; i < totalCount; i++ ) { + emit notifyProgress( i ); + } + + return FmErrNone; + +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp Mon May 03 12:24:39 2010 +0300 @@ -19,6 +19,7 @@ #include "fmcommon.h" #include "fmoperationbase.h" #include "fmdrivedetailstype.h" +#include "fmutils.h" #include #include @@ -79,15 +80,39 @@ return ret; } QString newName; + bool isAcceptReplace = false; QFileInfo destFi( mTargetPath + fi.fileName() ); + // while for duplicated file/dir while( destFi.exists() ) { - emit askForRename( destFi.absoluteFilePath(), &newName ); - if( newName.isEmpty() ) { - ret = FmErrCancel; - break; + if( destFi.isFile() && destFi.absoluteFilePath().compare( fi.absoluteFilePath(), Qt::CaseInsensitive ) != 0 ) { + emit askForReplace( destFi.absoluteFilePath(), fi.absoluteFilePath(), &isAcceptReplace ); + if( isAcceptReplace ) { + //delete src file + if( !QFile::remove( destFi.absoluteFilePath() ) ) { + *mErrString = destFi.absoluteFilePath(); + ret = FmErrCannotRemove; + break; + } + destFi.setFile( destFi.absoluteFilePath() ); + } else { + emit askForRename( destFi.absoluteFilePath(), &newName ); + if( newName.isEmpty() ) { + ret = FmErrCancel; + break; + } + QString targetName = mTargetPath + newName; + destFi.setFile( targetName ); + } + } else{ + // destination is dir + emit askForRename( destFi.absoluteFilePath(), &newName ); + if( newName.isEmpty() ) { + ret = FmErrCancel; + break; + } + QString targetName = mTargetPath + newName; + destFi.setFile( targetName ); } - QString targetName = mTargetPath + newName; - destFi.setFile( targetName ); } if( ret != FmErrNone ) { return ret; @@ -132,7 +157,13 @@ } IncreaseProgress( fileSize ); } else if (fi.isDir()) { - ret = moveDirInsideContent( source, newName ); + if( FmUtils::isDefaultFolder( source ) ){ + ret = FmErrRemoveDefaultFolder; + } + else{ + ret = moveDirInsideContent( source, newName ); + } + if( ret!= FmErrNone ) { return ret; } @@ -227,6 +258,9 @@ void FmOperationMove::IncreaseProgress( quint64 size ) { + if( mTotalSize <=0 ) { + return; + } mMovedSize += size; int step = ( mMovedSize * 100 ) / mTotalSize; if( step > mCurrentStep ) { diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationmove.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationmove.h Mon May 03 12:24:39 2010 +0300 @@ -34,7 +34,7 @@ signals: void askForRename( const QString &srcFile, QString *destFile ); - + void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void notifyPreparing( bool cancelable ); void notifyStart( bool cancelable, int maxSteps ); void notifyProgress( int currentStep ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationremove.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationremove.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationremove.cpp Mon May 03 12:24:39 2010 +0300 @@ -19,6 +19,7 @@ #include "fmcommon.h" #include "fmoperationbase.h" #include "fmdrivedetailstype.h" +#include "fmutils.h" #include #include @@ -93,7 +94,14 @@ } IncreaseProgressOnce(); } else if (fi.isDir()) { - ret = recursiveRemoveDir( fileName ); + if( FmUtils::isDefaultFolder( fileName ) ){ + ret = FmErrRemoveDefaultFolder; + } + else{ + ret = recursiveRemoveDir( fileName ); + } + + } else { qWarning( "Things other than file and directory are not copied" ); ret = FmErrIsNotFileOrFolder; @@ -147,6 +155,8 @@ void FmOperationRemove::IncreaseProgressOnce() { + if( mTotalCount <= 0 ) + return; mRemovedCount++; int step = ( mRemovedCount * 100 ) / mTotalCount; if( step > mCurrentStep ) { diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Mon May 03 12:24:39 2010 +0300 @@ -17,10 +17,12 @@ #include "fmoperationresultprocesser.h" #include "fmoperationbase.h" #include "fmoperationservice.h" +#include "fmoperationformat.h" #include "fmviewdetailsdialog.h" #include "fmdlgutils.h" +#include "fmutils.h" -#include +#include #include #include @@ -41,27 +43,42 @@ QString questionText = QString( "file " ) + srcFile + QString( " already exist, please rename:" ); QString value; - FmDlgUtils::showTextQuery( questionText, value ); + FmDlgUtils::showTextQuery( questionText, value, true ); *destFile = value; } +void FmOperationResultProcesser::onAskForReplace( + FmOperationBase* operationBase, const QString &srcFile, const QString &destFile, bool *isAccepted ) +{ + Q_UNUSED( operationBase ); + Q_UNUSED( destFile ); + + QString questionText = QString( "file " ) + + srcFile + QString( " already exist, replace it?" ); + if( HbMessageBox::question( questionText ) ) { + *isAccepted = true; + } else { + *isAccepted = false; + } +} + void FmOperationResultProcesser::onNotifyWaiting( FmOperationBase* operationBase, bool cancelable ) { QString title = tr("Operation"); switch( operationBase->operationType() ) { case FmOperationService::EOperationTypeBackup: - title = tr("backuping"); + title = hbTrId("backuping"); break; case FmOperationService::EOperationTypeRestore: - title = tr("restoring"); + title = hbTrId("restoring"); break; case FmOperationService::EOperationTypeDriveDetails: - title = tr( "Scaning memory..." ); + title = hbTrId( "Scaning memory..." ); break; case FmOperationService::EOperationTypeFolderDetails: - title = tr( "Scaning folder..." ); + title = hbTrId( "Scaning folder..." ); break; default: break; @@ -72,23 +89,26 @@ void FmOperationResultProcesser::onNotifyPreparing( FmOperationBase* operationBase, bool cancelable ) { - QString title = tr("Operation"); + QString title = hbTrId("Operation"); switch( operationBase->operationType() ) { case FmOperationService::EOperationTypeBackup: - title = tr("backup preparing"); + title = hbTrId("backup preparing"); break; case FmOperationService::EOperationTypeRestore: - title = tr("restore preparing"); + title = hbTrId("restore preparing"); break; case FmOperationService::EOperationTypeCopy: - title = tr("copy preparing"); + title = hbTrId("copy preparing"); break; case FmOperationService::EOperationTypeMove: - title = tr("move preparing"); + title = hbTrId("move preparing"); break; case FmOperationService::EOperationTypeRemove: - title = tr("delete preparing"); + title = hbTrId("delete preparing"); + break; + case FmOperationService::EOperationTypeFormat: + title = hbTrId("format preparing"); break; default: break; @@ -103,19 +123,22 @@ switch( operationBase->operationType() ) { case FmOperationService::EOperationTypeBackup: - title = tr("backup..."); + title = hbTrId("backup..."); break; case FmOperationService::EOperationTypeRestore: - title = tr("restore..."); + title = hbTrId("restore..."); break; case FmOperationService::EOperationTypeCopy: - title = tr("copy..."); + title = hbTrId("copy..."); break; case FmOperationService::EOperationTypeMove: - title = tr("move..."); + title = hbTrId("move..."); break; case FmOperationService::EOperationTypeRemove: - title = tr("delete..."); + title = hbTrId("delete..."); + break; + case FmOperationService::EOperationTypeFormat: + title = hbTrId("formating..."); break; default: break; @@ -140,7 +163,8 @@ { FmOperationDriveDetails *paramDriveDetails = static_cast( operationBase ); QString diskName = paramDriveDetails->driverName(); - FmViewDetailsDialog::showDriveViewDetailsDialog( diskName, paramDriveDetails->detailsSizeList() ); + FmViewDetailsDialog::showDriveViewDetailsDialog( diskName, paramDriveDetails->detailsSizeList(), + FmUtils::getDriveLetterFromPath( diskName ) ); break; } case FmOperationService::EOperationTypeFolderDetails: @@ -149,26 +173,44 @@ FmViewDetailsDialog::showFolderViewDetailsDialog( paramFolderDetails->folderPath(), paramFolderDetails->numofSubFolders(), paramFolderDetails->numofFiles(), - paramFolderDetails->sizeofFolder() ); + paramFolderDetails->sizeofFolder(), + FmUtils::getDriveLetterFromPath( paramFolderDetails->folderPath() ) ); break; } case FmOperationService::EOperationTypeFormat: { - HbMessageBox::information( QString( tr("Format succeed!")) ); + HbMessageBox::information( QString( hbTrId("Format succeed!")) ); + FmOperationFormat *paramFormat = static_cast( operationBase ); + QString title( tr( "Drive name ") ); + QString driveName( paramFormat->driverName() ); + QString volumeName; + while( FmDlgUtils::showTextQuery( title, volumeName, false, FmMaxLengthofDriveName ) ){ + int err = FmUtils::renameDrive( driveName, volumeName ); + if ( err == FmErrNone ){ + HbMessageBox::information( hbTrId( "The name has been changed!" ) ); + mOperationService->on_operationThread_refreshModel( driveName ); + break; + } else if( err == FmErrBadName ) { + HbMessageBox::information( hbTrId( "Illegal characters! Use only letters and numbers." ) ); + } else{ + HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) ); + break; + } + } break; } case FmOperationService::EOperationTypeBackup: { - HbMessageBox::information( QString( tr("Backup succeed!")) ); + HbMessageBox::information( QString( hbTrId("Backup succeed!")) ); break; } case FmOperationService::EOperationTypeRestore: { - HbMessageBox::information( QString( tr("Restore succeed!")) ); + HbMessageBox::information( QString( hbTrId("Restore succeed!")) ); break; } default: - HbMessageBox::information( QString( tr("Operation finished")) ); + HbMessageBox::information( QString( hbTrId("Operation finished")) ); } } @@ -178,28 +220,54 @@ failAndCloseProgress(); switch( error ) { - case FmErrAlreadyStarted: - HbMessageBox::information( QString( tr("Operation already started!")) ); - return; - case FmErrDiskFull: - HbMessageBox::information( QString( tr("Not enough space. Operation cancelled.!")) ); - return; - case FmErrCopyDestToSubFolderInSrc: - HbMessageBox::information( QString( tr("Can not copy to sub folder!")) ); - return; - case FmErrMoveDestToSubFolderInSrc: - HbMessageBox::information( QString( tr("Can not move to sub folder!")) ); - return; + case FmErrAlreadyStarted: + HbMessageBox::information( QString( hbTrId("Operation already started!")) ); + return; + case FmErrDiskFull: + HbMessageBox::information( QString( hbTrId("Not enough space. Operation cancelled.!")) ); + return; + case FmErrCopyDestToSubFolderInSrc: + HbMessageBox::information( QString( hbTrId("Can not copy to sub folder!")) ); + return; + case FmErrMoveDestToSubFolderInSrc: + HbMessageBox::information( QString( hbTrId("Can not move to sub folder!")) ); + return; + case FmErrCannotRemove:{ + if( operationBase->operationType() == FmOperationService::EOperationTypeCopy ) { + // when copy a file/dir to same name destination, and delete dest fail, this error will occur + HbMessageBox::information( QString( hbTrId( "Can not copy because %1 can not be deleted!" ).arg( errString ) ) ); + return; + } + else if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { + // when move a file/dir to same name destination, and delete dest fail, this error will occur + HbMessageBox::information( QString( hbTrId( "Can not move because %1 can not be deleted!" ).arg( errString ) ) ); + return; + } + // when delete file/dir fail, this error will occur + HbMessageBox::information( QString( hbTrId( "Can not delete %1!" ).arg( errString ) ) ); + return; + } + case FmErrRemoveDefaultFolder:{ + if( operationBase->operationType() == FmOperationService::EOperationTypeMove ) { + // when move a default folder + HbMessageBox::information( QString( hbTrId( "Could not move because the default folder %1 can not be deleted!" ).arg( errString ) ) ); + return; + } + else { + // when delete the default folder + HbMessageBox::information( QString( hbTrId( "Could not remove the default folder %1 " ).arg( errString ) ) ); + return; + } + } } - switch( operationBase->operationType() ) { case FmOperationService::EOperationTypeFormat: - HbMessageBox::information( QString( tr("Format failed!")) ); + HbMessageBox::information( QString( hbTrId("Format failed!")) ); break; default: - HbMessageBox::information( QString( tr("Operation failed")) ); + HbMessageBox::information( QString( hbTrId("Operation failed")) ); } } @@ -208,7 +276,7 @@ { Q_UNUSED( operationBase ); cancelProgress(); - HbMessageBox::information( QString( tr("Operation Canceled!") ) ); + HbMessageBox::information( QString( hbTrId("Operation Canceled!") ) ); } @@ -227,13 +295,13 @@ delete mNote; } - mNote = new HbProgressNote( HbProgressNote::WaitNote ); + mNote = new HbProgressDialog( HbProgressDialog::WaitDialog ); connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); // if( !mNote ) { -// mNote = new HbProgressNote( HbProgressNote::WaitNote ); +// mNote = new HbProgressDialog( HbProgressDialog::WaitNote ); // connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); // } else { -// mNote->setProgressNoteType( HbProgressNote::WaitNote ); +// mNote->setProgressDialogType( HbProgressDialog::WaitNote ); // } mNote->setText( title ); if( !cancelable ) @@ -253,22 +321,24 @@ delete mNote; } - mNote = new HbProgressNote( HbProgressNote::ProgressNote ); + mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); // if( !mNote ) { -// mNote = new HbProgressNote( HbProgressNote::ProgressNote ); +// mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); // connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); // } else { -// mNote->setProgressNoteType( HbProgressNote::ProgressNote ); +// mNote->setProgressDialogType( HbProgressDialog::ProgressDialog ); // } mNote->setMinimum(0); mNote->setMaximum( 65535 ); mNote->setProgressValue( 0 ); mNote->setText( title ); - if( !cancelable ) - mNote->primaryAction()->setDisabled( true ); - else - mNote->primaryAction()->setDisabled( false ); + if( !cancelable ){ + mNote->primaryAction()->setDisabled( true ); + } + else{ + mNote->primaryAction()->setDisabled( false ); + } mNote->exec(); } @@ -281,13 +351,13 @@ delete mNote; } - mNote = new HbProgressNote( HbProgressNote::ProgressNote ); + mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); // if( !mNote ) { -// mNote = new HbProgressNote( HbProgressNote::ProgressNote ); +// mNote = new HbProgressDialog( HbProgressDialog::ProgressDialog ); // connect( mNote, SIGNAL( cancelled() ), this, SLOT(onProgressCancelled() ) ); // } else { -// mNote->setProgressNoteType( HbProgressNote::ProgressNote ); +// mNote->setProgressDialogType( HbProgressDialog::ProgressDialog ); // } mNote->setText( title ); @@ -296,10 +366,12 @@ mNote->setProgressValue( 0 ); - if( !cancelable ) + if( !cancelable ){ mNote->primaryAction()->setDisabled( true ); - else + } + else{ mNote->primaryAction()->setDisabled( false ); + } mNote->exec(); } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Mon May 03 12:24:39 2010 +0300 @@ -21,7 +21,7 @@ class FmOperationBase; class FmOperationService; -class HbProgressNote; +class HbProgressDialog; class FmOperationResultProcesser : public QObject @@ -32,6 +32,7 @@ ~FmOperationResultProcesser(void); void onAskForRename( FmOperationBase* operationBase, const QString &srcFile, QString *destFile ); + void onAskForReplace( FmOperationBase* operationBase, const QString &srcFile, const QString &destFile, bool *isAccepted ); void onNotifyWaiting( FmOperationBase* operationBase, bool cancelable ); void onNotifyPreparing( FmOperationBase* operationBase, bool cancelable ); void onNotifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ); @@ -53,7 +54,7 @@ void failAndCloseProgress(); private: FmOperationService *mOperationService; - HbProgressNote *mNote; + HbProgressDialog *mNote; }; #endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Mon May 03 12:24:39 2010 +0300 @@ -26,8 +26,8 @@ #include "fmoperationcopy.h" #include "fmoperationmove.h" #include "fmoperationremove.h" +#include "fmoperationformat.h" -#include #include #include @@ -282,6 +282,13 @@ mOperationResultProcesser->onAskForRename( mCurrentOperation, srcFile, destFile ); } + +void FmOperationService::on_operationThread_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ) +{ + mOperationResultProcesser->onAskForReplace( + mCurrentOperation, srcFile, destFile, isAccepted ); +} + void FmOperationService::on_operationThread_refreshModel( const QString &path ) { emit refreshModel( mCurrentOperation, path ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationservice.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Mon May 03 12:24:39 2010 +0300 @@ -33,8 +33,6 @@ class FmDriveDetailsSize; class FmOperationResultProcesser; -class HbProgressNote; - class FmOperationService : public QObject { Q_OBJECT @@ -95,6 +93,7 @@ void on_backupRestore_notifyCanceled(); void on_operationThread_askForRename( const QString &srcFile, QString *destFile ); + void on_operationThread_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void on_operationThread_refreshModel( const QString &path ); void on_operationThread_notifyWaiting( bool cancelable ); void on_operationThread_notifyPreparing( bool cancelable ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Mon May 03 12:24:39 2010 +0300 @@ -23,7 +23,7 @@ #include "fmoperationcopy.h" #include "fmoperationmove.h" #include "fmoperationremove.h" - +#include "fmoperationformat.h" #include #include @@ -49,6 +49,8 @@ QMetaObject::connectSlotsByName( this ); connect( mOperationBase, SIGNAL( askForRename( QString, QString* ) ), this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); + connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ), + this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection ); start(); return FmErrNone; @@ -65,6 +67,9 @@ QMetaObject::connectSlotsByName( this ); connect( mOperationBase, SIGNAL( askForRename( QString, QString* ) ), this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); + connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ), + this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection ); + start(); return FmErrNone; @@ -135,6 +140,10 @@ { emit askForRename( srcFile, destFile ); } +void FmOperationThread::onAskForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ) +{ + emit askForReplace( srcFile, destFile, isAccepted ); +} void FmOperationThread::on_operationElement_notifyPreparing( bool cancelable ) { emit notifyPreparing( cancelable ); @@ -226,13 +235,14 @@ } case FmOperationService::EOperationTypeFormat: { - emit notifyWaiting( false ); +// emit notifyWaiting( false ); FmLogger::log(QString("start format")); FmOperationFormat *operationFormat = static_cast( mOperationBase ); FmLogger::log(QString("get param and start format")); QString refreshSrcPath = operationFormat->driverName(); - if ( FmErrNone != FmUtils::formatDrive( operationFormat->driverName() ) ) { +// if ( FmErrNone != FmUtils::formatDrive( operationFormat->driverName() ) ) { + if ( FmErrNone != operationFormat->start() ) { emit notifyError( FmErrTypeFormatFailed, operationFormat->driverName() ); return; } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/filemanager/src/operationservice/fmoperationthread.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Mon May 03 12:24:39 2010 +0300 @@ -52,6 +52,7 @@ signals: void askForRename( const QString &srcFile, QString *destFile ); + void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void refreshModel( const QString &path ); void notifyWaiting( bool cancelable ); @@ -65,6 +66,7 @@ private slots: void onAskForRename( const QString &srcFile, QString *destFile ); + void onAskForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void on_operationElement_notifyPreparing( bool cancelable ); void on_operationElement_notifyStart( bool cancelable, int maxSteps ); void on_operationElement_notifyProgress( int currentStep ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pro --- a/filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pro Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pro Mon May 03 12:24:39 2010 +0300 @@ -35,5 +35,6 @@ LIBS += -leikcore LIBS += -lcone LIBS += -lsysutil + LIBS += -lplatformenv } diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h --- a/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Mon May 03 12:24:39 2010 +0300 @@ -29,6 +29,7 @@ const QString constFileManagerBackupWeekdayWednesday = "Wednesday"; const QString constFileManagerBackupWeekdayThursday = "Thursday"; const QString constFileManagerBackupWeekdayFirday = "Friday"; +const QString constFileManagerBackupWeekdaySaturday = "Saturday"; const QString constFileManagerBackupWeekdaySunday = "Sunday"; const QString constFileManagerBackupScheduleNever = "Never"; @@ -49,6 +50,8 @@ const QString constFileManagerBackupSettingsContentBookmarks = "Bookmarks"; const QString constFileManagerBackupSettingsContentUserFiles = "Files"; +class FmBkupEngine; + // CLASS DECLARATION /** * This class is used for storing backup entry which used in backup view @@ -167,11 +170,12 @@ EFileManagerBackupWeekdayWednesday, EFileManagerBackupWeekdayThursday, EFileManagerBackupWeekdayFriday, + EFileManagerBackupWeekdaySaturday, EFileManagerBackupWeekdaySunday, }; public: - FmBackupSettings( void ); + explicit FmBackupSettings( FmBkupEngine *aFmBkupEngine ); ~FmBackupSettings( void ); @@ -347,6 +351,8 @@ * Backup setting list items */ QList< FmBackupEntry* > mBackupEntryList; + + FmBkupEngine *mBkupEngine; }; #endif //FMBACKUPSETTINGS_H diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/inc/fmbkupengine.h --- a/filemanager/src/fmbkupenginewrapper/inc/fmbkupengine.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmbkupengine.h Mon May 03 12:24:39 2010 +0300 @@ -86,12 +86,15 @@ QList< FmRestoreInfo > &restoreInfoList, const int aDrive = FmErrNotFound ); + void getBackupDriveList( QStringList &driveList ); + signals: void notifyPreparing( bool cancelable ); void notifyStart( bool cancelable, int totalCount ); void notifyUpdate( int count ); void notifyFinish( int err ); void notifyMemoryLow( int memoryValue, int &userError ); + void notifyBackupFilesExist( bool &isContinue ); private: friend class FmBkupEnginePrivate; diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp --- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Mon May 03 12:24:39 2010 +0300 @@ -19,12 +19,6 @@ #include "fmbkupengine_p.h" // INCLUDE FILES -/*#include -#include "cfilemanagerremovabledrivehandler.h" -#include "mfilemanagerprocessobserver.h" -#include "cfilemanagerutils.h" -#include "cfilemanagerengine.h" -*/ #include #include #include @@ -49,6 +43,8 @@ #include "fmcommon.h" +#include + /* #include "cfilemanageritemproperties.h" #include "cfilemanagerbackupsettings.h" @@ -102,6 +98,10 @@ QList backupCategoryList, QString drive, quint32 content) { + if( drive.isEmpty() ) { + iError = KErrPathNotFound; + return false; + } QString logString; logString = "startBackup"; FmLogger::log( logString ); @@ -182,6 +182,31 @@ logString = "startBackup_StartOperationL"; FmLogger::log( logString ); + QList< FmRestoreInfo > restoreInfoList; + TInt driveNumber = DriverNameToNumber( drive ); + GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, driveNumber ); + + for ( TInt i( 0 ); i < restoreInfoList.count(); i++ ) + { + bool toContinue = false; + FmRestoreInfo &info = restoreInfoList[ i ]; + TUint32 existContent( FmgrToBkupMask( info.content() ) ); + if ( bkupContent & existContent ) + { + notifyBackupFilesExistInternal( toContinue ); + if (!toContinue) + { + iError = KErrAlreadyExists; + return false; + } + else + { + break; + } + } + } + + TRAPD( err, iBkupEngine->StartOperationL( EMMCScBkupOperationTypeFullBackup, *this, params ) ); @@ -277,6 +302,11 @@ emit notifyMemoryLow( memoryValue, userError ); } +void FmBkupEnginePrivate::notifyBackupFilesExistInternal( bool &isContinue ) + { + emit notifyBackupFilesExist( isContinue ); + } + TInt FmBkupEnginePrivate::HandleBkupEngineEventL( MMMCScBkupEngineObserver::TEvent aEvent, TInt aAssociatedData ) { @@ -332,7 +362,7 @@ } case MMMCScBkupEngineObserver::ECommonOperationError: { - logString = "ECommonOperationError:" + QString::number(aAssociatedData); + logString = "ECommonOperationError"; iError = aAssociatedData; break; } @@ -387,6 +417,8 @@ return FmErrAlreadyExists; case KErrCancel: return FmErrCancel; + case KErrPathNotFound: + return FmErrPathNotFound; default: return FmErrUnKnown; } @@ -713,7 +745,7 @@ TUint32 FmBkupEnginePrivate::AllowedDriveAttMatchMask() const { - return KDriveAttRemovable | KDriveAttInternal;//KDriveAttRemovable; + return KDriveAttRemovable;//KDriveAttRemovable; } TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName ) @@ -729,6 +761,33 @@ return driverName; } +void FmBkupEnginePrivate::getBackupDriveList( QStringList &driveList ) + { + TUint32 driveAttMask( AllowedDriveAttMatchMask() ); + RFs fs; + fs.Connect(); + for ( TInt i( 0 ); i < KMaxDrives; ++i ) + { + TDriveInfo driveInfo; + if ( fs.Drive( driveInfo, i ) == KErrNone ) + { + // Do not allow backup for internal drives + TUint driveStatus( 0 ); + DriveInfo::GetDriveStatus( fs, i, driveStatus ); + if ( driveStatus & DriveInfo::EDriveInternal ) + { + continue; + } + if ( driveInfo.iDriveAtt & driveAttMask ) + { + driveList.append( NumberToDriverName( i ) ); + } + } + } + + fs.Close(); + } + // ----------------------------------------------------------------------------- // CFileManagerEngine::PublishBurStatus() // diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.h --- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.h Mon May 03 12:24:39 2010 +0300 @@ -31,9 +31,11 @@ #include "MMMCScBkupEngineObserver.h" #include +#include +#include + class CMMCScBkupEngine; -#include NONSHARABLE_CLASS(TMaskLookup) { public: @@ -76,6 +78,8 @@ void GetRestoreInfoArray( QList drivesAndOperationList, QList< FmRestoreInfo > &restoreInfoList, const TInt aDrive = KErrNotFound ); + + void getBackupDriveList( QStringList &driveList ); signals: void notifyPreparing( bool cancelable ); @@ -83,13 +87,14 @@ void notifyUpdate( int totalCount ); void notifyFinish( int err ); void notifyMemoryLow( int memoryValue, int &userError ); - + void notifyBackupFilesExist( bool &isContinue ); private: void notifyPreparingInternal(); void notifyStartInternal( int aTotalCount ); void notifyUpdateInternal( int aCount ); void notifyFinishInternal(); void notifyMemoryLowInternal( int memoryValue, int &userError ); + void notifyBackupFilesExistInternal( bool &isContinue ); private: // From MMMCScBkupEngineObserver TInt HandleBkupEngineEventL( diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h --- a/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h Mon May 03 12:24:39 2010 +0300 @@ -60,6 +60,8 @@ private: int DriverNameToNumber( QString driverName ); QString NumberToDriverName( int driver ); + + TBool HasMultipleBackupTargets(); signals: void notifyPreparing( bool cancelable ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/src/fmbackupsettings.cpp --- a/filemanager/src/fmbkupenginewrapper/src/fmbackupsettings.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/src/fmbackupsettings.cpp Mon May 03 12:24:39 2010 +0300 @@ -17,13 +17,17 @@ */ #include "fmbackupsettings.h" +#include "fmbkupengine.h" +#include "fmcommon.h" #include +#include #include #include -FmBackupSettings::FmBackupSettings( void ) +FmBackupSettings::FmBackupSettings( FmBkupEngine *aFmBkupEngine ) : mBkupEngine( aFmBkupEngine ) { + } FmBackupSettings::~FmBackupSettings( void ) @@ -219,6 +223,9 @@ case EFileManagerBackupWeekdayFriday: ret = constFileManagerBackupWeekdayFirday; break; + case EFileManagerBackupWeekdaySaturday: + ret = constFileManagerBackupWeekdaySaturday; + break; case EFileManagerBackupWeekdaySunday: ret = constFileManagerBackupWeekdaySunday; break; @@ -280,8 +287,13 @@ mBackupEntryList.push_back( entry ); } - entry = createTargetDriveEntry(); - mBackupEntryList.push_back( entry ); + QStringList driveList; + mBkupEngine->getBackupDriveList( driveList ); + + if( driveList.count() > 1 ) { + entry = createTargetDriveEntry(); + mBackupEntryList.push_back( entry ); + } } void FmBackupSettings::resetAndDestoryBackupEntry() @@ -299,6 +311,12 @@ void FmBackupSettings::load() { + + QStringList driveList; + mBkupEngine->getBackupDriveList( driveList ); + QString defaultDrive( driveList.first() ); + + QSettings settings("Nokia", "FileManager"); settings.beginGroup("BackupConfigure"); @@ -307,7 +325,7 @@ mScheduling = (TFileManagerBackupSchedule)(settings.value("scheduling", EFileManagerBackupScheduleNever ).toInt()); // Never schedule for default value mWeekday = (TFileManagerBackupWeekday)(settings.value("weekday", EFileManagerBackupWeekdayMonday ).toInt()); // monday for default value mTime = (settings.value("time", QTime::currentTime() ).toTime()); // empty for default - mTargetDrive = (settings.value("targetDrive", "c:") ).toString(); // C for default + mTargetDrive = (settings.value("targetDrive", defaultDrive ) ).toString(); // C for default settings.endGroup(); refreshList(); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp --- a/filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp Mon May 03 12:24:39 2010 +0300 @@ -32,6 +32,7 @@ connect( d, SIGNAL( notifyFinish(int) ), this, SIGNAL( notifyFinish(int) ) ); connect( d, SIGNAL( notifyMemoryLow(int, int& ) ), this, SIGNAL( notifyMemoryLow(int, int&) ) ); + connect( d, SIGNAL( notifyBackupFilesExist( bool& )), this, SIGNAL( notifyBackupFilesExist( bool&) ) ); } @@ -71,7 +72,7 @@ { if ( !iBackupSettings ) { - iBackupSettings = new FmBackupSettings(); + iBackupSettings = new FmBackupSettings( this ); } return iBackupSettings; } @@ -88,13 +89,18 @@ void FmBkupEngine::GetRestoreInfoArray( QList &drivesAndOperationList, QList< FmRestoreInfo > &restoreInfoList, const int aDrive ) - { +{ d->GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, aDrive ); - } +} int FmBkupEngine::deleteBackup( QList drivesAndOperationList ) - { +{ return d->deleteBackup( drivesAndOperationList ); - } +} +void FmBkupEngine::getBackupDriveList( QStringList &driveList ) +{ + d->getBackupDriveList( driveList ); +} + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/fmfiledialog.pro --- a/filemanager/src/fmfiledialog/fmfiledialog.pro Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmfiledialog/fmfiledialog.pro Mon May 03 12:24:39 2010 +0300 @@ -14,6 +14,7 @@ CONFIG += hb TEMPLATE = lib DEFINES += FMFILEDIALOG_LIBRARY +RESOURCES += fmfiledialog.qrc include ( ../common.pri ) include ( ../inc/commoninc.pri ) include ( ../inc/commonutils.pri ) @@ -24,7 +25,12 @@ -lapmime \ -lxqservice \ -lxqutils \ - -lshareui + -lshareui \ + -lefsrv \ + -lapgrfx \ + -lcone \ + -ldirectorylocalizer + TARGET.UID3 = 0x2002BCC2 # export headers to app diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/fmfiledialog.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/fmfiledialog.qrc Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,11 @@ + + + image/qtg_indi_status_back.svg + image/qgn_prop_mmc_locked.svg + image/qgn_prop_mmc_memc.svg + image/qgn_prop_fmgr_mmc_no_sub.svg + image/qgn_prop_phone_memc.svg + image/qgn_prop_usb_memc.svg + image/qgn_prop_fmgr_ms.svg + + \ No newline at end of file diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/image/qgn_prop_fmgr_mmc_no_sub.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_fmgr_mmc_no_sub.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/image/qgn_prop_fmgr_ms.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_fmgr_ms.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/image/qgn_prop_mmc_locked.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_mmc_locked.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/image/qgn_prop_mmc_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_mmc_memc.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/image/qgn_prop_phone_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_phone_memc.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/image/qgn_prop_usb_memc.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qgn_prop_usb_memc.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/image/qtg_indi_status_back.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/fmfiledialog/image/qtg_indi_status_back.svg Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,17 @@ + + + +]> + + + + + + diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp --- a/filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp Mon May 03 12:24:39 2010 +0300 @@ -28,7 +28,7 @@ #include #include -const char *backButtonIcon = "qtg_indi_status_back.png"; +#define backButtonIcon ":image/qtg_indi_status_back.svg" /*! constructor @@ -251,7 +251,9 @@ case GetDirMode: break; case GetFileMode: - mFileNameLineEdit->setReadOnly( true ); + if( mFileNameLineEdit ){ + mFileNameLineEdit->setReadOnly( true ); + } break; case SaveFileMode: if( mFileWidget->currentPath().absoluteFilePath().isEmpty() ) { @@ -277,7 +279,7 @@ case GetFileMode: case SaveFileMode: if( mFileWidget->currentPath().absoluteFilePath().isEmpty() || - mFileNameLineEdit->text().isEmpty() ) { + ( mFileNameLineEdit && mFileNameLineEdit->text().isEmpty() ) ) { mOkAction->setDisabled( true ); } else { mOkAction->setDisabled( false ); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/src/fmfilewidget.cpp --- a/filemanager/src/fmfiledialog/src/fmfilewidget.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmfiledialog/src/fmfilewidget.cpp Mon May 03 12:24:39 2010 +0300 @@ -19,9 +19,10 @@ #include "fmfilewidget.h" #include "fmutils.h" #include "fmdrivemodel.h" +#include "fmdrivewatcher.h" -#include -#include +#include "hbstyle.h" +#include "hbabstractitemview.h" #include #include @@ -43,6 +44,10 @@ setModel( 0 ); delete mDirModel; delete mDriveModel; + + mDriveWatcher->cancelWatch(); + delete mDriveWatcher; + mDriveWatcher = 0; } QFileInfo FmFileWidget::currentPath() const @@ -142,9 +147,18 @@ qDebug("setmodel"); qDebug( QTime::currentTime().toString().toUtf8().data() ); + mDriveWatcher = new FmDriveWatcher( this ); + mDriveWatcher->setObjectName( "driveWatcher" ); + mDriveWatcher->startWatch(); + // QMetaObject::connectSlotsByName( this ); connect( mListView, SIGNAL( activated( QModelIndex ) ), this, SLOT( on_list_activated( QModelIndex ) ) ); + + connect( mDriveWatcher, SIGNAL( driveAddedOrChanged() ), + this, SLOT( on_driveWatcher_driveAddedOrChanged() ) ); + + } void FmFileWidget::setModel( QAbstractItemModel *model ) @@ -178,3 +192,23 @@ setRootPath( FmUtils::fillPathWithSplash( cdUpPath ) ); return true; } + +void FmFileWidget::on_driveWatcher_driveAddedOrChanged() +{ + FmLogger::log( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged start" ) ); + mDriveModel->refresh(); + if( currentViewType() == DriveView ) { + setModel( 0 ); + setModel( mDriveModel ); + emit pathChanged( QString() ); + } else if( currentViewType() == DirView ) { + if( !FmUtils::isPathAccessabel( currentPath().absoluteFilePath() ) ) { + // path not available, set model to drive + FmLogger::log( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged path not availeable, set drivemodel:" + + currentPath().absoluteFilePath() ) ); + setModel( mDriveModel ); + emit pathChanged( QString() ); + } + } + FmLogger::log( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged end" ) ); +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/fmfiledialog/src/fmfilewidget.h --- a/filemanager/src/fmfiledialog/src/fmfilewidget.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/fmfiledialog/src/fmfilewidget.h Mon May 03 12:24:39 2010 +0300 @@ -26,6 +26,7 @@ class QDirModel; class FmDriveModel; +class FmDriveWatcher; class HbListView; class QGraphicsLinearLayout; @@ -55,6 +56,7 @@ private slots: void on_list_activated( const QModelIndex &index ); + void on_driveWatcher_driveAddedOrChanged(); private: void init(); @@ -68,6 +70,7 @@ FmDriveModel *mDriveModel; QAbstractItemModel *mCurrentModel; + FmDriveWatcher *mDriveWatcher; }; diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/commonutils.pri --- a/filemanager/src/inc/commonutils.pri Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/inc/commonutils.pri Mon May 03 12:24:39 2010 +0300 @@ -15,18 +15,30 @@ # INTERNAL_HEADERS += $$PWD/fmutils.h \ - $$PWD/fmdrivemodel.h + $$PWD/fmdrivemodel.h \ + $$PWD/fmfileiconprovider.h \ + $$PWD/fmdrivewatcher/fmdrivewatcher.h -INTERNAL_SOURCES += $$PWD/fmdrivemodel.cpp +INTERNAL_SOURCES += $$PWD/fmdrivemodel.cpp \ + $$PWD/fmfileiconprovider.cpp \ + $$PWD/fmdrivewatcher/fmdrivewatcher.cpp symbian { - INTERNAL_HEADERS += $$PWD/fms60utils.h + INTERNAL_HEADERS += $$PWD/fms60utils.h \ + $$PWD/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h \ + $$PWD/fmdrivewatcher/private/symbian/fmdriveevent.h INTERNAL_SOURCES += $$PWD/fmutils_s60.cpp \ - $$PWD/fms60utils.cpp + $$PWD/fms60utils.cpp \ + $$PWD/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp \ + $$PWD/fmdrivewatcher/private/symbian/fmdriveevent.cpp } win32 { - INTERNAL_SOURCES += $$PWD/fmutils_win.cpp + INTERNAL_HEADERS += $$PWD/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h + + INTERNAL_SOURCES += $$PWD/fmutils_win.cpp \ + $$PWD/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp + } HEADERS += $$INTERNAL_HEADERS diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmcommon.h --- a/filemanager/src/inc/fmcommon.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/inc/fmcommon.h Mon May 03 12:24:39 2010 +0300 @@ -10,10 +10,10 @@ * Nokia Corporation - initial contribution. * * Contributors: -* Zhiqiang Yang +* * * Description: -* The common header file of filemanager +* The header file of the file manager */ #ifndef FMCOMMON_H diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdefine.h --- a/filemanager/src/inc/fmdefine.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/inc/fmdefine.h Mon May 03 12:24:39 2010 +0300 @@ -1,4 +1,4 @@ -#/* +/* * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available @@ -40,7 +40,13 @@ #define FmErrDestPathDoNotExist -19 #define FmErrCopyDestToSubFolderInSrc -20 #define FmErrMoveDestToSubFolderInSrc -21 - +#define FmErrNotSupported -22 +#define FmErrNotReady -23 +#define FmErrInUse -24 +#define FmErrPermissionDenied -25 +#define FmErrBadName -26 +#define FmErrPathNotFound -27 +#define FmErrRemoveDefaultFolder -28 #define FmEstimateUpperLimit 90 // available mem/backup size*100%=90%, User selectable continuation #define FmEstimateLowerLimit 10 // available mem/backup size*100%=10%, Backup will be interrupted @@ -52,4 +58,6 @@ #define Drive_Z "Z:/" #define Folder_C_Data "C:/Data" -#endif +#define FmMaxLengthofDriveName 11 + +#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivemodel.cpp --- a/filemanager/src/inc/fmdrivemodel.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/inc/fmdrivemodel.cpp Mon May 03 12:24:39 2010 +0300 @@ -16,6 +16,7 @@ */ #include "fmdrivemodel.h" +#include "fmfileiconprovider.h" #include "fmutils.h" #include @@ -24,11 +25,11 @@ FmDriveModel::FmDriveModel( QObject *parent, Options options ) : QAbstractListModel( parent ), mOptions( options ) { - mIconProvider = new QFileIconProvider(); + mIconProvider = new FmFileIconProvider(); refresh(); } -FmDriveModel::~FmDriveModel(void) +FmDriveModel::~FmDriveModel() { delete mIconProvider; } @@ -39,8 +40,10 @@ mDriveList.clear(); if( mOptions & HideUnAvailableDrive ) { + FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_true" ) ); FmUtils::getDriveList( mDriveList, true ); } else { + FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_false" ) ); FmUtils::getDriveList( mDriveList, false ); } emit layoutChanged(); diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.cpp Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,47 @@ +/* +* 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: +* The source file of drive watcher +*/ + +#include "fmdrivewatcher.h" + +#include "fmdrivewatcherprivate.h" + +FmDriveWatcher::FmDriveWatcher( QObject *parent ) : QObject( parent ) +{ + d = new FmDriveWatcherPrivate( this ); + connect( d, SIGNAL(driveAddedOrChanged()), this, SLOT( onDriveAddedOrChanged() )); +} + +FmDriveWatcher::~FmDriveWatcher() +{ + delete d; +} + + +void FmDriveWatcher::startWatch() +{ + d->startWatch(); +} +void FmDriveWatcher::cancelWatch() +{ + d->cancelWatch(); +} + +void FmDriveWatcher::onDriveAddedOrChanged() +{ + emit driveAddedOrChanged(); +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/fmdrivewatcher.h Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,44 @@ +/* +* 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: +* The header file of drive watcher +*/ + +#ifndef FMDRIVEWATCHER_H +#define FMDRIVEWATCHER_H + +#include + +class FmDriveWatcherPrivate; + +class FmDriveWatcher : public QObject +{ +Q_OBJECT +public: + FmDriveWatcher( QObject *parent = 0 ); + virtual ~FmDriveWatcher(); + void startWatch(); + void cancelWatch(); + +signals: + void driveAddedOrChanged(); +private slots: + void onDriveAddedOrChanged(); +private: + FmDriveWatcherPrivate *d; +}; + + +#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,150 @@ +/* +* 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: +* The source file of drive event watcher +*/ + + +// INCLUDE FILES +#include +#include "fmdriveevent.h" +#include "fmcommon.h" + +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CFileManagerFileSystemEvent::CFileManagerFileSystemEvent +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// + +CFmDriveEvent::CFmDriveEvent( + RFs& aFs, + MFmDriveEventObserver *aObserver ) : + CActive( CActive::EPriorityLow ), + iFs( aFs ), + iObserver( aObserver ) + { + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CFmDriveEvent::ConstructL() + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CFmDriveEvent* CFmDriveEvent::NewL( + RFs& aFs, + MFmDriveEventObserver *aObserver ) + { + CFmDriveEvent* self = + new( ELeave ) CFmDriveEvent( + aFs, + aObserver ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// ------------------------------------------------------------------------------ +// CFmDriveEvent::~CFmDriveEvent +// +// ------------------------------------------------------------------------------ +CFmDriveEvent::~CFmDriveEvent() + { + Cancel(); + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::RunError +// From CActive. Called when error occurred in asynchronous request +// Notifies the observer +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CFmDriveEvent::RunError( TInt /*aError*/ ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::DoCancel +// From CActive. Called when asynchronous request is canceled +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CFmDriveEvent::DoCancel() + { + iFs.NotifyChangeCancel( iStatus ); + } + +// ------------------------------------------------------------------------------ +// CFmDriveEvent::Setup +// +// ------------------------------------------------------------------------------ +// +void CFmDriveEvent::Setup() + { + FmLogger::log( QString( "CFmDriveEvent::Setup start" ) ); + if( IsActive() ) + { + return; + } + + iFs.NotifyChange( ENotifyDisk, iStatus ); + SetActive(); + FmLogger::log( QString( "CFmDriveEvent::Setup end" ) ); + } + +// ----------------------------------------------------------------------------- +// CFmDriveEvent::RunL +// From CActive. Called when asynchronous request is completed. +// Notifies the observer +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void CFmDriveEvent::RunL() + { + if( iStatus == KErrNone ){ + if( iObserver ){ + iObserver->OnDriveAddedOrChangedL(); + } + + Setup(); + } + + /* + CAknInformationNote* informationNote; + informationNote = new ( ELeave ) CAknInformationNote; + informationNote->ExecuteLD( _L( "driveChanged!")); + */ + } + +// End of File diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.h Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,103 @@ +/* +* 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: +* The header file of drive event watcher +*/ + +#ifndef CFMDRIVEEVENT_H +#define CFMDRIVEEVENT_H + + +// INCLUDES +#include +#include + +class MFmDriveEventObserver + { + public: + virtual void OnDriveAddedOrChangedL() = 0; + }; +// CLASS DECLARATION + +/** +* This class listens file system events +* +* @lib FileManagerEngine.lib +* @since 2.0 +*/ +NONSHARABLE_CLASS(CFmDriveEvent) : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CFmDriveEvent* NewL( RFs& aFs, MFmDriveEventObserver* aObserver ); + + /** + * Destructor. + */ + virtual ~CFmDriveEvent(); + + public: + + /** + * Sets file system event + * @since 2.0 + */ + void Setup(); + + protected: // Functions from base classes + + /** + * From CActive Called when asynchronous request has completed + * @since 2.0 + */ + void RunL(); + + /** + * From CActive Called when asynchronous request has failed + * @since 2.0 + */ + TInt RunError( TInt aError ); + + /** + * From CActive Called when asynchronous request was cancelled + * @since 2.0 + */ + void DoCancel(); + + private: + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * C++ default constructor. + */ + CFmDriveEvent( RFs& aFs, MFmDriveEventObserver* aObserver ); + + private: // Data + // Ref: Reference to opened File System session + RFs& iFs; + + // Ref: This object is called when RunL occurs + MFmDriveEventObserver *iObserver; + }; + +#endif // CFMDRIVEEVENT_H + +// End of File diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,53 @@ +/* +* 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: +* The source file of drive event watcher private +*/ + +#include "fmdrivewatcherprivate.h" + +#include "fmdrivewatcher.h" +#include "fmcommon.h" + +FmDriveWatcherPrivate::FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ) : + q( driveWatcher ) +{ + fs.Connect(); + mDriveEvent = CFmDriveEvent::NewL( fs, this ); +} + +FmDriveWatcherPrivate::~FmDriveWatcherPrivate() +{ + fs.Close(); + delete mDriveEvent; +} + + +void FmDriveWatcherPrivate::startWatch() +{ + mDriveEvent->Setup(); +} + +void FmDriveWatcherPrivate::cancelWatch() +{ + mDriveEvent->Cancel(); +} + +void FmDriveWatcherPrivate::OnDriveAddedOrChangedL() +{ + FmLogger::log( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL start" ) ); + emit driveAddedOrChanged(); + FmLogger::log( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL end" ) ); +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.h Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,53 @@ +/* +* 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: +* The header file of drive event watcher private +*/ + +#ifndef FMDRIVEWATCHERPRIVATE_H +#define FMDRIVEWATCHERPRIVATE_H + +#include + +#include "fmdriveevent.h" + +#include + +class FmDriveWatcher; + +class FmDriveWatcherPrivate : public QObject, public MFmDriveEventObserver +{ +Q_OBJECT +public: + FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ); + virtual ~FmDriveWatcherPrivate(); + + void startWatch(); + void cancelWatch(); + + void onDriveAdded(); + void onDriveRemoved(); + + void OnDriveAddedOrChangedL(); +signals: + void driveAddedOrChanged(); + +private: + FmDriveWatcher *q; + CFmDriveEvent *mDriveEvent; + RFs fs; +}; + +#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.cpp Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,50 @@ +/* +* 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: +* The source file of drive event watcher private +*/ + +#include "fmdrivewatcherprivate.h" + +#include "fmdrivewatcher.h" + +FmDriveWatcherPrivate::FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ) : + q( driveWatcher ) +{ +} + +FmDriveWatcherPrivate::~FmDriveWatcherPrivate() +{ +} + + +void FmDriveWatcherPrivate::startWatch() +{ + +} + +void FmDriveWatcherPrivate::cancelWatch() +{ + +} + +void FmDriveWatcherPrivate::onDriveAdded() +{ + +} +void FmDriveWatcherPrivate::onDriveRemoved() +{ + +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,46 @@ +/* +* 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: +* The header file of drive event watcher private +*/ + +#ifndef FMDRIVEWATCHERPRIVATE_H +#define FMDRIVEWATCHERPRIVATE_H + +#include + +class FmDriveWatcher; + +class FmDriveWatcherPrivate : public QObject +{ +Q_OBJECT +public: + FmDriveWatcherPrivate( FmDriveWatcher *driveWatcher ); + virtual ~FmDriveWatcherPrivate(); + + void startWatch(); + void cancelWatch(); + + void onDriveAdded(); + void onDriveRemoved(); + +signals: + void driveAddedOrChanged(); + +private: + FmDriveWatcher *q; +}; + +#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmfileiconprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmfileiconprovider.cpp Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,71 @@ +/* +* 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: filemanager file icon provider source file +* +*/ + +#include "fmfileiconprovider.h" +#include "fmutils.h" + +#include +#include + +#define mmcIcon ":image/qgn_prop_mmc_memc.svg" +#define mmcNoneIcon ":image/qgn_prop_fmgr_mmc_no_sub.svg" +#define mmcLockedIcon ":image/qgn_prop_mmc_locked.svg" +#define phoneMemoryIcon ":image/qgn_prop_phone_memc.svg" +#define usbMemoryIcon ":image/qgn_prop_usb_memc.svg" +#define massMemoryIcon ":image/qgn_prop_fmgr_ms.svg" + +FmFileIconProvider::FmFileIconProvider() +{ + +} + +FmFileIconProvider::~FmFileIconProvider() +{ +} + +QIcon FmFileIconProvider::icon(const QFileInfo &info) const +{ + QString filePath( info.path() ); + if( FmUtils::isDrive( filePath ) ) { + FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( filePath ).driveState(); + if( driveState & FmDriverInfo::EDriveAvailable ){ + if( driveState & FmDriverInfo::EDriveRemovable ) { + if( driveState & FmDriverInfo::EDriveMassStorage ) { + // Mass Storage + return QIcon( massMemoryIcon ); + } + else{ + //Memory Card + return QIcon( mmcIcon ); + } + } else{ + //Phone Memory + return QIcon( phoneMemoryIcon ); + } + } else if( driveState & FmDriverInfo::EDriveLocked ) { + return QIcon( mmcLockedIcon ); + } else if( driveState & FmDriverInfo::EDriveCorrupted ) { + return QIcon( mmcNoneIcon ); + } else if( driveState & FmDriverInfo::EDriveNotPresent ){ + return QIcon( mmcNoneIcon ); + } else { + return QIcon( mmcNoneIcon ); + } + } else { + return QFileIconProvider::icon( info ); + } +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmfileiconprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/src/inc/fmfileiconprovider.h Mon May 03 12:24:39 2010 +0300 @@ -0,0 +1,35 @@ +/* +* 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: +* The header file of file icon provider of filemanager +*/ + +#ifndef FMFILEICONPROVIDER_H +#define FMFILEICONPROVIDER_H + +#include + +class FmFileIconProvider : public QFileIconProvider +{ +public: + FmFileIconProvider(); + virtual ~FmFileIconProvider(); + + virtual QIcon icon(const QFileInfo &info) const; + +private: + +}; + +#endif diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmutils.h --- a/filemanager/src/inc/fmutils.h Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/inc/fmutils.h Mon May 03 12:24:39 2010 +0300 @@ -26,26 +26,6 @@ class FmDriverInfo { public: - FmDriverInfo( quint64 s, quint64 f, const QString &n, const QString &vN ) : mSize( s ), mFreeSize( f ), mName( n ), mVolumeName( vN ) {} - FmDriverInfo( const FmDriverInfo &other ) - { - *this = other; - } - - FmDriverInfo &operator= ( const FmDriverInfo &rhs ) - { - this->mSize = rhs.mSize; - this->mFreeSize = rhs.mFreeSize; - this->mName = rhs.mName; - this->mVolumeName = rhs.mVolumeName; - return *this; - } - - quint64 size() const { return mSize; } - quint64 freeSize() const { return mFreeSize; } - QString name() const { return mName; } - QString volumeName() const { return mVolumeName; } - enum driveState { EDriveNotPresent = 0x1, @@ -63,48 +43,82 @@ EDriveEjectable = 0x1000, EDriveInUse = 0x2000, EDriveMassStorage = 0x4000, - EDriveRam = 0x8000 + EDriveRam = 0x8000, + EDriveAvailable = 0x10000 }; + Q_DECLARE_FLAGS( DriveState, driveState ) + + FmDriverInfo( quint64 s, quint64 f, const QString &n, const QString &vN, const quint32 driveState ) : + mSize( s ), mFreeSize( f ), mName( n ), mVolumeName( vN ), mDriveState( driveState ) {} + FmDriverInfo( const FmDriverInfo &other ) + { + *this = other; + } + + FmDriverInfo &operator= ( const FmDriverInfo &rhs ) + { + this->mSize = rhs.mSize; + this->mFreeSize = rhs.mFreeSize; + this->mName = rhs.mName; + this->mVolumeName = rhs.mVolumeName; + this->mDriveState = rhs.mDriveState; + return *this; + } + + quint64 size() const { return mSize; } + quint64 freeSize() const { return mFreeSize; } + QString name() const { return mName; } + QString volumeName() const { return mVolumeName; } + DriveState driveState() const { return mDriveState; } + private: quint64 mSize; quint64 mFreeSize; QString mName; QString mVolumeName; + DriveState mDriveState; }; +Q_DECLARE_OPERATORS_FOR_FLAGS( FmDriverInfo::DriveState ) class FmUtils { public: static QString getDriveNameFromPath( const QString &path ); + static QString getDriveLetterFromPath( const QString &path ); static FmDriverInfo queryDriverInfo( const QString &driverName ); static QString formatStorageSize( quint64 size ); - static quint32 getDriverState( const QString &driverName ); + //static quint32 getDriverState( const QString &driverName ); static int removeDrivePwd( const QString &driverName, const QString &Pwd ); static int unlockDrive( const QString &driverName, const QString &Pwd ); + static int checkDrivePwd( const QString &driverName, const QString &pwd); static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd); static void emptyPwd( QString &pwd ); static int renameDrive( const QString &driverName, const QString &newVolumeName); - static int ejectDrive( const QString &driverName ); - static int formatDrive( const QString &driverName ); + static void ejectDrive( const QString &driverName ); static QString getFileType( const QString &filePath ); static quint64 getDriveDetailsResult( const QString &folderPath, const QString &extension ); static bool isDriveC( const QString &driverName ); + static bool isDrive( const QString &path ); static void createDefaultFolders( const QString &driverName ); static QString fillPathWithSplash( const QString &filePath ); static QString removePathSplash( const QString &filePath ); + static QString formatPath( const QString &path ); static bool checkDriveFilter( const QString &driveName ); static QString checkDriveToFolderFilter( const QString &path ); static QString checkFolderToDriveFilter( const QString &path ); static bool isPathAccessabel( const QString &path ); static bool isDriveAvailable( const QString &path ); + static bool isPathEqual( const QString &pathFst, const QString &pathLast ); /// fill driveList of drives can be shown in driveListView static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ); static QString fillDriveVolume( QString driveName, bool isFillWithDefaultVolume ); static int launchFile( const QString &filePath ); - static void sendFiles( QList filePathList ); + static void sendFiles( QStringList &filePathList ); static QString getBurConfigPath( QString appPath ); + static bool isDefaultFolder( const QString &folderPath ); + static QString Localize( const QString &path ); }; diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmutils_s60.cpp --- a/filemanager/src/inc/fmutils_s60.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/inc/fmutils_s60.cpp Mon May 03 12:24:39 2010 +0300 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -51,19 +52,95 @@ return path.left( 3 ); } +QString FmUtils::getDriveLetterFromPath( const QString &path ) +{ + if( path.length() <2 ) { + return QString(); + } + return path.left( 1 ); +} + FmDriverInfo FmUtils::queryDriverInfo( const QString &driverName ) { - CCoeEnv *env = CCoeEnv::Static(); - RFs& fs = env->FsSession(); + CCoeEnv *env = CCoeEnv::Static(); + RFs& fs = env->FsSession(); + + TVolumeInfo volumeInfo; + TInt drive = 0; + drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; + + quint32 state( 0 ); + int err = fs.Volume( volumeInfo, drive ); + QString volumeName( (QChar*)( volumeInfo.iName.Des().Ptr() ), volumeInfo.iName.Length() ); - TVolumeInfo volumeInfo; - TInt drive = 0; - drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; - - fs.Volume( volumeInfo, drive ); - QString volumeName( (QChar*)( volumeInfo.iName.Des().Ptr() ), volumeInfo.iName.Length() ); - - return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driverName, volumeName ); + if( err == KErrNone ) { + TDriveInfo driveInfo = volumeInfo.iDrive; + + quint32 drvStatus( 0 ); + err = DriveInfo::GetDriveStatus( fs, drive, drvStatus ); + if( err == KErrNone ) { + QString logString = driverName +':'+ QString::number( drvStatus); + FmLogger::log(logString); + + if ( ( drvStatus & DriveInfo::EDriveInternal ) && + ( drvStatus & DriveInfo::EDriveExternallyMountable ) ){ + // Handle mass storage bits here + + state |= FmDriverInfo::EDriveMassStorage | FmDriverInfo::EDriveRemovable; + } + + + if ( drvStatus & DriveInfo::EDriveRom ){ + state |= FmDriverInfo::EDriveRom; + } + + if ( drvStatus & DriveInfo::EDriveRam ){ + state |= FmDriverInfo::EDriveRam; + } + + if ( driveInfo.iMediaAtt & KMediaAttFormattable ){ + state |= FmDriverInfo::EDriveFormattable; + } + if ( driveInfo.iMediaAtt & KMediaAttWriteProtected ){ + state |= FmDriverInfo::EDriveWriteProtected; + } + if ( driveInfo.iMediaAtt & KMediaAttHasPassword ){ + state |= FmDriverInfo::EDrivePasswordProtected; + } + if ( driveInfo.iMediaAtt & KMediaAttLocked ){ + state |= FmDriverInfo::EDriveLocked; + } + + if ( driveInfo.iDriveAtt & KDriveAttRemovable ){ + state |= FmDriverInfo::EDriveRemovable; + + if ( drvStatus & DriveInfo::EDriveSwEjectable ){ + state |= FmDriverInfo::EDriveEjectable; + } + } + + if( driveInfo.iType == EMediaNotPresent ){ + state |= FmDriverInfo::EDriveNotPresent; + } + } + } + //handle error code + switch( err ) + { + case KErrNone: + state |= FmDriverInfo::EDriveAvailable; + break; + case KErrLocked: + state |= FmDriverInfo::EDriveLocked; + break; + case KErrCorrupt: + state |= FmDriverInfo::EDriveCorrupted; + break; + default: // other errors + state |= FmDriverInfo::EDriveNotPresent; + break; + } + return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driverName, volumeName, state ); } QString FmUtils::formatStorageSize( quint64 size ) @@ -78,19 +155,21 @@ return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB"; } } +/* quint32 FmUtils::getDriverState( const QString &driverName ) { - quint32 state( 0 ); CCoeEnv *env = CCoeEnv::Static(); - RFs& fs = env->FsSession(); + RFs& fs = env->FsSession(); - TVolumeInfo volumeInfo; - TInt drive = 0; - drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; + TVolumeInfo volumeInfo; + TInt drive = 0; + drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; - int err = fs.Volume( volumeInfo, drive ); + quint32 state( 0 ); + int err = fs.Volume( volumeInfo, drive ); + QString volumeName( (QChar*)( volumeInfo.iName.Des().Ptr() ), volumeInfo.iName.Length() ); - //handle error code + //handle error code if( err != KErrNone ) { state |= FmDriverInfo::EDriveNotPresent; } @@ -150,6 +229,7 @@ return state; } +*/ int FmUtils::removeDrivePwd( const QString &driverName, const QString &Pwd ) { @@ -178,7 +258,15 @@ logString = "Clear password error:" + QString::number( err ); FmLogger::log( logString ); - return err; + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrAccessDenied ){ + return FmErrAccessDenied; + } + else{ + return FmErrUnKnown; + } } int FmUtils::unlockDrive( const QString &driverName, const QString &Pwd ) @@ -206,16 +294,37 @@ logString = "Unlock drive error:" + QString::number( err ); FmLogger::log( logString ); - return err; + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrAccessDenied ){ + return FmErrAccessDenied; + } + else if( err == KErrAlreadyExists ){ + return FmErrAlreadyExists; + } + else if( err == KErrNotSupported ){ + return FmErrNotSupported; + } + else{ + return FmErrUnKnown; + } +} + +int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd ) +{ + QString logString = "checkDrivePwd Drive name:" + driverName; + logString += " password:" + pwd; + FmLogger::log( logString ); + + return setDrivePwd( driverName, pwd, pwd ); } int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd) { - QString logString = "Drive name:" + driverName; - FmLogger::log( logString ); - logString = "Old password:" + oldPwd; - FmLogger::log( logString ); - logString = "New password:" + newPwd; + QString logString = "setDrivePwd Drive name:" + driverName ; + logString += " Old password:" + oldPwd; + logString += " New password:" + newPwd; FmLogger::log( logString ); CCoeEnv *env = CCoeEnv::Static(); @@ -236,10 +345,6 @@ FmS60Utils::ConvertCharsToPwd( ptrNewPassword16, newPassword ); FmS60Utils::ConvertCharsToPwd( ptrOldPassword16, oldPassword ); - //oldPassword.FillZ(oldPassword.MaxLength()); - //oldPassword.Zero(); - //newPassword.Copy(_L8("A")); - int err( fs.LockDrive( drive, oldPassword, newPassword, ETrue ) ); logString = "Drive:" + QString::number( drive ); @@ -247,7 +352,15 @@ logString = "Password set error:" + QString::number( err ); FmLogger::log( logString ); - return err; + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrNotSupported ){ + return FmErrNotSupported; + } + else{ + return FmErrUnKnown; + } } void FmUtils::emptyPwd( QString &pwd ) @@ -260,6 +373,17 @@ int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName) { + foreach( QChar ch, newVolumeName ) + { + bool a = ch.isSpace(); + bool b = ch.isLetterOrNumber(); + // If not alphadigit or space, return error + if( !ch.isLetterOrNumber() && !ch.isSpace() ) + { + return FmErrBadName; + } + } + CCoeEnv *env = CCoeEnv::Static(); RFs& fs = env->FsSession(); @@ -273,154 +397,33 @@ QString logString = "Rename error:" + QString::number( err ); FmLogger::log( logString ); - return err; + if( err == KErrNone ){ + return FmErrNone; + } + else if( err == KErrNotReady ){ + return FmErrNotReady; + } + else{ + return FmErrUnKnown; + } } -int FmUtils::ejectDrive( const QString &driverName ) +void FmUtils::ejectDrive( const QString &driverName ) { - CCoeEnv *env = CCoeEnv::Static(); - RFs& fs = env->FsSession(); + QString logString = "FmUtils::ejectDrive start"; + FmLogger::log( logString ); TInt drive = 0; drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; const int KDriveShift = 16; - - TFileName fileSystemName; - TInt err = fs.FileSystemName( fileSystemName, drive ); + // Let SysAp handle eject RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsMmcRemovedWithoutEject, ECoreAppUIsEjectCommandUsedToDrive | ( drive << KDriveShift ) ); - - err = fs.DismountFileSystem( fileSystemName, drive ); - - if (err == KErrNone){ - // remount the file system - err = fs.MountFileSystem( fileSystemName, drive ); - - if (err == KErrInUse){ - // try to remount after a while if locked - User::After(1000000); - err = fs.MountFileSystem( fileSystemName, drive ); - } - } - - return err; -} - -int FmUtils::formatDrive( const QString &driverName ) -{ - RFormat format; - -// CCoeEnv *env = CCoeEnv::Static(); -// RFs& fs = env->FsSession(); - - RFs fs; - int err = fs.Connect(); - - if( err != KErrNone ){ - return FmErrTypeFormatFailed; - } - - TInt drive = 0; - drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; - - TDriveName formatDriveName( TDriveUnit( drive ).Name() ); - - int finalValue = 0; - - format.Close(); - - err = format.Open( - fs, formatDriveName, EFullFormat | ESpecialFormat, finalValue ); - - QString logString = "Format open error:" + QString::number( err ); - FmLogger::log( logString ); - - if( err == KErrLocked ){ - err = fs.ErasePassword( drive ); - - logString = "ErasePassword error:" + QString::number( err ); - FmLogger::log( logString ); - - if( err == KErrNone ){ - err = format.Open( - fs, formatDriveName, EFullFormat, finalValue ); - - logString = "Second format open error:" + QString::number( err ); - FmLogger::log( logString ); - } - } - - if (err == KErrInUse){ - TBool reallyFormat = ETrue; - if (reallyFormat) - { - err = format.Open( - fs, formatDriveName, EFullFormat | EForceFormat, finalValue ); - - logString = "Reallyformat open error:" + QString::number( err ); - FmLogger::log( logString ); - } - } - - TFullName fsName; - if ( err == KErrNone ) - { - err = fs.FileSystemName( fsName, drive ); - - logString = "FileSystemName error:" + QString::number( err ); - FmLogger::log( logString ); - - if ( err == KErrNone && fsName.Length() > 0 ) - { - // Prevent SysAp shutting down applications - RProperty::Set( - KPSUidCoreApplicationUIs, - KCoreAppUIsMmcRemovedWithoutEject, - ECoreAppUIsEjectCommandUsed ); - - logString = "Prevent SysAp shutting down applications" ; - FmLogger::log( logString ); - } - else - { - // Don't continue with format if there is no file system name - // or file system name could not be obtained. - err = KErrCancel; - - logString = "Format cancel:" + QString::number( err ); - FmLogger::log( logString ); - } - } - - if( err == KErrNone && finalValue ){ - - while ( finalValue ){ - logString = "Format tracks:" + QString::number( finalValue ); - FmLogger::log( logString ); - - err = format.Next( finalValue ); - - if( err != KErrNone ){ - logString = "Format error:" + QString::number( err ); - FmLogger::log( logString ); - break; - } - } - } - - if( !finalValue || err != KErrNone ){ - format.Close(); - fs.Close(); - - createDefaultFolders( driverName ); - } - - return FmErrNone; } QString FmUtils::getFileType( const QString &filePath ) @@ -449,20 +452,11 @@ quint64 FmUtils::getDriveDetailsResult( const QString &folderPath, const QString &extension ) { int err; -// CCoeEnv *env = CCoeEnv::Static(); -// RFs& fs = env->FsSession(); RFs fs; err = fs.Connect(); - QString string( folderPath ); - - QRegExp regExp( "/" ); - string.replace( regExp, "\\" ); - - if( string.right( 1 )!= "\\"){ - string.append( "\\" ); - } + QString string( formatPath( folderPath ) ); TPtrC desFolderPath( XQConversions::qStringToS60Desc( string )->Des() ); TPtrC ptrExtension( XQConversions::qStringToS60Desc( extension )->Des() ); @@ -523,6 +517,16 @@ } +bool FmUtils::isDrive( const QString &path ) +{ + bool ret( false ); + if( path.length() <= 3 && path.length() >=2 ) { + ret = true; + } + + return ret; +} + void FmUtils::createDefaultFolders( const QString &driverName ) { int err; @@ -613,6 +617,7 @@ return newFilePath; } +// used to filter drive which need be hide. bool FmUtils::checkDriveFilter( const QString &driveName ) { if( driveName.contains( "D:" ) || driveName.contains( "Z:" ) ) { @@ -623,11 +628,12 @@ QString FmUtils::checkDriveToFolderFilter( const QString &path ) { + /* QFileInfo fileInfo( path ); if( !fileInfo.exists() ) { return QString(); } - + */ QString checkedPath = fillPathWithSplash( path ); if( checkedPath.compare( QString( "C:/"), Qt::CaseInsensitive ) == 0 ) { checkedPath += QString( "data/" ); @@ -657,34 +663,53 @@ bool FmUtils::isPathAccessabel( const QString &path ) { + FmLogger::log( QString( "isPathAccessabel:" ) + path ); + if( path.length() <= 3 && !isDriveAvailable( path ) ) { //used to filter locked drive + FmLogger::log( QString( "isPathAccessabel false: path is drive and not available" ) ); + return false; + } QFileInfo fileInfo( path ); if( fileInfo.absoluteFilePath().contains( QString( Drive_C ), Qt::CaseInsensitive ) && !fileInfo.absoluteFilePath().contains( QString( Folder_C_Data ), Qt::CaseInsensitive ) ) { + FmLogger::log( QString( "isPathAccessabel false: path contain C and not in data folder" ) ); return false; } if( fileInfo.absoluteFilePath().contains( QString( Drive_D ), Qt::CaseInsensitive ) ) { + FmLogger::log( QString( "isPathAccessabel false: path contain D" ) ); return false; } if( fileInfo.absoluteFilePath().contains( QString( Drive_Z ), Qt::CaseInsensitive ) ) { + FmLogger::log( QString( "isPathAccessabel false: path contain Z" ) ); return false; } if( !fileInfo.exists() ) { + FmLogger::log( QString( "isPathAccessabel false: path not exist" ) ); return false; } + FmLogger::log( QString( "isPathAccessabel true" ) ); return true; } +// only used to check drive, when MMC is not inserted, also return false bool FmUtils::isDriveAvailable( const QString &path ) { - QFileInfo fileInfo( path ); - if( !fileInfo.exists() ) { - return false; + FmLogger::log( QString( "isDriveAvailable:" ) + path ); + FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState(); + if( ( driveState & FmDriverInfo::EDriveAvailable ) ) { + FmLogger::log( QString( "isDriveAvailable true" ) ); + return true; } - return true; + FmLogger::log( QString( "isDriveAvailable false" ) ); + return false; } void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ) { + if( isHideUnAvailableDrive ) { + FmLogger::log( QString( "getDriveList HideUnAvailableDrive_true" ) ); + } else { + FmLogger::log( QString( "getDriveList HideUnAvailableDrive_false" ) ); + } QFileInfoList infoList = QDir::drives(); foreach( QFileInfo fileInfo, infoList ) { @@ -712,8 +737,8 @@ QString volumeName = driverInfo.volumeName(); if( volumeName.isEmpty() && isFillWithDefaultVolume ){ - quint32 driveState = FmUtils::getDriverState( tempDriveName ); - if( !( driveState & FmDriverInfo::EDriveNotPresent ) ){ + FmDriverInfo::DriveState driveState = queryDriverInfo( tempDriveName ).driveState(); + if( driveState & FmDriverInfo::EDriveAvailable ){ if( driveState & FmDriverInfo::EDriveRemovable ) { if( driveState & FmDriverInfo::EDriveMassStorage ) { volumeName.append( QObject::tr( "Mass Storage" ) ); @@ -762,10 +787,10 @@ return FmErrNone; } -void FmUtils::sendFiles( QList filePathList ) +void FmUtils::sendFiles( QStringList &filePathList ) { ShareUi shareui; - shareui.init( filePathList, false ); + shareui.send( filePathList, false ); } QString FmUtils::getBurConfigPath( QString appPath ) @@ -774,3 +799,65 @@ QString path( BURCONFIGFILE ); return path; } + +bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast ) +{ + QString fst( fillPathWithSplash( pathFst ) ); + QString last( fillPathWithSplash( pathLast ) ); + if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) { + return true; + } + return false; +} + +bool FmUtils::isDefaultFolder( const QString &folderPath ) +{ + TPtrC desFolderPath( XQConversions::qStringToS60Desc( folderPath )->Des() ); + + TInt pathType( PathInfo::PathType( desFolderPath ) ); + switch( pathType ){ + case PathInfo::ENotSystemPath:{ + QString locString( Localize( folderPath ) ); + if ( locString.isEmpty() ){ + return false; + } + return true; + } + case PathInfo::EPhoneMemoryRootPath: // FALL THROUGH + case PathInfo::EMemoryCardRootPath: // FALL THROUGH + case PathInfo::ERomRootPath:{ + return false; + } + // Accept other folders + default:{ + return true; + } + } +} + +QString FmUtils::Localize( const QString &path ) +{ + QString locPath = formatPath( path ); + + TPtrC desPath( XQConversions::qStringToS60Desc( locPath )->Des() ); + CDirectoryLocalizer *localizer = CDirectoryLocalizer::NewL(); + + localizer->SetFullPath( desPath ); + if( localizer->IsLocalized() ){ + return XQConversions::s60DescToQString( localizer->LocalizedName() ); + } + + return QString(); +} + +QString FmUtils::formatPath( const QString &path ) +{ + QString formatPath = path; + QRegExp regExp( "/" ); + formatPath.replace( regExp, "\\" ); + + if( path.right( 1 )!= "\\"){ + formatPath.append( "\\" ); + } + return formatPath; +} diff -r 1957042d8c7e -r ada7962b4308 filemanager/src/inc/fmutils_win.cpp --- a/filemanager/src/inc/fmutils_win.cpp Fri Apr 16 14:53:38 2010 +0300 +++ b/filemanager/src/inc/fmutils_win.cpp Mon May 03 12:24:39 2010 +0300 @@ -35,6 +35,14 @@ return path.left( 3 ); } +QString FmUtils::getDriveLetterFromPath( const QString &path ) +{ + if( path.length() <3 ) { + return QString(); + } + return path.left( 1 ); +} + FmDriverInfo FmUtils::queryDriverInfo( const QString &driverName ) { quint64 size = 0; @@ -60,7 +68,12 @@ 0, 0 ); - return FmDriverInfo( size, freeSize, driverName, QString::fromWCharArray( &volumeName[0] ) ); + quint32 state( 0 ); + quint32 drvStatus = GetDriveType( (LPCWSTR)driver.constData() ); + if ( drvStatus == DRIVE_REMOVABLE ) { + state |= FmDriverInfo::EDriveRemovable; + } + return FmDriverInfo( size, freeSize, driverName, QString::fromWCharArray( &volumeName[0] ), state ); } QString FmUtils::formatStorageSize( quint64 size ) @@ -75,7 +88,7 @@ return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB"; } } - +/* quint32 FmUtils::getDriverState( const QString &driverName ) { quint32 state( 0 ); @@ -96,7 +109,7 @@ return state; } - +*/ int FmUtils::removeDrivePwd( const QString &driverName, const QString &Pwd ) { Q_UNUSED( driverName ); @@ -111,6 +124,13 @@ return 0; } +int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd) +{ + Q_UNUSED( driverName ); + Q_UNUSED( pwd ); + return 0; +} + int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd) { Q_UNUSED( driverName ); @@ -127,19 +147,20 @@ int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName) { Q_UNUSED( driverName ); - Q_UNUSED( newVolumeName ); + foreach( QChar ch, newVolumeName ) + { + // If not alphadigit or space, return error + if( !ch.isLetterOrNumber() && !ch.isSpace() ) + { + return FmErrBadName; + } + } return 0; } -int FmUtils::ejectDrive( const QString &driverName ) +void FmUtils::ejectDrive( const QString &driverName ) { Q_UNUSED( driverName ); - return 0; -} -int FmUtils::formatDrive( const QString &driverName ) -{ - Q_UNUSED( driverName ); - return 0; } QString FmUtils::getFileType( const QString &filePath ) @@ -161,6 +182,16 @@ return false; } +bool FmUtils::isDrive( const QString &path ) +{ + bool ret( false ); + if( path.length() <= 3 && path.length() >=2 ) { + ret = true; + } + + return ret; +} + void FmUtils::createDefaultFolders( const QString &driverName ) { Q_UNUSED( driverName ); @@ -304,7 +335,7 @@ QString volumeName = driverInfo.volumeName(); if( volumeName.isEmpty() && isFillWithDefaultVolume ){ - quint32 driveState = FmUtils::getDriverState( tempDriveName ); + FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( tempDriveName ).FmDriverInfo::driveState(); if( !( driveState & FmDriverInfo::EDriveNotPresent ) ){ if( driveState & FmDriverInfo::EDriveRemovable ) { if( driveState & FmDriverInfo::EDriveMassStorage ) { @@ -333,9 +364,9 @@ } } -void FmUtils::sendFiles( QList filePathList ) +void FmUtils::sendFiles( QStringList &filePathList ) { - Q_UNUSED( filePathList ); + } QString FmUtils::getBurConfigPath( QString appPath ) @@ -347,3 +378,25 @@ path = path + QString( BURCONFIGFILE ); return path; } + +bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast ) +{ + QString fst( fillPathWithSplash( pathFst ) ); + QString last( fillPathWithSplash( pathLast ) ); + if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) { + return true; + } + return false; +} + +bool FmUtils::isDefaultFolder( const QString &folderPath ) +{ + Q_UNUSED( folderPath ); + return false; +} + +QString FmUtils::formatPath( const QString &path ) +{ + Q_UNUSED( path ); + return false; +}