--- a/filemanager/rom/filemngr.iby Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/rom/filemngr.iby Tue Aug 24 10:24:14 2010 +0800
@@ -23,8 +23,8 @@
#define HB_UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc
file=ABI_DIR\BUILD_DIR\filemngr.exe SHARED_LIB_DIR\filemngr.exe
+data = ZRESOURCE\apps\filemngr.mif APP_RESOURCE_DIR\filemngr.mif
HB_UPGRADABLE_APP_REG_RSC(filemngr)
-S60_APP_RESOURCE(filemngr)
file=ABI_DIR\BUILD_DIR\fmbkupengine.dll SHARED_LIB_DIR\fmbkupengine.dll
--- a/filemanager/src/bwins/fmbkupenginewrapperu.def Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-EXPORTS
- ?cancelBackup@FmBkupEngine@@QAEXXZ @ 1 NONAME ; void FmBkupEngine::cancelBackup(void)
- ?notifyUpdate@FmBkupEngine@@IAEXH@Z @ 2 NONAME ; void FmBkupEngine::notifyUpdate(int)
- ?save@FmBackupSettings@@QAEXXZ @ 3 NONAME ; void FmBackupSettings::save(void)
- ??0FmRestoreSettings@@QAE@AAVFmBkupEngine@@@Z @ 4 NONAME ; FmRestoreSettings::FmRestoreSettings(class FmBkupEngine &)
- ?restoreEntryList@FmRestoreSettings@@QAE?AV?$QList@PAVFmRestoreEntry@@@@XZ @ 5 NONAME ; class QList<class FmRestoreEntry *> FmRestoreSettings::restoreEntryList(void)
- ??_EFmBkupEngine@@UAE@I@Z @ 6 NONAME ; FmBkupEngine::~FmBkupEngine(unsigned int)
- ?tr@FmBkupEngine@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString FmBkupEngine::tr(char const *, char const *)
- ?getStaticMetaObject@FmBkupEngine@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & FmBkupEngine::getStaticMetaObject(void)
- ?createTimeEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 9 NONAME ; class FmBackupEntry * FmBackupSettings::createTimeEntry(void)
- ?weekday@FmBackupSettings@@QBE?AW4TFileManagerBackupWeekday@1@XZ @ 10 NONAME ; enum FmBackupSettings::TFileManagerBackupWeekday FmBackupSettings::weekday(void) const
- ?trUtf8@FmBkupEngine@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString FmBkupEngine::trUtf8(char const *, char const *, int)
- ?deleteBackup@FmBkupEngine@@QAEHV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 12 NONAME ; int FmBkupEngine::deleteBackup(class QList<class FmBkupDrivesAndOperation *>)
- ??1FmBackupSettings@@QAE@XZ @ 13 NONAME ; FmBackupSettings::~FmBackupSettings(void)
- ?setTime@FmBackupSettings@@QAEXABVQTime@@@Z @ 14 NONAME ; void FmBackupSettings::setTime(class QTime const &)
- ?GetRestoreInfoArray@FmBkupEngine@@QAEXAAV?$QList@PAVFmBkupDrivesAndOperation@@@@AAV?$QList@VFmRestoreInfo@@@@H@Z @ 15 NONAME ; void FmBkupEngine::GetRestoreInfoArray(class QList<class FmBkupDrivesAndOperation *> &, class QList<class FmRestoreInfo> &, int)
- ?error@FmBkupEngine@@QBEHXZ @ 16 NONAME ; int FmBkupEngine::error(void) const
- ?backupEntryList@FmBackupSettings@@QAE?AV?$QList@PAVFmBackupEntry@@@@XZ @ 17 NONAME ; class QList<class FmBackupEntry *> FmBackupSettings::backupEntryList(void)
- ?trUtf8@FmBkupEngine@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString FmBkupEngine::trUtf8(char const *, char const *)
- ?refreshList@FmBackupSettings@@AAEXXZ @ 19 NONAME ; void FmBackupSettings::refreshList(void)
- ?contentsSelected@FmBackupSettings@@ABEHXZ @ 20 NONAME ; int FmBackupSettings::contentsSelected(void) const
- ?GetSelectionL@FmRestoreSettings@@QBEXAAV?$QList@VFmRestoreInfo@@@@@Z @ 21 NONAME ; void FmRestoreSettings::GetSelectionL(class QList<class FmRestoreInfo> &) const
- ?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
- ?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<class FmBkupDrivesAndOperation *>)
- ?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 FmBkupDrivesAndOperation *>, class QList<class FmBkupBackupCategory *>, 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<class FmBkupDrivesAndOperation *>)
- ?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<class FmBkupDrivesAndOperation *> &)
- ?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 &)
-
--- a/filemanager/src/bwins/fmfiledialogu.def Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-EXPORTS
- ??_EFmFileDialog@@UAE@I@Z @ 1 NONAME ; FmFileDialog::~FmFileDialog(unsigned int)
- ?qt_metacall@FmFileDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2 NONAME ; int FmFileDialog::qt_metacall(enum QMetaObject::Call, int, void * *)
- ??1FmFileDialog@@EAE@XZ @ 3 NONAME ; FmFileDialog::~FmFileDialog(void)
- ?tr@FmFileDialog@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString FmFileDialog::tr(char const *, char const *, int)
- ?getOpenFileName@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 5 NONAME ; class QString FmFileDialog::getOpenFileName(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags<enum FmFileDialog::Option>)
- ??0FmFileDialog@@AAE@PAVQGraphicsItem@@@Z @ 6 NONAME ; FmFileDialog::FmFileDialog(class QGraphicsItem *)
- ?tr@FmFileDialog@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString FmFileDialog::tr(char const *, char const *)
- ?getStaticMetaObject@FmFileDialog@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & FmFileDialog::getStaticMetaObject(void)
- ?d_func@FmFileDialog@@ABEPBVFmFileDialogPrivate@@XZ @ 9 NONAME ; class FmFileDialogPrivate const * FmFileDialog::d_func(void) const
- ?exec@FmFileDialog@@AAE_NXZ @ 10 NONAME ; bool FmFileDialog::exec(void)
- ?trUtf8@FmFileDialog@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString FmFileDialog::trUtf8(char const *, char const *)
- ?trUtf8@FmFileDialog@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString FmFileDialog::trUtf8(char const *, char const *, int)
- ?metaObject@FmFileDialog@@UBEPBUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const * FmFileDialog::metaObject(void) const
- ?staticMetaObject@FmFileDialog@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const FmFileDialog::staticMetaObject
- ?getSaveFileName@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 15 NONAME ; class QString FmFileDialog::getSaveFileName(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags<enum FmFileDialog::Option>)
- ?d_func@FmFileDialog@@AAEPAVFmFileDialogPrivate@@XZ @ 16 NONAME ; class FmFileDialogPrivate * FmFileDialog::d_func(void)
- ?getExistingDirectory@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 17 NONAME ; class QString FmFileDialog::getExistingDirectory(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags<enum FmFileDialog::Option>)
- ?qt_metacast@FmFileDialog@@UAEPAXPBD@Z @ 18 NONAME ; void * FmFileDialog::qt_metacast(char const *)
-
--- a/filemanager/src/eabi/fmbkupenginewrapperu.def Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-EXPORTS
- _ZN12FmBkupEngine11notifyStartEbi @ 1 NONAME
- _ZN12FmBkupEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
- _ZN12FmBkupEngine11qt_metacastEPKc @ 3 NONAME
- _ZN12FmBkupEngine11startBackupE5QListIP24FmBkupDrivesAndOperationES0_IP20FmBkupBackupCategoryE7QStringj @ 4 NONAME
- _ZN12FmBkupEngine12cancelBackupEv @ 5 NONAME
- _ZN12FmBkupEngine12deleteBackupE5QListIP24FmBkupDrivesAndOperationE @ 6 NONAME
- _ZN12FmBkupEngine12notifyFinishEi @ 7 NONAME
- _ZN12FmBkupEngine12notifyUpdateEi @ 8 NONAME
- _ZN12FmBkupEngine12startRestoreE5QListIP24FmBkupDrivesAndOperationE @ 9 NONAME
- _ZN12FmBkupEngine15BackupSettingsLEv @ 10 NONAME
- _ZN12FmBkupEngine15notifyMemoryLowEiRi @ 11 NONAME
- _ZN12FmBkupEngine15notifyPreparingEb @ 12 NONAME
- _ZN12FmBkupEngine16RestoreSettingsLEv @ 13 NONAME
- _ZN12FmBkupEngine16staticMetaObjectE @ 14 NONAME DATA 16
- _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
-
--- a/filemanager/src/eabi/fmfiledialogu.def Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-EXPORTS
- _ZN12FmFileDialog11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
- _ZN12FmFileDialog11qt_metacastEPKc @ 2 NONAME
- _ZN12FmFileDialog15getOpenFileNameEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 3 NONAME
- _ZN12FmFileDialog15getSaveFileNameEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 4 NONAME
- _ZN12FmFileDialog16staticMetaObjectE @ 5 NONAME DATA 16
- _ZN12FmFileDialog19getStaticMetaObjectEv @ 6 NONAME
- _ZN12FmFileDialog20getExistingDirectoryEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 7 NONAME
- _ZN12FmFileDialog4execEv @ 8 NONAME
- _ZN12FmFileDialogC1EP13QGraphicsItem @ 9 NONAME
- _ZN12FmFileDialogC2EP13QGraphicsItem @ 10 NONAME
- _ZN12FmFileDialogD0Ev @ 11 NONAME
- _ZN12FmFileDialogD1Ev @ 12 NONAME
- _ZN12FmFileDialogD2Ev @ 13 NONAME
- _ZNK12FmFileDialog10metaObjectEv @ 14 NONAME
- _ZTI12FmFileDialog @ 15 NONAME
- _ZTV12FmFileDialog @ 16 NONAME
- _ZThn16_N12FmFileDialogD0Ev @ 17 NONAME
- _ZThn16_N12FmFileDialogD1Ev @ 18 NONAME
- _ZThn8_N12FmFileDialogD0Ev @ 19 NONAME
- _ZThn8_N12FmFileDialogD1Ev @ 20 NONAME
-
--- a/filemanager/src/filemanager/burconfig.xml Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/burconfig.xml Tue Aug 24 10:24:14 2010 +0800
@@ -51,6 +51,8 @@
<exclude_uids>0x1000484b</exclude_uids> <!--Message store (EBUCatMessages)-->
<exclude_uids>0x100058db</exclude_uids> <!--MMS-settings (EBUCatMessages)-->
<exclude_uids>0x100058eb</exclude_uids> <!--E-mail-settings (EBUCatMessages)-->
+ <exclude_uids>0x2001FE79</exclude_uids> <!--Messaging 101 (EBUCatMessages)-->
+ <exclude_uids>0x2002A542</exclude_uids> <!--CsServer.exe (EBUCatMessages)-->
<exclude_uids>0x10003a73</exclude_uids> <!--Contacts model (EBUCatContacts)-->
<exclude_uids>0x101f4cce</exclude_uids> <!--Phonebook-app (EBUCatContacts)-->
<exclude_uids>0x10003a5b</exclude_uids> <!--Agenda model (EBUCatCalendar)-->
@@ -73,6 +75,8 @@
<uids>0x1000484b</uids><!--Message store-->
<uids>0x100058db</uids><!--MMS-settings-->
<uids>0x100058eb</uids><!--E-mail-settings-->
+ <uids>0x2001FE79</uids><!--Messaging 101 -->
+ <uids>0x2002A542</uids><!--CsServer.exe -->
<exclude_uids></exclude_uids>
</backupCategory>
@@ -112,10 +116,10 @@
<exclude_special_flags>EBUCatSpecNone</exclude_special_flags>
<uids>0x101f401d</uids><!--Logs-->
<!-- removed MediaGallery <uids>0x101f8599</uids>MediaGallery, i.e. basically all user data-->
- <uids>0x101f84eb</uids><!--FileManager instead of MediaGallery backup c:/data/ -->
+ <uids>0x2002bcc0</uids><!--FileManager instead of MediaGallery backup c:/data/ -->
<uids>0x20029f80</uids><!--Notepad changed from 0x10005907-->
<uids>0x1028246F</uids><!--Java Backup process-->
- <uids>0x10282475</uids><!--Java Registry process-->
+ <uids>0x200211DC</uids><!--Java Captain. And Java registry process removed-->
<uids>0x102033E6</uids><!--MIDP2 Runtime process-->
<exclude_uids></exclude_uids>
</backupCategory>
--- a/filemanager/src/filemanager/filemanager.pri Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/filemanager.pri Tue Aug 24 10:24:14 2010 +0800
@@ -19,8 +19,7 @@
INCLUDEPATH += ./src/backuprestore
INCLUDEPATH += ./src/operationservice
-HEADERS += src/fmdriverlistwidget.h \
- src/listviewitems.h \
+HEADERS += src/fmdriverlistwidget.h \
src/fmfileview.h \
src/fmfilebrowsewidget.h \
src/fmdriverview.h \
@@ -36,10 +35,10 @@
src/operationservice/fmoperationthread.h \
src/operationservice/fmoperationbase.h \
src/operationservice/fmoperationresultprocesser.h \
- src/operationservice/fmoperationcopy.h \
- src/operationservice/fmoperationmove.h \
+ src/operationservice/fmoperationcopyormove.h \
src/operationservice/fmoperationremove.h \
src/operationservice/fmoperationformat.h \
+ src/operationservice/fmoperationviewdetails.h \
src/backuprestore/fmbackupview.h \
src/backuprestore/fmbackupwidget.h \
src/backuprestore/fmrestoreview.h \
@@ -52,16 +51,17 @@
src/components/fmcombinedquery.h \
src/components/fmdlgutils.h \
src/components/fmtimequery.h \
- src/components/fmdatalistmodel.h \
src/components/fmsingletextquery.h \
src/components/fmmultitextquery.h \
src/components/fmviewdetailsdialog.h \
src/components/fmviewdetailsitem.h \
src/components/fmdrivedetailstype.h \
+ src/components/fmmessagebox.h \
+ src/components/fmdialog.h \
+ src/components/fmdrivequery.h
SOURCES += src/main.cpp \
- src/fmdriverlistwidget.cpp \
- src/listviewitems.cpp \
+ src/fmdriverlistwidget.cpp \
src/fmfileview.cpp \
src/fmfilebrowsewidget.cpp \
src/fmdriverview.cpp \
@@ -77,9 +77,9 @@
src/operationservice/fmoperationthread.cpp \
src/operationservice/fmoperationbase.cpp \
src/operationservice/fmoperationresultprocesser.cpp \
- src/operationservice/fmoperationcopy.cpp \
- src/operationservice/fmoperationmove.cpp \
+ src/operationservice/fmoperationcopyormove.cpp \
src/operationservice/fmoperationremove.cpp \
+ src/operationservice/fmoperationviewdetails.cpp \
src/backuprestore/fmbackupview.cpp \
src/backuprestore/fmbackupwidget.cpp \
src/backuprestore/fmrestoreview.cpp \
@@ -92,12 +92,14 @@
src/components/fmcombinedquery.cpp \
src/components/fmdlgutils.cpp \
src/components/fmtimequery.cpp \
- src/components/fmdatalistmodel.cpp \
src/components/fmsingletextquery.cpp \
src/components/fmmultitextquery.cpp \
src/components/fmviewdetailsdialog.cpp \
src/components/fmviewdetailsitem.cpp \
- src/components/fmdrivedetailstype.cpp
+ src/components/fmdrivedetailstype.cpp \
+ src/components/fmmessagebox.cpp \
+ src/components/fmdialog.cpp \
+ src/components/fmdrivequery.cpp
win32 {
SOURCES += src/operationservice/fmoperationformat_win.cpp
--- a/filemanager/src/filemanager/filemanager.pro Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/filemanager.pro Tue Aug 24 10:24:14 2010 +0800
@@ -18,10 +18,11 @@
CONFIG += hb
TEMPLATE = app
TARGET = filemngr
+ICON = resources/qtg_large_filemgr.svg
RESOURCES += filemanager.qrc
INCLUDEPATH += ../fmbkupenginewrapper/inc
# remove this path when export plat header to app layer path
-INCLUDEPATH += ../../filemanager_plat/inc
+# INCLUDEPATH += ../../filemanager_plat/inc
include ( ../common.pri )
include ( ../inc/commoninc.pri )
@@ -32,7 +33,7 @@
LIBS += -lfmfiledialog
symbian {
-
+ SKINICON = qtg_large_filemgr
LIBS += -lplatformenv \
-lapmime \
-lxqservice \
@@ -40,8 +41,8 @@
-lshareui \
-lefsrv \
-lapgrfx \
- -lcone \
- -ldirectorylocalizer
+ -lcone \
+ -lsysutil
TARGET.UID3 = 0x2002BCC0
TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
--- a/filemanager/src/filemanager/filemanager.qrc Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/filemanager.qrc Tue Aug 24 10:24:14 2010 +0800
@@ -6,6 +6,8 @@
<file>image/qgn_prop_fmgr_mmc_no_sub.svg</file>
<file>image/qgn_prop_phone_memc.svg</file>
<file>image/qgn_prop_usb_memc.svg</file>
- <file>image/qgn_prop_fmgr_ms.svg</file>
+ <file>image/qgn_prop_fmgr_ms.svg</file>
+ <file>resources/hblistviewitem.css</file>
+ <file>resources/hblistviewitem.widgetml</file>
</qresource>
</RCC>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/resources/hblistviewitem.css Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,57 @@
+
+HbListViewItem[layoutName="drive"]:portrait{
+ layout: drive-portrait;
+}
+
+
+HbListViewItem[layoutName="drive"]:landscape{
+ layout: drive-landscape;
+}
+
+HbListViewItem::text-1[layoutName="drive"]:portrait{
+ top: -var(hb-param-margin-gene-middle-vertical);
+ font-variant: primary;
+ text-align: left;
+}
+
+HbListViewItem::text-2[layoutName="drive"]:portrait{
+ font-variant: secondary;
+ text-align: left;
+}
+HbListViewItem::text-3[layoutName="drive"]:portrait{
+ bottom: var(hb-param-margin-gene-middle-vertical);
+ font-variant: secondary-small;
+ text-align: left;
+}
+HbListViewItem::icon-1[layoutName="drive"]:portrait{
+ top: -var(hb-param-margin-gene-top);
+ left: -var(hb-param-margin-gene-middle-horizontal);
+
+ fixed-height: var(hb-param-graphic-size-primary-large);
+ fixed-width: var(hb-param-graphic-size-primary-large);
+}
+
+HbListViewItem::text-1[layoutName="drive"]:landscape{
+ top: -var(hb-param-margin-gene-top);
+ font-variant: primary;
+ text-align: left;
+}
+
+HbListViewItem::text-2[layoutName="drive"]:landscape {
+ top: -var(hb-param-margin-gene-top);
+ font-variant: secondary;
+ text-align: left;
+}
+HbListViewItem::text-3[layoutName="drive"]:landscape{
+ bottom: var(hb-param-margin-gene-top);
+ font-variant: secondary-small;
+ text-align: left;
+}
+HbListViewItem::icon-1[layoutName="drive"]:landscape{
+ top: -var(hb-param-margin-gene-top);
+ left: -var(hb-param-margin-gene-middle-horizontal);
+ bottom: var(hb-param-margin-gene-bottom);
+ fixed-height: var(hb-param-graphic-size-primary-large);
+ fixed-width: var(hb-param-graphic-size-primary-large);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/resources/hblistviewitem.widgetml Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,46 @@
+<hbwidget version="0.1" type="HbListViewItem">
+ <layout name="drive-portrait" type="mesh">
+
+ <meshitem src="icon-1" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP" />
+
+
+ <meshitem src="text-1" srcEdge="LEFT" dst="icon-1" dstEdge="RIGHT" />
+ <meshitem src="text-1" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="text-1" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+
+ <meshitem src="text-2" srcEdge="LEFT" dst="text-1" dstEdge="LEFT" />
+ <meshitem src="text-2" srcEdge="TOP" dst="text-1" dstEdge="BOTTOM" />
+ <meshitem src="text-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+
+ <meshitem src="text-3" srcEdge="LEFT" dst="text-1" dstEdge="LEFT" />
+ <meshitem src="text-3" srcEdge="TOP" dst="text-2" dstEdge="BOTTOM" />
+ <meshitem src="text-3" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="text-3" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+
+ </layout>
+ <layout name="drive-landscape" type="mesh">
+
+ <meshitem src="icon-1" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP" />
+
+
+ <meshitem src="text-1" srcEdge="LEFT" dst="icon-1" dstEdge="RIGHT" spacing ="-3un"/>
+ <meshitem src="text-1" srcEdge="TOP" dst="" dstEdge="TOP" />
+
+
+ <meshitem src="text-2" srcEdge="LEFT" dst="text-1" dstEdge="RIGHT" spacing ="-4un"/>
+ <meshitem src="text-2" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="text-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing ="20un"/>
+
+
+ <meshitem src="text-3" srcEdge="LEFT" dst="text-2" dstEdge="LEFT" />
+ <meshitem src="text-3" srcEdge="TOP" dst="text-2" dstEdge="BOTTOM" />
+ <meshitem src="text-3" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing ="20un"/>
+ <meshitem src="text-3" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+ </layout>
+</hbwidget>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/resources/qtg_large_filemgr.svg Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="60" viewBox="0 0 60 60" width="60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g>
+<rect fill="none" height="60" width="60"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="30" x2="30" y1="2.9995" y2="57.1831">
+<stop offset="0" style="stop-color:#989C9E"/>
+<stop offset="0.8182" style="stop-color:#44454A"/>
+<stop offset="1" style="stop-color:#5D5F63"/>
+</linearGradient>
+<path d="M53.578,55.479c0,0.839-0.68,1.521-1.521,1.521H7.943c-0.84,0-1.521-0.681-1.521-1.521V4.521 C6.422,3.68,7.104,3,7.943,3h44.113c0.842,0,1.521,0.681,1.521,1.521V55.479z" fill="url(#SVGID_1_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="30" x2="30" y1="2.9995" y2="57.1831">
+<stop offset="0" style="stop-color:#D8DDE0"/>
+<stop offset="0.8182" style="stop-color:#5F6169"/>
+<stop offset="1" style="stop-color:#7D7F85"/>
+</linearGradient>
+<path d="M52.057,3H7.943C7.104,3,6.422,3.68,6.422,4.521v50.958C6.422,56.318,7.104,57,7.943,57h44.113 c0.842,0,1.521-0.681,1.521-1.521V4.521C53.578,3.68,52.898,3,52.057,3z M52.816,55.479c0,0.419-0.34,0.76-0.76,0.76H7.943 c-0.42,0-0.76-0.341-0.76-0.76V4.521c0-0.42,0.34-0.76,0.76-0.76h44.113c0.42,0,0.76,0.34,0.76,0.76V55.479z" fill="url(#SVGID_2_)"/>
+<path d="M49.773,26.578c0,0.839-0.68,1.521-1.52,1.521H11.746c-0.84,0-1.52-0.682-1.52-1.521V8.323 c0-0.84,0.68-1.521,1.52-1.521h36.508c0.84,0,1.52,0.68,1.52,1.521V26.578z" fill="url(#SVGID_3_)"/>
+<path d="M11.746,28.859c-1.258,0-2.281-1.023-2.281-2.281V8.323c0-1.258,1.023-2.281,2.281-2.281 h36.508c1.258,0,2.281,1.023,2.281,2.281v18.254c0,1.258-1.023,2.281-2.281,2.281H11.746z" fill="#020202" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M49.773,26.578c0,0.839-0.68,1.521-1.52,1.521H11.746c-0.84,0-1.52-0.682-1.52-1.521V8.323 c0-0.84,0.68-1.521,1.52-1.521h36.508c0.84,0,1.52,0.68,1.52,1.521V26.578z" fill="url(#SVGID_3_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="30" x2="30" y1="14.4082" y2="22.0395">
+<stop offset="0" style="stop-color:#5B5B5B"/>
+<stop offset="1" style="stop-color:#B0B0B0"/>
+</linearGradient>
+<rect fill="url(#SVGID_5_)" height="7.605" width="12.168" x="23.916" y="14.408"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_6_" x1="30" x2="30" y1="15.1685" y2="21.2736">
+<stop offset="0" style="stop-color:#E8E8E8"/>
+<stop offset="1" style="stop-color:#828282"/>
+</linearGradient>
+<rect fill="url(#SVGID_6_)" height="6.084" width="10.648" x="24.676" y="15.168"/>
+<path d="M48.254,6.803H11.746c-0.84,0-1.52,0.68-1.52,1.521v18.254c0,0.839,0.68,1.521,1.52,1.521 h36.508c0.84,0,1.52-0.682,1.52-1.521V8.323C49.773,7.483,49.094,6.803,48.254,6.803z M49.014,26.578c0,0.418-0.34,0.761-0.76,0.761 H11.746c-0.42,0-0.76-0.342-0.76-0.761V8.323c0-0.419,0.34-0.76,0.76-0.76h36.508c0.42,0,0.76,0.34,0.76,0.76V26.578z" fill="#FFFFFF" fill-opacity="0.5" stroke-opacity="0.5"/>
+<polygon fill="#FFFFFF" fill-opacity="0.6" points="23.916,22.014 36.084,22.014 35.324,21.253 23.916,21.253 " stroke-opacity="0.6"/>
+<path d="M10.227,36.464v-15.12c0-1.757,1.346-3.133,3.066-3.133h13.936 c2.424,0,2.928,2.088,3.094,2.775l-0.025,0.006c0.133,0.336,0.297,0.863,0.549,1.69c0.023,0.003,0.049,0.005,0.074,0.005 l15.703-0.001c1.738,0,3.15,1.404,3.15,3.131v10.647H10.227z" fill="#020202" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M10.986,35.704v-14.36c0-1.331,1.012-2.373,2.307-2.373h13.936 c1.824,0,2.182,1.479,2.354,2.193c0,0,0.408,1.323,0.633,2.06c0.1,0.144,0.43,0.223,0.705,0.223l15.703-0.002 c1.318,0,2.391,1.064,2.391,2.371v9.887H10.986z" fill="#020202" fill-opacity="0.3" stroke-opacity="0.3"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_7_" x1="30" x2="30" y1="18.1982" y2="34.3475">
+<stop offset="0" style="stop-color:#FEEFA7"/>
+<stop offset="0.3273" style="stop-color:#FEE570"/>
+<stop offset="0.6485" style="stop-color:#F0C12B"/>
+<stop offset="1" style="stop-color:#E6A501"/>
+</linearGradient>
+<path d="M46.623,23.446H30.992c0,0-1.135,0.069-1.484-0.693c-0.221-0.728-0.666-2.17-0.666-2.17 c-0.219-0.919-0.506-1.611-1.613-1.611H13.293c-0.881,0-1.547,0.722-1.547,1.611v13.6h36.508v-9.126 C48.254,24.168,47.502,23.446,46.623,23.446z" fill="url(#SVGID_7_)"/>
+<path d="M46.623,23.446H30.992c0,0-1.135,0.069-1.484-0.693c-0.221-0.728-0.666-2.17-0.666-2.17 c-0.219-0.919-0.506-1.611-1.613-1.611H13.293c-0.881,0-1.547,0.722-1.547,1.611v0.761c0-0.89,0.666-1.612,1.547-1.612h13.936 c1.107,0,1.395,0.693,1.613,1.612c0,0,0.445,1.44,0.666,2.17c0.35,0.76,1.484,0.692,1.484,0.692h15.631 c0.879,0,1.631,0.722,1.631,1.61v-0.761C48.254,24.168,47.502,23.446,46.623,23.446z" fill="#FCF3D0" fill-opacity="0.8" stroke-opacity="0.8"/>
+<path d="M50.535,52.436c0,0.839-0.682,1.521-1.521,1.521H10.986c-0.84,0-1.521-0.682-1.521-1.521V33.421 c0-0.84,0.682-1.52,1.521-1.52h38.027c0.84,0,1.521,0.68,1.521,1.52V52.436z" fill="url(#SVGID_8_)"/>
+<path d="M10.986,56.239c-1.678,0-3.043-1.365-3.043-3.042V34.183c0-1.678,1.365-3.042,3.043-3.042 h38.027c1.678,0,3.043,1.364,3.043,3.042v19.014c0,1.677-1.365,3.042-3.043,3.042H10.986z" fill="#020202" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M10.986,55.479c-1.26,0-2.283-1.023-2.283-2.282V34.183c0-1.258,1.023-2.281,2.283-2.281 h38.027c1.258,0,2.283,1.023,2.283,2.281v19.014c0,1.259-1.025,2.282-2.283,2.282H10.986z" fill="#020202" fill-opacity="0.3" stroke-opacity="0.3"/>
+<path d="M50.535,52.436c0,0.839-0.682,1.521-1.521,1.521H10.986c-0.84,0-1.521-0.682-1.521-1.521V33.421 c0-0.84,0.682-1.52,1.521-1.52h38.027c0.84,0,1.521,0.68,1.521,1.52V52.436z" fill="url(#SVGID_8_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_10_" x1="30" x2="30" y1="40.2671" y2="48.6622">
+<stop offset="0" style="stop-color:#5B5B5B"/>
+<stop offset="1" style="stop-color:#B0B0B0"/>
+</linearGradient>
+<rect fill="url(#SVGID_10_)" height="8.367" width="13.691" x="23.154" y="40.267"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_11_" x1="30" x2="30" y1="41.0278" y2="47.8963">
+<stop offset="0" style="stop-color:#E8E8E8"/>
+<stop offset="1" style="stop-color:#828282"/>
+</linearGradient>
+<rect fill="url(#SVGID_11_)" height="6.845" width="12.168" x="23.916" y="41.028"/>
+<path d="M49.014,31.901H10.986c-0.84,0-1.521,0.68-1.521,1.52v19.015c0,0.839,0.682,1.521,1.521,1.521 h38.027c0.84,0,1.521-0.682,1.521-1.521V33.421C50.535,32.581,49.854,31.901,49.014,31.901z M49.773,52.436 c0,0.419-0.34,0.761-0.76,0.761H10.986c-0.42,0-0.76-0.341-0.76-0.761V33.421c0-0.419,0.34-0.759,0.76-0.759h38.027 c0.42,0,0.76,0.34,0.76,0.759V52.436z" fill="#FFFFFF" fill-opacity="0.5" stroke-opacity="0.5"/>
+<polygon fill="#FFFFFF" points="20.814,31.901 22.639,37.226 37.359,37.226 39.184,31.901 "/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_12_" x1="30" x2="30" y1="31.9014" y2="36.4799">
+<stop offset="0" style="stop-color:#989C9E"/>
+<stop offset="0.8182" style="stop-color:#44454A"/>
+<stop offset="1" style="stop-color:#5D5F63"/>
+</linearGradient>
+<polygon fill="url(#SVGID_12_)" points="36.846,36.464 23.154,36.464 21.635,31.901 38.365,31.901 "/>
+<polygon fill="#FFFFFF" points="21.576,6.803 23.4,11.366 36.6,11.366 38.424,6.803 "/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_13_" x1="30" x2="30" y1="6.8027" y2="10.6184">
+<stop offset="0" style="stop-color:#989C9E"/>
+<stop offset="0.8182" style="stop-color:#44454A"/>
+<stop offset="1" style="stop-color:#5D5F63"/>
+</linearGradient>
+<polygon fill="url(#SVGID_13_)" points="36.084,10.605 23.916,10.605 22.395,6.803 37.605,6.803 "/>
+<rect fill="#020202" fill-opacity="0.2" height="1.522" stroke-opacity="0.2" width="36.508" x="11.746" y="30.379"/>
+<rect fill="#020202" fill-opacity="0.1" height="0.76" stroke-opacity="0.1" width="36.508" x="11.746" y="29.62"/>
+<rect fill="#020202" fill-opacity="0.05" height="0.761" stroke-opacity="0.05" width="36.508" x="11.746" y="28.859"/>
+<polygon fill="#FFFFFF" fill-opacity="0.8" points="36.846,48.634 23.154,48.634 23.916,47.873 36.084,47.873 " stroke-opacity="0.8"/>
+<rect fill="none" height="60" width="60"/>
+<defs>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="30" x2="30" y1="6.8027" y2="28.1705">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.7879" style="stop-color:#A6A6A6"/>
+<stop offset="1" style="stop-color:#B1B1B1"/>
+</linearGradient>
+</defs>
+<defs>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_8_" x1="30" x2="30" y1="31.9014" y2="54.0325">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.7879" style="stop-color:#A6A6A6"/>
+<stop offset="1" style="stop-color:#B1B1B1"/>
+</linearGradient>
+</defs>
+</g>
+</svg>
--- a/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -24,8 +24,7 @@
#include "fmbkupengine.h"
#include "fmoperationbase.h"
#include "fmcommon.h"
-
-#include <hbmessagebox.h>
+#include "fmdlgutils.h"
FmBackupRestoreHandler::FmBackupRestoreHandler( QObject *parent ) : QObject( parent ), mBackupConfigLoader( 0 )
{
@@ -37,7 +36,7 @@
connect( mBkupEngine, SIGNAL( notifyStart( bool, int) ), this, SLOT( onNotifyStart( bool, int ) ), Qt::QueuedConnection );
connect( mBkupEngine, SIGNAL( notifyUpdate(int) ), this, SLOT( onNotifyUpdate(int) ), Qt::QueuedConnection );
connect( mBkupEngine, SIGNAL( notifyFinish(int) ),
- this, SLOT( onNotifyFinish(int) ), Qt::QueuedConnection );
+ this, SLOT( onNotifyFinish(int) ), Qt::DirectConnection );
connect( mBkupEngine, SIGNAL( notifyMemoryLow(int, int& ) ),
this, SLOT( onNotifyMemoryLow(int, int&) ) );
connect( mBkupEngine, SIGNAL( notifyBackupFilesExist( bool& )), this, SLOT( onNotifyBackupFilesExist( bool& )));
@@ -73,8 +72,8 @@
mCurrentProcess = ProcessBackup;
bool ret = mBkupEngine->startBackup( backupConfigLoader()->driversAndOperationList(),
backupConfigLoader()->backupCategoryList(),
- mBkupEngine->BackupSettingsL()->targetDrive(),
- mBkupEngine->BackupSettingsL()->content() );
+ operationBackup->targetDrive(), // targetDrive is stored in FmOperationBackup
+ operationBackup->content() ); // content is stored in FmOperationBackup
if( !ret ) {
mCurrentProcess = ProcessNone;
@@ -109,14 +108,14 @@
if( memoryValue < FmEstimateLowerLimit ) {
userError = FmErrDiskFull;
} else if( memoryValue < FmEstimateUpperLimit ) {
- if ( !HbMessageBox::question( "memory low, continue?" ) ){
+ if ( !FmDlgUtils::question( "memory low, continue?" ) ){
userError = FmErrCancel;
}
}
}
void FmBackupRestoreHandler::onNotifyBackupFilesExist( bool &isContinue )
{
- if ( HbMessageBox::question( "some bacup files exist, continue?" ) )
+ if ( FmDlgUtils::question( "some backup files exist, continue?" ) )
{
isContinue = true;
}
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -20,7 +20,7 @@
#include "fmbackupwidget.h"
#include "fmviewmanager.h"
#include "fmoperationbase.h"
-
+#include "fmdlgutils.h"
#include <QApplication>
@@ -28,19 +28,16 @@
#include <hbtoolbar.h>
#include <hbmenu.h>
#include <hbmainwindow.h>
-#include <hbmessagebox.h>
-
FmBackupView::FmBackupView() : FmViewBase( EBackupView )
{
- setTitle( tr( "Backup" ) );
+ setTitle( hbTrId( "Backup" ) );
- initToolBar();
- initMainWidget();
- initMenu();
- mOperationService = FmViewManager::viewManager()->operationService();
+ initToolBar();
+ initMainWidget();
+ initMenu();
+ mOperationService = FmViewManager::viewManager()->operationService();
- QMetaObject::connectSlotsByName( this );
}
FmBackupView::~FmBackupView()
@@ -53,27 +50,29 @@
HbAction *action = 0;
#ifdef FM_CHANGE_ORIENT_ENABLE
- action = new HbAction( this );
+ action = new HbAction( this );
action->setObjectName( "rotateAction" );
action->setText( hbTrId( "Change orientation" ) );
menu()->addAction( action );
+ connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection );
#endif
- action = new HbAction( this );
+ action = new HbAction( this );
action->setObjectName( "backupAction" );
action->setText( hbTrId( "Start backup" ) );
menu()->addAction( action );
+ connect( action, SIGNAL(triggered()), this, SLOT( on_backupAction_triggered() ), Qt::QueuedConnection );
- action = new HbAction( this );
+ action = new HbAction( this );
action->setObjectName( "deleteBackupAction" );
action->setText( hbTrId( "Delete backup" ) );
menu()->addAction( action );
-
+ connect( action, SIGNAL(triggered()), this, SLOT( on_deleteBackupAction_triggered() ), Qt::QueuedConnection );
}
void FmBackupView::initMainWidget()
{
- mMainWidget = new FmBackupWidget( this );
+ mMainWidget = new FmBackupWidget( this );
setWidget( mMainWidget );
}
@@ -84,6 +83,7 @@
mToolBarAction->setObjectName( "leftAction" );
mToolBarAction->setText( hbTrId("Start backup") );
toolBar()->addAction( mToolBarAction );
+ connect( mToolBarAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection );
toolBar()->setOrientation( Qt::Horizontal );
}
@@ -91,24 +91,25 @@
void FmBackupView::on_leftAction_triggered()
{
int ret = mOperationService->asyncBackup();
+ FM_LOG( "FmBackupView_asyncBackup: ret= " + QString::number(ret) );
switch( ret )
{
case FmErrNone:
break;
case FmErrWrongParam:
- HbMessageBox::information( QString( hbTrId("Operation canceled with wrong param!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation canceled with wrong param!") ) );
break;
case FmErrAlreadyStarted:
- HbMessageBox::information( QString( hbTrId("Operation canceled because already started!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation canceled because already started!") ) );
break;
case FmErrPathNotFound:
- HbMessageBox::information( QString( hbTrId("Operation canceled because can not find target drive!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation canceled because can not find target path or drive is not available!") ) );
break;
case FmErrAlreadyExists:
- HbMessageBox::information( QString( hbTrId("backup canceled") ) );
+ FmDlgUtils::information( QString( hbTrId("backup canceled") ) );
break;
default:
- HbMessageBox::information( QString( hbTrId("backup failed") ) );
+ FmDlgUtils::information( QString( hbTrId("backup failed") ) );
break;
}
}
@@ -139,3 +140,12 @@
toolBar()->removeAction( mToolBarAction );
}
+void FmBackupView::refreshBackupDate()
+{
+ mMainWidget->updateBackupDate();
+}
+
+void FmBackupView::refreshModel()
+{
+ mMainWidget->refreshModel();
+}
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupview.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.h Tue Aug 24 10:24:14 2010 +0800
@@ -45,6 +45,10 @@
void removeToolBarAction();
+public slots:
+ void refreshBackupDate();
+ void refreshModel();
+
private slots:
void on_leftAction_triggered();
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -35,9 +35,8 @@
#include <hbdataformviewitem.h>
-
FmBackupWidget::FmBackupWidget( QGraphicsItem *parent )
-: HbWidget( parent ), mLastPressedItem( 0 ), mScrolled( 0 )
+: HbWidget( parent )
{
init();
}
@@ -48,38 +47,24 @@
delete mModel;
}
-void FmBackupWidget::on_list_released( const QModelIndex &index )
-{
- HbDataFormModelItem *item = mModel->itemFromIndex(index);
- if( item != mLastPressedItem || mDataForm->isScrolling() || mScrolled ) {
- mScrolled = false;
- return;
- }
- mScrolled = false;
- if( item == mContentsItem ){
- ChangeContents();
+void FmBackupWidget::on_list_activated( const QModelIndex &index )
+{
+ // change item data when receive activated signal
+ HbDataFormModelItem *item = mModel->itemFromIndex(index);
+ if( item == mContentsItem ){
+ emit changeContents();
} else if( item == mTargetItem ){
- ChangeTargetDrive();
+ emit changeTargetDrive();
} else if( item == mSchedulingItem ){
- ChangeScheduling();
+ emit changeScheduling();
} else if( item == mWeekdayItem ){
- ChangeWeekday();
+ emit changeWeekday();
} else if( item == mTimeItem ){
- ChangeTime();
+ emit changeTime();
}
}
-void FmBackupWidget::on_list_pressed( const QModelIndex &index )
-{
- mLastPressedItem = mModel->itemFromIndex(index);
-}
-
-void FmBackupWidget::on_list_scrollingStarted()
-{
- mScrolled = true;
-}
-
void FmBackupWidget::init()
{
QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this );
@@ -92,19 +77,19 @@
mDataForm = new HbDataForm( this );
mDataForm->setModel( mModel );
vLayout->addItem( mDataForm );
-
- connect( mDataForm, SIGNAL( released( const QModelIndex & ) ),
- this, SLOT( on_list_released( const QModelIndex & ) ) );
-
- connect( mDataForm, SIGNAL( pressed( const QModelIndex & ) ),
- this, SLOT( on_list_pressed( const QModelIndex & ) ) );
-
- connect( mDataForm, SIGNAL( scrollingStarted() ),
- this, SLOT( on_list_scrollingStarted() ) );
+
+ connect( mDataForm, SIGNAL( activated( const QModelIndex & ) ),
+ this, SLOT( on_list_activated( const QModelIndex & ) ) );
connect( this, SIGNAL( doModelRefresh() ),
this, SLOT( refreshModel() ), Qt::QueuedConnection );
-
+
+ connect( this, SIGNAL(changeContents()), this, SLOT(on_changeContents()), Qt::QueuedConnection);
+ connect( this, SIGNAL(changeScheduling()), this, SLOT(on_changeScheduling()), Qt::QueuedConnection);
+ connect( this, SIGNAL(changeWeekday()), this, SLOT(on_changeWeekday()), Qt::QueuedConnection);
+ connect( this, SIGNAL(changeTime()), this, SLOT(on_changeTime()), Qt::QueuedConnection);
+ connect( this, SIGNAL(changeTargetDrive()), this, SLOT(on_changeTargetDrive()), Qt::QueuedConnection);
+
//mBackupSettings = new FmBackupSettings();
mBackupSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->BackupSettingsL();
mBackupSettings->load();
@@ -115,7 +100,7 @@
void FmBackupWidget::expandAllGroup()
{
- FmLogger::log( QString( "function expandAllGroup start" ) );
+ FM_LOG( QString( "function expandAllGroup start" ) );
mDataForm->setModel( 0 );
mDataForm->setModel( mModel );
@@ -123,51 +108,62 @@
HbDataFormViewItem *itemScheduling =
(HbDataFormViewItem *)(mDataForm->itemByIndex(mModel->indexFromItem(mSchedulingGroup)));
if( itemScheduling ){
- FmLogger::log( QString( "expand itemScheduling start" ) );
+ FM_LOG( QString( "expand itemScheduling start" ) );
itemScheduling->setExpanded( true );
- FmLogger::log( QString( "expand itemScheduling end" ) );
+ FM_LOG( QString( "expand itemScheduling end" ) );
}
HbDataFormViewItem *itemGroup =
(HbDataFormViewItem *)(mDataForm->itemByIndex(mModel->indexFromItem(mContentsGroup)));
if( itemGroup ){
- FmLogger::log( QString( "expand itemGroup start" ) );
+ FM_LOG( QString( "expand itemGroup start" ) );
itemGroup->setExpanded( true );
- FmLogger::log( QString( "expand itemGroup end" ) );
+ FM_LOG( QString( "expand itemGroup end" ) );
}
- FmLogger::log( QString( "function expandAllGroup end" ) );
+ FM_LOG( QString( "function expandAllGroup end" ) );
}
void FmBackupWidget::initModel()
{
mContentsGroup = mModel->appendDataFormGroup(
- QString( tr( "Contents" ) ), mModel->invisibleRootItem());
+ QString( hbTrId( "Contents" ) ), mModel->invisibleRootItem());
mContentsItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup );
mContentsItem->setContentWidgetData( QString("readOnly"), QString("true") );
+ mContentsItem->setContentWidgetData( QString("objectName"), QString("backupContentItem") );
mTargetItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup );
mTargetItem->setContentWidgetData( QString("readOnly"), QString("true") );
+ mTargetItem->setContentWidgetData( QString("objectName"), QString("backupTargetItem") );
mSchedulingGroup = mModel->appendDataFormGroup(
- QString( tr( "Scheduling" ) ), mModel->invisibleRootItem());
+ QString( hbTrId( "Scheduling" ) ), mModel->invisibleRootItem());
mSchedulingItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
mSchedulingItem->setContentWidgetData( QString("readOnly"), QString("true") );
+ mSchedulingItem->setContentWidgetData( QString("objectName"), QString("backupSchedulingItem") );
mWeekdayItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
mWeekdayItem->setContentWidgetData( QString("readOnly"), QString("true") );
+ mWeekdayItem->setContentWidgetData( QString("objectName"), QString("backupWeekdayItem") );
mTimeItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
mTimeItem->setContentWidgetData( QString("readOnly"), QString("true") );
+ mTimeItem->setContentWidgetData( QString("objectName"), QString("backupTimeItem") );
+
+ mLastBackupDateItem = mModel->appendDataFormItem(
+ HbDataFormModelItem::TextItem, QString( ( "" )), mModel->invisibleRootItem() );
+ mLastBackupDateItem->setContentWidgetData( QString("readOnly"), QString("true") );
+ mLastBackupDateItem->setContentWidgetData( QString("objectName"), QString("backupLastBackupDateItem") );
}
+
void FmBackupWidget::refreshModel()
{
mDataForm->setModel( 0 );
@@ -246,6 +242,11 @@
mTimeItem->setContentWidgetData( QString("text"), tips );
break;
}
+ case FmBackupEntry::EBackupdate:
+ {
+ mLastBackupDateItem->setContentWidgetData( QString("text"), tips );
+ break;
+ }
}
}
@@ -254,12 +255,10 @@
expandAllGroup();
}
-
-
-void FmBackupWidget::ChangeContents()
+void FmBackupWidget::on_changeContents()
{
- QString title = constFileManagerBackupSettingsTitleContents;
+ QString title = mContentsItem->label();
QStringList queryStringList;
quint32 contentMask = FmBackupSettings::EFileManagerBackupContentAll;
while ( contentMask <= FmBackupSettings::EFileManagerBackupContentLast)
@@ -277,9 +276,9 @@
}
-void FmBackupWidget::ChangeScheduling()
+void FmBackupWidget::on_changeScheduling()
{
- QString title = constFileManagerBackupSettingsTitleScheduling;
+ QString title = mSchedulingItem->label();
QStringList queryStringList;
FmBackupSettings::TFileManagerBackupSchedule schedule = FmBackupSettings::EFileManagerBackupScheduleNever;
@@ -299,9 +298,9 @@
}
}
-void FmBackupWidget::ChangeWeekday()
+void FmBackupWidget::on_changeWeekday()
{
- QString title = constFileManagerBackupSettingsTitleWeekday;
+ QString title = mWeekdayItem->label();
QStringList queryStringList;
FmBackupSettings::TFileManagerBackupWeekday weekday = FmBackupSettings::EFileManagerBackupWeekdayMonday;
@@ -321,9 +320,9 @@
}
}
-void FmBackupWidget::ChangeTime()
+void FmBackupWidget::on_changeTime()
{
- QString title = constFileManagerBackupSettingsTitleTime;
+ QString title = mTimeItem->label();
QTime queryTime = mBackupSettings->time();
if( FmDlgUtils::showTimeSettingQuery( title, queryTime ) )
@@ -334,41 +333,19 @@
}
-void FmBackupWidget::ChangeTargetDrive()
+void FmBackupWidget::on_changeTargetDrive()
{
- QString title = constFileManagerBackupSettingsTitleTargetDrive;
- QStringList queryStringList;
- QStringList driveStringList;
-
- QStringList driveList;
- //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);
- drive = FmUtils::removePathSplash( drive );
- QString driveWithVolume = FmUtils::fillDriveVolume( drive, true );
-
- driveStringList.push_back( drive );
- queryStringList.push_back( driveWithVolume );
- associatedDrives += FmUtils::getDriveLetterFromPath(drive);
-
- if( drive == targetDrive )
- {
- // adjust index offset against drive.
- selectIndex = currentIndex;
- }
- ++currentIndex;
- }
-
- if( FmDlgUtils::showSingleSettingQuery( title, queryStringList, selectIndex, associatedDrives ) )
- {
- mBackupSettings->setTargetDrive( driveStringList.at( selectIndex ) );
+ QString title = mTargetItem->label();
+ QString drive = FmDlgUtils::showBackupDriveQuery( title );
+ if( ( !drive.isEmpty() ) &&
+ ( mBackupSettings->targetDrive().compare( drive, Qt::CaseInsensitive ) != 0 ) ) {
+ mBackupSettings->setTargetDrive( drive );
emit doModelRefresh();
}
}
+
+void FmBackupWidget::updateBackupDate()
+{
+ mBackupSettings->updateBackupDate();
+ emit doModelRefresh();
+}
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h Tue Aug 24 10:24:14 2010 +0800
@@ -35,28 +35,34 @@
public:
FmBackupWidget( QGraphicsItem *parent = 0 );
~FmBackupWidget();
+ void updateBackupDate();
signals:
void doModelRefresh();
+ void changeContents();
+ void changeScheduling();
+ void changeWeekday();
+ void changeTime();
+ void changeTargetDrive();
+public slots:
+ // refresh whole model immediately.
+ void refreshModel();
+
private slots:
- void on_list_released( const QModelIndex &index );
- void on_list_pressed( const QModelIndex &index );
- void on_list_scrollingStarted();
-
- void refreshModel();
+ void on_list_activated( const QModelIndex &index );
+
+ void on_changeContents();
+ void on_changeScheduling();
+ void on_changeWeekday();
+ void on_changeTime();
+ void on_changeTargetDrive();
private:
void initModel();
void init();
void expandAllGroup();
-
- void ChangeContents();
- void ChangeScheduling();
- void ChangeWeekday();
- void ChangeTime();
- void ChangeTargetDrive();
private:
@@ -70,12 +76,9 @@
HbDataFormModelItem *mSchedulingItem;
HbDataFormModelItem *mWeekdayItem;
HbDataFormModelItem *mTimeItem;
-
+ HbDataFormModelItem *mLastBackupDateItem;
FmBackupSettings *mBackupSettings;
FmBackupConfigLoader *mBackupConfigLoader;
- HbDataFormModelItem *mLastPressedItem;
-
- bool mScrolled;
};
#endif // FMBACKUPWIDGET_H
--- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -20,6 +20,7 @@
#include "fmdeletebackupwidget.h"
#include "fmviewmanager.h"
#include "fmoperationbase.h"
+#include "fmdlgutils.h"
#include <QApplication>
@@ -27,9 +28,6 @@
#include <hbtoolbar.h>
#include <hbmenu.h>
#include <hbmainwindow.h>
-#include <hbmessagebox.h>
-
-
FmDeleteBackupView::FmDeleteBackupView() : FmViewBase( EDeleteBackupView )
{
@@ -37,11 +35,8 @@
initMainWidget();
initToolBar();
- initMenu();
- adjustActions();
+ initMenu();
mOperationService = FmViewManager::viewManager()->operationService();
-
- QMetaObject::connectSlotsByName( this );
}
FmDeleteBackupView::~FmDeleteBackupView()
@@ -57,12 +52,15 @@
action->setObjectName( "rotateAction" );
action->setText( hbTrId( "Change orientation" ) );
menu()->addAction( action );
+ connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection );
#endif
mDeleteAction = new HbAction( this );
mDeleteAction->setObjectName( "deleteAction" );
mDeleteAction->setText( hbTrId( "Delete backups" ) );
menu()->addAction( mDeleteAction );
+ mDeleteAction->setEnabled(false);
+ connect( mDeleteAction, SIGNAL(triggered()), this, SLOT( on_deleteAction_triggered() ), Qt::QueuedConnection );
}
void FmDeleteBackupView::initMainWidget()
@@ -70,22 +68,33 @@
mDeleteBackupWidget = new FmDeleteBackupWidget( this );
mDeleteBackupWidget->setObjectName( "deleteBackupWidget" );
setWidget( mDeleteBackupWidget );
+ connect(mDeleteBackupWidget, SIGNAL(stateChanged(int)), this, SLOT(on_deleteBackupWidget_stateChanged(int)));
}
+void FmDeleteBackupView::on_deleteBackupWidget_stateChanged(int state)
+{
+ Q_UNUSED(state);
+ QList<int> items = mDeleteBackupWidget->selectionIndexes();
+ if (items.count() > 0) {
+ mLeftAction->setEnabled(true);
+ mDeleteAction->setEnabled(true);
+ } else {
+ mLeftAction->setEnabled(false);
+ mDeleteAction->setEnabled(false);
+ }
+}
+
void FmDeleteBackupView::initToolBar()
{
mLeftAction = new HbAction( this );
mLeftAction->setObjectName( "leftAction" );
mLeftAction->setText( hbTrId( "delete" ) );
toolBar()->addAction( mLeftAction );
-
+ mLeftAction->setEnabled(false);
toolBar()->setOrientation( Qt::Horizontal );
- //action = new HbAction( this );
- //action->setObjectName( "rightAction" );
- //action->setText( tr( "" ) );
- //toolBar()->addAction( action );
+ connect( mLeftAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection );
}
void FmDeleteBackupView::on_leftAction_triggered()
@@ -108,7 +117,7 @@
void FmDeleteBackupView::on_deleteAction_triggered()
{
QList<int > items = mDeleteBackupWidget->selectionIndexes();
- if( items.count() <= 0 || !HbMessageBox::question( tr("Confirm Deletion?" ) ) ){
+ if( items.count() <= 0 || !FmDlgUtils::question( hbTrId("Confirm Deletion?" ) ) ){
return;
}
@@ -120,18 +129,7 @@
mOperationService->syncDeleteBackup( selection );
mDeleteBackupWidget->refresh();
- adjustActions();
-}
-
-void FmDeleteBackupView::adjustActions()
-{
- if( mDeleteBackupWidget->backupDataCount() > 0 ) {
- mDeleteAction->setDisabled( false );
- mLeftAction->setDisabled( false );
- } else {
- mDeleteAction->setDisabled( true );
- mLeftAction->setDisabled( true );
- }
+ on_deleteBackupWidget_stateChanged(0);
}
void FmDeleteBackupView::removeToolBarAction()
@@ -139,3 +137,7 @@
toolBar()->removeAction( mLeftAction );
}
+void FmDeleteBackupView::refreshDeleteBackupView()
+{
+ mDeleteBackupWidget->refresh();
+}
--- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -20,6 +20,7 @@
#include "fmrestorewidget.h"
#include "fmviewmanager.h"
#include "fmoperationbase.h"
+#include "fmdlgutils.h"
#include <QApplication>
@@ -27,9 +28,6 @@
#include <hbtoolbar.h>
#include <hbmenu.h>
#include <hbmainwindow.h>
-#include <hbmessagebox.h>
-
-
FmRestoreView::FmRestoreView(): FmViewBase( ERestoreView )
{
@@ -37,11 +35,8 @@
initMainWidget();
initToolBar();
- initMenu();
- adjustActions();
+ initMenu();
mOperationService = FmViewManager::viewManager()->operationService();
-
- QMetaObject::connectSlotsByName( this );
}
FmRestoreView::~FmRestoreView()
@@ -57,12 +52,15 @@
action->setObjectName( "rotateAction" );
action->setText( hbTrId( "Change orientation" ) );
menu()->addAction( action );
+ connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection );
#endif
mRestoreAction = new HbAction( this );
mRestoreAction->setObjectName( "restoreAction" );
mRestoreAction->setText( hbTrId( "Restore data" ) );
menu()->addAction( mRestoreAction );
+ mRestoreAction->setEnabled(false);
+ connect( mRestoreAction, SIGNAL(triggered()), this, SLOT( on_restoreAction_triggered() ), Qt::QueuedConnection );
}
void FmRestoreView::initMainWidget()
@@ -70,6 +68,7 @@
mRestoreWigdet = new FmRestoreWigdet( this );
setWidget( mRestoreWigdet );
+ connect(mRestoreWigdet, SIGNAL(stateChanged(int)), this, SLOT(onCheckBoxStateChange()));
}
@@ -79,7 +78,9 @@
mLeftAction->setObjectName( "leftAction" );
mLeftAction->setText( hbTrId( "Restore" ) );
toolBar()->addAction( mLeftAction );
-
+ connect( mLeftAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection );
+
+ mLeftAction->setEnabled(false);
toolBar()->setOrientation( Qt::Horizontal );
}
@@ -98,13 +99,13 @@
case FmErrNone:
break;
case FmErrWrongParam:
- HbMessageBox::information( QString( hbTrId("Operation canceled with wrong param!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation canceled with wrong param!") ) );
break;
case FmErrAlreadyStarted:
- HbMessageBox::information( QString( hbTrId("Operation canceled because already started!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation canceled because already started!") ) );
break;
default:
- HbMessageBox::information(tr("restore failed"));
+ FmDlgUtils::information(hbTrId("restore failed"));
break;
}
}
@@ -126,19 +127,24 @@
on_leftAction_triggered();
}
-void FmRestoreView::adjustActions()
-{
- if( mRestoreWigdet->backupDataCount() > 0 ) {
- mRestoreAction->setDisabled( false );
- mLeftAction->setDisabled( false );
- } else {
- mRestoreAction->setDisabled( true );
- mLeftAction->setDisabled( true );
- }
-}
-
void FmRestoreView::removeToolBarAction()
{
toolBar()->removeAction( mLeftAction );
}
+void FmRestoreView::onCheckBoxStateChange()
+{
+ QList<int> items = mRestoreWigdet->selectionIndexes();
+ if (items.count() > 0) {
+ mLeftAction->setEnabled(true);
+ mRestoreAction->setEnabled(true);
+ } else {
+ mLeftAction->setEnabled(false);
+ mRestoreAction->setEnabled(false);
+ }
+}
+
+void FmRestoreView::refreshRestoreView()
+{
+ mRestoreWigdet->refresh();
+}
--- a/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -16,9 +16,9 @@
* The source file of the restore view list item of file manager
*/
#include "fmrestoreviewitem.h"
-
+#include "fmfileiconprovider.h"
#include <QGraphicsLinearLayout>
-
+#include <QGraphicsGridLayout>
#include <hblabel.h>
#include <hbcheckbox.h>
#include <hbwidget.h>
@@ -29,10 +29,11 @@
: HbListViewItem( parent ),
mRestoreContentLabel( 0 ),
mDateTimeLabel( 0 ),
- mCheckBox( 0 )
-
+ mCheckBox( 0 ),
+ hLayout( 0 ),
+ mParentWidget((HbWidget *)parent)
{
- init();
+ //init();
}
FmRestoreViewItem::~FmRestoreViewItem()
@@ -42,7 +43,7 @@
HbAbstractViewItem *FmRestoreViewItem::createItem()
{
- return new FmRestoreViewItem( parentItem() );
+ return new FmRestoreViewItem( *this );
}
void FmRestoreViewItem::polish(HbStyleParameters& params)
@@ -52,6 +53,9 @@
void FmRestoreViewItem::updateChildItems()
{
+ if( !hLayout ) {
+ init();
+ }
QString string = modelIndex().data( Qt::DisplayRole ).toString();
QStringList stringList = string.split( '\t' );
@@ -60,57 +64,70 @@
return;
}
- mRestoreContentLabel->setPlainText( stringList.first() );
+ mRestoreContentLabel->setPlainText(stringList.first());
- if( stringList.first() != stringList.last() ){
- mDateTimeLabel->setPlainText( stringList.last() );
- }
+ if (stringList.size() > 0)
+ {
+ mDateTimeLabel->setPlainText(stringList.at(1));
+ }
+ if (stringList.size() > 1)
+ {
+ QIcon icon = mIconProvider->icon(QFileInfo(stringList.at(2)));
+ // FmFileIconProvider already handle null icon issue
+ mIconLabel->setIcon(HbIcon(icon));
+ }
+
+ connect(this, SIGNAL(stateChanged(int)), mParentWidget,
+ SIGNAL(stateChanged(int)));
}
-
void FmRestoreViewItem::init()
{
- QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout();
- hLayout->setOrientation( Qt::Horizontal );
+ mIconProvider = new FmFileIconProvider();
+ hLayout = new QGraphicsLinearLayout();
+ hLayout->setOrientation(Qt::Horizontal);
+ hLayout->addItem(layout());
- mCheckBox = new HbCheckBox( this );
- hLayout->addItem( mCheckBox );
- hLayout->setAlignment( mCheckBox, Qt::AlignVCenter );
+ mCheckBox = new HbCheckBox(this);
+ hLayout->addItem(mCheckBox);
+ hLayout->setAlignment(mCheckBox, Qt::AlignVCenter);
- QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
- vLayout->setOrientation( Qt::Vertical );
+ QGraphicsGridLayout *vLayout = new QGraphicsGridLayout();
+
+ mRestoreContentLabel = new HbLabel("");
+ mRestoreContentLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+
+ mIconLabel = new HbLabel();
- mRestoreContentLabel = new HbLabel("");
- mRestoreContentLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
- vLayout->addItem( mRestoreContentLabel );
- vLayout->setAlignment( mRestoreContentLabel, Qt::AlignLeft );
+ mDateTimeLabel = new HbLabel("");
+ mDateTimeLabel->setFontSpec(HbFontSpec(HbFontSpec::Secondary));
+
+ vLayout->addItem(mRestoreContentLabel, 0, 0);
+ vLayout->addItem(mIconLabel, 0, 1);
+ vLayout->addItem(mDateTimeLabel, 1, 0);
- mDateTimeLabel = new HbLabel("");
- mDateTimeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- vLayout->addItem( mDateTimeLabel );
- vLayout->setAlignment( mDateTimeLabel, Qt::AlignLeft );
+ HbWidget *textWidget = new HbWidget();
+ textWidget->setLayout(vLayout);
- HbWidget *textWidget = new HbWidget();
- textWidget->setLayout(vLayout);
-
- hLayout->addItem( textWidget );
- hLayout->setAlignment( textWidget, Qt::AlignVCenter );
-
- setLayout( hLayout );
-
+ hLayout->addItem(textWidget);
+ hLayout->setAlignment(textWidget, Qt::AlignVCenter);
+
+ connect(mCheckBox, SIGNAL(stateChanged(int)), this,
+ SIGNAL(stateChanged(int)));
+ setLayout(hLayout);
}
void FmRestoreViewItem::setCheckBoxState()
{
if ( mCheckBox->checkState() == Qt::Unchecked ){
mCheckBox->setCheckState( Qt::Checked );
- setSelected( true );
+ setSelected( true );
}
else if( mCheckBox->checkState() == Qt::Checked ){
mCheckBox->setCheckState( Qt::Unchecked );
setSelected( false );
- }
+ }
}
bool FmRestoreViewItem::getCheckBoxState()
@@ -121,3 +138,4 @@
return true;
}
}
+
--- a/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -17,6 +17,7 @@
*/
#include "fmrestorewidget.h"
#include "fmrestoresettings.h"
+#include "fmbackupsettings.h"
#include "fmrestoreviewitem.h"
#include "fmoperationservice.h"
#include "fmviewmanager.h"
@@ -72,10 +73,12 @@
vLayout->addItem( mListView );
mModel = new QStringListModel();
- mListView->setModel( mModel );
-
+ mListView->setModel( mModel );
mRestoreSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->RestoreSettingsL();
mBackupConfigLoader = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->backupConfigLoader();
+
+ // load backup settings to refresh default target drive
+ FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->BackupSettingsL()->load();
mRestoreSettings->load( mBackupConfigLoader->driversAndOperationList() );
int index = 0;
@@ -89,6 +92,9 @@
QDateTime datetime = ( *it )->restoreInfo().dateTime();
string.append( '\t' );
string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") );
+ QString drive = ( *it )->restoreInfo().drive();
+ string.append( '\t' );
+ string.append( drive );
QVariant variant( string );
mModel->setData( mModel->index( index ), variant, Qt::DisplayRole );
@@ -96,8 +102,7 @@
++index;
}
- mListView->setItemPrototype( new FmRestoreViewItem( this ) );
-
+ mListView->setItemPrototype( new FmRestoreViewItem(this) );
}
void FmRestoreWigdet::on_list_activated( const QModelIndex &index )
@@ -105,11 +110,51 @@
FmRestoreViewItem *restoreViewItem = static_cast< FmRestoreViewItem* >
( mListView->itemByIndex( index ) );
- restoreViewItem->setCheckBoxState();
- emit checkStatusChanged();
+ restoreViewItem->setCheckBoxState();
}
int FmRestoreWigdet::backupDataCount()
{
return mModel->rowCount();
}
+
+void FmRestoreWigdet::refresh()
+{
+ mListView->setModel( 0 );
+ if( !mModel ) {
+ mModel = new QStringListModel();
+ }
+ mModel->removeRows( 0, mModel->rowCount() );
+
+ mRestoreSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->RestoreSettingsL();
+ mBackupConfigLoader = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->backupConfigLoader();
+ mRestoreSettings->load( mBackupConfigLoader->driversAndOperationList() );
+
+ int index = 0;
+ QList< FmRestoreEntry* > retoreEntryList = mRestoreSettings->restoreEntryList();
+ mModel->insertRows( 0, retoreEntryList.count() );
+ for ( QList< FmRestoreEntry* >::iterator it = retoreEntryList.begin();
+ it != retoreEntryList.end(); ++it ){
+ QString string = ( *it )->text();
+ QDateTime datetime = ( *it )->restoreInfo().dateTime();
+ QString drive = ( *it )->restoreInfo().drive();
+ string.append( '\t' );
+ string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") );
+ string.append( '\t' );
+ string.append( drive );
+ QVariant variant( string );
+ mModel->setData( mModel->index( index ), variant, Qt::DisplayRole );
+ ++index;
+ }
+ mListView->setModel( mModel );
+ mListView->setItemPrototype( new FmRestoreViewItem( this ) );
+
+ for (int i = 0; i < mModel->rowCount(); ++i) {
+ QModelIndex index = mModel->index(i);
+ FmRestoreViewItem* restoreViewItem = static_cast< FmRestoreViewItem* >
+ (mListView->itemByIndex(index));
+ connect(restoreViewItem, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int)));
+ }
+ emit stateChanged(0);
+
+}
--- a/filemanager/src/filemanager/src/components/fmcombinedquery.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmcombinedquery.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -25,10 +25,12 @@
#include <hblistwidgetitem.h>
#include <hbabstractviewitem.h>
-FmCombinedQuery::FmCombinedQuery( QGraphicsItem *parent ) : HbDialog( parent ),
+FmCombinedQuery::FmCombinedQuery( QGraphicsItem *parent ) : FmDialog( parent ),
mSelectMode ( MultiSelectMode ), mDominantIndex ( -1 )
{
+ setObjectName( "combinedQueryDialog" );
mContentWidget = new QGraphicsWidget();
+ mContentWidget->setObjectName( "CombinedQueryContentWidget" );
setContentWidget(mContentWidget);
QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
@@ -38,7 +40,7 @@
vLayout->addItem( mListWidget );
mListWidget->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
-
+ mListWidget->setObjectName( "CombinedQueryListWidget" );
this->setTimeout( NoTimeout );
mContentWidget->setLayout( vLayout );
@@ -110,7 +112,7 @@
void FmCombinedQuery::activated( const QModelIndex &index )
{
- int selectedRow = mListWidget->indexPosition( index );
+ int selectedRow = index.row();
if( selectedRow == mDominantIndex ){
QModelIndexList modelIndexList = mListWidget->selectionModel()->selectedIndexes();
for( QModelIndexList::const_iterator it = modelIndexList.begin(); it != modelIndexList.end(); ++it ){
--- a/filemanager/src/filemanager/src/components/fmdatalistmodel.cpp Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +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 the data list model of file manager
- */
-
-#include "fmdatalistmodel.h"
-
-
-FmDataListModel::FmDataListModel( QObject *parent )
- : QAbstractListModel( parent )
-{
-}
-
-int FmDataListModel::rowCount( const QModelIndex &parent ) const
-{
- if (parent.isValid())
- return 0;
-
- return mDisplayLst.count();
-}
-
-QVariant FmDataListModel::data( const QModelIndex &index, int role ) const
-{
- if ( index.row() < 0 || index.row() >= mDisplayLst.size() )
- return QVariant();
-
- if ( role == Qt::DisplayRole || role == Qt::EditRole )
- return mDisplayLst.at( index.row() );
-
- if ( role == Qt::UserRole )
- return mUserDataLst.at( index.row() );
-
- return QVariant();
-}
-
-Qt::ItemFlags FmDataListModel::flags( const QModelIndex &index ) const
-{
- if ( !index.isValid() )
- return QAbstractItemModel::flags( index ) | Qt::ItemIsDropEnabled;
-
- return QAbstractItemModel::flags( index ) | Qt::ItemIsEditable;
-}
-
-bool FmDataListModel::setData( const QModelIndex &index, const QVariant &value, int role )
-{
- if ( index.row() >= 0 && index.row() < mDisplayLst.size()
- && ( role == Qt::EditRole || role == Qt::DisplayRole ) ){
- mDisplayLst.replace( index.row(), value.toString() );
- emit dataChanged( index, index );
- return true;
- }
-
- if ( index.row() >= 0 && index.row() < mUserDataLst.size()
- && ( role == Qt::UserRole ) ) {
- mUserDataLst.replace( index.row(), value.toString() );
- emit dataChanged( index, index );
- return true;
- }
- return false;
-}
-
-bool FmDataListModel::insertRows( int row, int count, const QModelIndex &parent )
-{
- if ( count < 1 || row < 0 || row > rowCount( parent ) )
- return false;
-
- beginInsertRows( QModelIndex(), row, row + count - 1 );
-
- for ( int r = 0; r < count; ++r )
- {
- mDisplayLst.insert( row, QString() );
- mUserDataLst.insert( row, QString() );
- }
-
- endInsertRows();
-
- return true;
-}
-
-bool FmDataListModel::removeRows( int row, int count, const QModelIndex &parent )
-{
- if ( count <= 0 || row < 0 || ( row + count ) > rowCount( parent ) )
- return false;
-
- beginRemoveRows( QModelIndex(), row, row + count - 1 );
-
- for ( int r = 0; r < count; ++r )
- {
- mDisplayLst.removeAt( row );
- mUserDataLst.removeAt( row );
- }
-
- endRemoveRows();
- return true;
-}
--- a/filemanager/src/filemanager/src/components/fmdatalistmodel.h Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +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 the data list model of file manager
- */
-
-#ifndef FMDATALISTMODEL_H
-#define FMDATALISTMODEL_H
-
-#include "fmcommon.h"
-
-#include <QStringList>
-#include <QAbstractItemView>
-
-class FmDataListModel : public QAbstractListModel
-{
- Q_OBJECT
-public:
- FmDataListModel(QObject *parent = 0);
-
- /**
- * Return row count
- * @param parent ModelIndex
- * @return row count
- */
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
-
- /**
- * Return data of designated role
- * @param index ModelIndex
- * @param role role of data, DisplayRole for show and UserRole for data
- * @return data
- */
- QVariant data(const QModelIndex &index, int role) const;
-
- /**
- * Set data of designated role
- * @param index ModelIndex
- * @param role role of data, DisplayRole for show and UserRole for data
- * @return if operation succeed
- */
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole);
-
- /**
- * Get flags
- * @param index ModelIndex
- * @return flags
- */
- Qt::ItemFlags flags(const QModelIndex &index) const;
-
- /**
- * Insert count rows into the model before the given row.
- * @param row the given row,
- * @param count count of rows
- * @param parent parent ModelIndex
- * @return if operation succeed
- */
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
- /**
- * Remove count rows from the model at the given row.
- * @param row the given row,
- * @param count count of rows
- * @param parent parent ModelIndex
- * @return if operation succeed
- */
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private:
- QStringList mDisplayLst;
- QStringList mUserDataLst;
-};
-
-#endif // FMDATALISTMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmdialog.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,91 @@
+/*
+ * 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 filemanager base dialog class
+ */
+
+#include "fmdialog.h"
+#include <hbdialog.h>
+
+FmDialog::FmDialog( QGraphicsItem *parent) : HbDialog( parent ), mRetAction( 0 )
+{
+
+}
+
+HbAction *FmDialog::exec()
+{
+ HbDialog::open( this, SLOT(dialogClosed(HbAction*)) );
+ mEventLoop.exec();
+ return mRetAction;
+}
+
+void FmDialog::dialogClosed(HbAction *action)
+{
+ mRetAction = action;
+ mEventLoop.exit();
+}
+
+HbAction *FmDialog::primaryAction() const
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() > 0) {
+ return (HbAction *)(actionList.at(0));
+ } else {
+ return 0;
+ }
+
+}
+
+void FmDialog::setPrimaryAction( HbAction *action )
+{
+ action->setObjectName( "primaryAction" );
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() == 0) {
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 1) {
+ actionList.clear();
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 2) {
+ actionList.removeAt(0);
+ actionList.insert(0, action);
+ }
+}
+
+HbAction *FmDialog::secondaryAction() const
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() > 1) {
+ return (HbAction *)(actionList.at(1));
+ } else {
+ return 0;
+ }
+}
+
+void FmDialog::setSecondaryAction( HbAction *action )
+{
+ action->setObjectName( "secondaryAction" );
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() == 0) {
+ HbAction *primaryAction = new HbAction(hbTrId("txt_common_button_ok"));
+ primaryAction->setObjectName( "primaryAction" );
+ QGraphicsWidget::addAction(primaryAction);
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 1) {
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 2) {
+ actionList.removeAt(1);
+ actionList.insert(1, action);
+ }
+}
--- a/filemanager/src/filemanager/src/components/fmdlgutils.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdlgutils.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -23,6 +23,8 @@
#include "fmmultitextquery.h"
#include "fmutils.h"
#include "fmviewmanager.h"
+#include "fmmessagebox.h"
+#include "fmdrivequery.h"
#include <QString>
#include <QStringList>
@@ -30,34 +32,29 @@
#include <hblabel.h>
#include <hbaction.h>
-#include <hbmessagebox.h>
-FmDlgUtils::FmDlgUtils( void )
+/*
+ Private Constructor
+*/
+FmDlgUtils::FmDlgUtils()
{
}
-FmDlgUtils::~FmDlgUtils( void )
+/*!
+ Destructor
+*/
+FmDlgUtils::~FmDlgUtils()
{
}
-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;
-}
-
+/*!
+ Shows single select setting query dialog
+ \a title used for title text
+ \a textList used for text list for available settings
+ \a selectedIndex used for storing selected index
+ Dialog will be closed as canceled while drive in \a associatedDrives is removed
+ return true if selection made, otherwise false
+*/
bool FmDlgUtils::showSingleSettingQuery(
const QString &title,
const QStringList &textList,
@@ -82,8 +79,8 @@
cQuery->setMarkedListItem( selectedIndex );
}
- QString sk1 ( tr ( "ok" ) );
- QString sk2 ( tr ("cancel" ) );
+ QString sk1 ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId("txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -127,6 +124,15 @@
return ret;
}
+/*!
+ Shows multi select setting query dialog
+ \a title used for title text
+ \a textList used for text list for available settings
+ \a selection used for storing selected indexes as bitmask
+ \a dominantIndex used for dominant index for select all behaviour
+ Dialog will be closed as canceled while drive in \a associatedDrives is removed
+ return true if selection made, otherwise false
+*/
bool FmDlgUtils::showMultiSettingQuery(
const QString &title,
const QStringList &textList,
@@ -158,8 +164,8 @@
}
- QString sk1 ( hbTrId( "ok" ) );
- QString sk2 ( hbTrId( "cancel" ) );
+ QString sk1 ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -202,6 +208,13 @@
return ret;
}
+/*!
+ Shows time setting query dialog
+ \a title used for title text
+ \a time used for selected time
+ Dialog will be closed as canceled while drive in \a associatedDrives is removed
+ return true if selection made, otherwise false
+*/
bool FmDlgUtils::showTimeSettingQuery(
const QString &title, QTime &time, const QString &associatedDrives )
{
@@ -212,8 +225,8 @@
cQuery->setHeadingWidget( new HbLabel( title ) );
cQuery->setTime( time );
- QString sk1 ( hbTrId( "ok" ) );
- QString sk2 ( hbTrId( "cancel" ) );
+ QString sk1 ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -244,25 +257,33 @@
return ret;
}
+/*!
+ Shows text query dialog
+ \a title used for title text
+ \a text used for receiving user input text
+ \a validRegExpStringList used for set valid regExp string list
+ \a maxLength used for setting max length of input text
+ Dialog will be closed as canceled while drive in \a associatedDrives is removed
+ Set \a isReturnFalseWhenNoTextChanged true if need make return value as true while no text changed
+ return true if text change is made, otherwise false
+*/
bool FmDlgUtils::showTextQuery(
- const QString& title, QString& text, bool isDimPrimaryActionWhenEmpty, int maxLength,
- const QString &associatedDrives )
+ const QString& title, QString& text, QStringList validRegExpStringList,
+ int maxLength, const QString &associatedDrives, bool isReturnFalseWhenNoTextChanged )
{
bool ret( false );
bool ok ( true ); // SK return (out parameter)
- FmSingleTextQuery::Options options( 0 );
- if( isDimPrimaryActionWhenEmpty ) {
- options = FmSingleTextQuery::DimPrimereActionWhenEmpty;
- }
- FmSingleTextQuery *cQuery = new FmSingleTextQuery( options );
+ FmSingleTextQuery *cQuery = new FmSingleTextQuery();
if( maxLength != -1 ){
cQuery->setLineEditMaxLength( maxLength );
}
cQuery->setHeadingWidget( new HbLabel( title ) );
- QString sk1 ( hbTrId ( "ok" ) );
- QString sk2 ( hbTrId ( "cancel" ) );
+ cQuery->setRegExpStringList( validRegExpStringList );
+
+ QString sk1 ( hbTrId ( "txt_common_button_ok" ) );
+ QString sk2 ( hbTrId ( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -286,7 +307,14 @@
if( ok ){
QString newName = cQuery->getLineEditText();
- if ( newName != text ){
+ if ( newName == text ){
+ if( isReturnFalseWhenNoTextChanged ) {
+ ret = false;
+ }
+ else {
+ ret = true;
+ }
+ } else {
text = newName;
ret = true;
}
@@ -295,16 +323,28 @@
return ret;
}
-bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, const QString &associatedDrives )
+/*!
+ Shows single-line password query dialog
+ \a title used for title text
+ \a pwd used for receiving user input password
+ \a maxLength used for setting max length of input password
+ Dialog will be closed as canceled while drive in \a associatedDrives is removed
+ return true if password text is inputted, otherwise false
+*/
+bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, int maxLength, const QString &associatedDrives )
{
bool ret( false );
- FmSingleTextQuery *cQuery = new FmSingleTextQuery( FmSingleTextQuery::DimPrimereActionWhenEmpty,
- HbLineEdit::Password );
+ FmSingleTextQuery *cQuery = new FmSingleTextQuery( HbLineEdit::Password );
+ if( maxLength != -1 ){
+ cQuery->setLineEditMaxLength( maxLength );
+ }
cQuery->setHeadingWidget( new HbLabel( title ) );
-
- QString sk1 ( tr ("ok" ) );
- QString sk2 ( tr ("cancel" ) );
+
+ // validate that length is not zero. space is acceptable character.
+ cQuery->setRegExpStringList( QStringList( Regex_ValidUnZeroLength ) );
+ QString sk1 ( hbTrId("txt_common_button_ok" ) );
+ QString sk2 ( hbTrId("txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -330,17 +370,29 @@
return ret;
}
+/*!
+ Shows mulit-line password query dialog. If two password is not equal, primary action is dimmed
+ \a firstLabel used for first line title text
+ \a secondLabel used for second line title text
+ \a pwd used for receiving user input password
+ \a maxLength used for setting max length of input password
+ Dialog will be closed as canceled while drive in \a associatedDrives is removed
+ return true if password text is inputted, otherwise false
+*/
bool FmDlgUtils::showMultiPasswordQuery(
- const QString &firstLabel, const QString &secondLabel, QString &pwd, const QString &associatedDrives )
+ const QString &firstLabel, const QString &secondLabel, QString &pwd, int maxLength, const QString &associatedDrives )
{
bool ret( false );
FmMultiTextQuery *cQuery = new FmMultiTextQuery( HbLineEdit::Password );
+ if( maxLength != -1 ){
+ cQuery->setLineEditMaxLength( maxLength );
+ }
cQuery->setFirstLabelText( firstLabel );
cQuery->setSecondLabelText( secondLabel );
- QString sk1 = ( hbTrId( "ok" ) );
- QString sk2 = ( hbTrId( "cancel" ) );
+ QString sk1 = ( hbTrId( "txt_common_button_ok" ) );
+ QString sk2 = ( hbTrId( "txt_common_button_cancel" ) );
if( !sk1.isEmpty() ) {
HbAction *primary = new HbAction( sk1 );
@@ -369,3 +421,75 @@
delete cQuery;
return ret;
}
+
+/*!
+ This is a convenience function for showing a question dialog with \a questionText
+ Default buttons are Yes and No.
+*/
+bool FmDlgUtils::question( const QString &questionText,
+ HbMessageBox::StandardButtons buttons )
+{
+ FmMessageBox msgBox;
+ return msgBox.question( questionText, buttons );
+}
+
+/*!
+ This is a convenience function for showing an information dialog with \a informationText
+ Default button is OK.
+*/
+void FmDlgUtils::information( const QString &informationText,
+ HbMessageBox::StandardButtons buttons )
+{
+ FmMessageBox msgBox;
+ return msgBox.information( informationText, buttons );
+}
+
+/*!
+ Shows query dialog for select backup drive
+ \a title used for title text
+ only backup target drives will be shown.
+ return selected drive, and empty string for cancel.
+*/
+QString FmDlgUtils::showBackupDriveQuery( const QString& title )
+{
+ QString ret;
+
+ FmDriveQuery *cQuery = new FmDriveQuery();
+ cQuery->setHeadingWidget( new HbLabel( title ) );
+
+ QString sk = ( hbTrId( "txt_common_button_cancel" ) );
+
+ HbAction *primary = new HbAction( sk );
+ cQuery->setPrimaryAction( primary );
+
+ executeDialog( cQuery, QString() );
+ ret = cQuery->selectedDrive();
+
+ delete cQuery;
+ return ret;
+}
+
+/*
+ Private function used to popup \a dialog
+ If want popup dialog in class FmDlgUtils, please call this function.
+ Dialog will be closed as canceled while drive in \a associatedDrives is removed
+ return selected action.
+*/
+HbAction *FmDlgUtils::executeDialog( FmDialog *dialog, const QString &associatedDrives )
+{
+ for( int i = 0; i < associatedDrives.length(); i++ ) {
+ QString drive( associatedDrives[i] + QString( ":/" ) );
+ if( !FmUtils::isDriveAvailable( drive ) ) {
+ FM_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;
+}
--- a/filemanager/src/filemanager/src/components/fmdlgutils.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdlgutils.h Tue Aug 24 10:24:14 2010 +0800
@@ -25,37 +25,26 @@
#include <QStringList>
#include <QTime>
-class HbDialog;
+#include <hbglobal.h>
+#include <hbmessagebox.h>
+
+class FmDialog;
class HbAction;
+/*!
+ \class FmDlgUtils
+ \brief The class FmDlgUtils is static utility class. Used to popup dialogs
+ */
class FmDlgUtils : public QObject
{
Q_OBJECT
public:
-
- /**
- * Shows single select setting page
- *
- * @param title Title text
- * @param textList Text list for available settings
- * @param selectedIndex For storing selected index
- * @return true if selection made, otherwise false
- */
static bool showSingleSettingQuery(
const QString &title,
const QStringList &textList,
int &selectedIndex,
const QString &associatedDrives = QString() );
- /**
- * Shows multi select setting page
- *
- * @param title Title text
- * @param textList Text list for available settings
- * @param selection For storing selected indexes as bitmask
- * @param dominantIndex Dominant index for select all behaviour
- * @return true if selection made, otherwise false
- */
static bool showMultiSettingQuery(
const QString &title,
const QStringList &textList,
@@ -63,33 +52,34 @@
int dominantIndex,
const QString &associatedDrives = QString() );
- /**
- * Shows time setting page
- *
- * @param title Title text id
- * @param time Selected time
- * @return true if selection made, otherwise false
- */
static bool showTimeSettingQuery(
const QString &title, QTime &time,
- const QString &associatedDrives = QString() );
+ const QString &associatedDrives = QString() );
static bool showTextQuery(
- const QString &title, QString &driveName, bool isDimPrimaryActionWhenEmpty, int maxLength = -1,
- const QString &associatedDrives = QString() );
+ const QString &title, QString &text, QStringList validRegExpStringList = QStringList( Regex_ValidUnEmpty ),
+ int maxLength = -1, const QString &associatedDrives = QString(), bool isReturnFalseWhenNoTextChanged = true );
static bool showSinglePasswordQuery(
- const QString &title, QString &pwd,
- const QString &associatedDrives = QString() );
+ const QString &title, QString &pwd, int maxLength = -1,
+ const QString &associatedDrives = QString() );
static bool showMultiPasswordQuery(
- const QString &firstLabel, const QString &secondLabel, QString &pwd,
- const QString &associatedDrives = QString() );
+ const QString &firstLabel, const QString &secondLabel, QString &pwd, int maxLength = -1,
+ const QString &associatedDrives = QString() );
+
+ static bool question( const QString &questionText,
+ HbMessageBox::StandardButtons buttons = HbMessageBox::Yes | HbMessageBox::No );
- ~FmDlgUtils(void);
+ static void information( const QString &informationText,
+ HbMessageBox::StandardButtons buttons = HbMessageBox::Ok );
+
+ static QString showBackupDriveQuery( const QString& title );
+
+ ~FmDlgUtils();
private:
- FmDlgUtils(void);
- static HbAction *executeDialog( HbDialog *dialog, const QString &associatedDrives );
+ FmDlgUtils();
+ static HbAction *executeDialog( FmDialog *dialog, const QString &associatedDrives );
};
--- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -17,158 +17,128 @@
*/
#include "fmdrivedetailstype.h"
+#include "fmfiletyperecognizer.h"
#include "fmutils.h"
#include <QDir>
#include <QFileInfo>
#include <QStringList>
-QList<FmDriveDetailsDataGroup*> FmDriveDetailsContent::queryDetailsContent()
-{
- QStringList typeFilters;
- QList< FmDriveDetailsDataGroup* > dataGroupList;
- typeFilters.append( QString( "*.bmp" ) );
- typeFilters.append( QString( "*.gif" ) );
- typeFilters.append( QString( "*.jpe" ) );
- typeFilters.append( QString( "*.jpeg" ) );
- typeFilters.append( QString( "*.jpg" ) );
- typeFilters.append( QString( "*.ota" ) );
- typeFilters.append( QString( "*.png" ) );
- typeFilters.append( QString( "*.tif" ) );
- typeFilters.append( QString( "*.tiff" ) );
- typeFilters.append( QString( "*.wbmp" ) );
- typeFilters.append( QString( "*.wmf" ) );
- typeFilters.append( QString( "*.jp2" ) );
- typeFilters.append( QString( "*.jpg2" ) );
- typeFilters.append( QString( "*.jp3" ) );
- typeFilters.append( QString( "*.ico" ) );
- typeFilters.append( QString( "*.vcf" ) );
-
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupImages, typeFilters ));
+int FmDriveDetailsContent::querySizeofContent( const QString &driveName,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
+{
+ int err = FmErrNone;
+ detailsSizeList.clear();
+ err = getDataSizeByTraversePath( driveName, detailsSizeList, isStopped );
+ if( err != FmErrNone ) {
+ return err;
+ }
+
+ QStringList dataPathList;
+ dataPathList.append( QString( FmViewDetail_Contacts ) );
+ FmDriveDetailsDataGroup driveDetailsDataGroup( FmDriveDetailsSize::ETypeContacts, dataPathList );
+
+ err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroup, detailsSizeList, isStopped);
+ if( err != FmErrNone ) {
+ return err;
+ }
- typeFilters.clear();
- typeFilters.append( QString( "*.aac" ) );
- typeFilters.append( QString( "*.amr" ) );
- typeFilters.append( QString( "*.au" ) );
- typeFilters.append( QString( "*.awb" ) );
- typeFilters.append( QString( "*.mid" ) );
- typeFilters.append( QString( "*.mp3" ) );
- typeFilters.append( QString( "*.ra" ) );
- typeFilters.append( QString( "*.rmf" ) );
- typeFilters.append( QString( "*.rng" ) );
- typeFilters.append( QString( "*.snd" ) );
- typeFilters.append( QString( "*.wav" ) );
- typeFilters.append( QString( "*.wve" ) );
- typeFilters.append( QString( "*.wma" ) );
- typeFilters.append( QString( "*.m4a" ) );
- typeFilters.append( QString( "*.ott" ) );
- typeFilters.append( QString( "*.mxmf" ) );
+ return FmErrNone;
+}
+int FmDriveDetailsContent::getDataSizeByTraversePath( const QString &driveName,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
+{
+ qint64 imageSize( 0 );
+ qint64 soundSize( 0 );
+ qint64 midpJavaSize( 0 );
+ qint64 nativeAppsSize( 0 );
+ qint64 videoSize( 0 );
+ qint64 documentsSize( 0 );
+
+ FmFileTypeRecognizer fileTypeRecognizer;
+
+ QList<QDir> dirs;
+ dirs.append( QDir( driveName ) );
+
+ // traverse the whole drive
+ while (!dirs.isEmpty()) {
+ QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries;
+ // do not summarize system and hidden files, these size will go into others category
+ // if( isSysHiddenIncluded ) {
+ // filter = filter | QDir::Hidden | QDir::System;
+ // }
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupSoundFiles, typeFilters ));
-
- typeFilters.clear();
- typeFilters.append( QString( "*.jad" ) );
- typeFilters.append( QString( "*.jar" ) );
-
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupMidpJava, typeFilters ));
-
- typeFilters.clear();
- typeFilters.append( QString( "*.sis" ) );
- typeFilters.append( QString( "*.sisx" ) );
-
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupNativeApps, typeFilters ));
-
- typeFilters.clear();
- typeFilters.append( QString( "*.3gp" ) );
- typeFilters.append( QString( "*.mp4" ) );
- typeFilters.append( QString( "*.nim" ) );
- typeFilters.append( QString( "*.rm" ) );
- typeFilters.append( QString( "*.rv" ) );
- typeFilters.append( QString( "*.wmv" ) );
- typeFilters.append( QString( "*.3g2" ) );
-
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupVideos, typeFilters ));
-
- typeFilters.clear();
- typeFilters.append( QString( "*.doc" ) );
- typeFilters.append( QString( "*.pdf" ) );
- typeFilters.append( QString( "*.pps" ) );
- typeFilters.append( QString( "*.ppt" ) );
- typeFilters.append( QString( "*.txt" ) );
- typeFilters.append( QString( "*.xls" ) );
-
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupDocuments, typeFilters ));
-
- typeFilters.clear();
- typeFilters.append( QString( "*.vcs" ) );
-
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupCalendar, typeFilters ));
-
- return dataGroupList;
-
+ QFileInfoList infoList = dirs.first().entryInfoList( filter );
+ for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) {
+ if ( *isStopped ){
+ return FmErrCancel;
+ }
+
+ if ( it->isFile() ) {
+ FmFileTypeRecognizer::FileType fileType =
+ fileTypeRecognizer.getType( it->absoluteFilePath() );
+ switch ( fileType )
+ {
+ case FmFileTypeRecognizer::FileTypeImage:
+ imageSize += it->size();
+ break;
+ case FmFileTypeRecognizer::FileTypeTone:
+ soundSize += it->size();
+ break;
+ case FmFileTypeRecognizer::FileTypeJava:
+ midpJavaSize += it->size();
+ break;
+ case FmFileTypeRecognizer::FileTypeSisx:
+ nativeAppsSize += it->size();
+ break;
+ case FmFileTypeRecognizer::FileTypeVideo:
+ videoSize += it->size();
+ break;
+ case FmFileTypeRecognizer::FileTypeText:
+ documentsSize += it->size();
+ break;
+ default:
+ // do not need handle other type
+ break;
+ }
+ }
+ else if ( it->isDir() ) {
+ dirs.append( QDir( it->absoluteFilePath() ) );
+ }
+ }
+ dirs.removeFirst();
+ }
+
+ // store result to detailsSizeList.
+ detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeImages, imageSize ) ) ;
+ detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeSoundFiles, soundSize ) );
+ detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeMidpJava, midpJavaSize ) );
+ detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeNativeApps, nativeAppsSize ) );
+ detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeVideos, videoSize ) );
+ detailsSizeList.append( new FmDriveDetailsSize( FmDriveDetailsSize::ETypeDocuments, documentsSize ) );
+ return FmErrNone;
}
-int FmDriveDetailsContent::querySizeofContent( const QString &driveName,
- QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
-{
+int FmDriveDetailsContent::getDataSizeByAbsolutePath( const QString &driveName,
+ const FmDriveDetailsDataGroup &dataGroup,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
+{
quint64 totalSize = 0;
-
- QString path;
- path.clear();
+ QStringList typeFilter = dataGroup.pathList();
- if( FmUtils::isDriveC( driveName )){
- path = QString( "c:\\Data\\" );
- }
- else{
- path = driveName;
- }
-
- QList< FmDriveDetailsDataGroup* > dataGroupList = queryDetailsContent();
-
- QStringList typeFilter;
- detailsSizeList.clear();
- QDir dir( path );
-
- for( QList< FmDriveDetailsDataGroup* >::iterator it = dataGroupList.begin();
- it!= dataGroupList.end(); ++it ){
+ for( QStringList::const_iterator it = typeFilter.begin();
+ it!= typeFilter.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
+ }
+ QString driver(FmUtils::removePathSplash(FmUtils::getDriveNameFromPath(driveName)));
+ QFileInfo fileInfo(QString(driver + (*it)));
+ if (fileInfo.exists()) {
+ totalSize += fileInfo.size();
}
- totalSize = 0;
- typeFilter = ( *it )->typeFilters();
-
- QList<QDir> dirs;
- dirs.append( QDir( path ) );
-
- while (!dirs.isEmpty()) {
- QFileInfoList infoList = dirs.first().entryInfoList( QDir::NoDotAndDotDot | QDir::AllEntries );
- QFileInfoList filterInforList = dirs.first().entryInfoList( typeFilter, QDir::NoDotAndDotDot | QDir::Files );
-
- for ( QFileInfoList::Iterator it = filterInforList.begin(); it != filterInforList.end(); ++it ) {
- if ( *isStopped ){
- return FmErrCancel;
- }
-
- if ( it->isFile() ) {
- totalSize += it->size();
- }
- }
-
- for ( QFileInfoList::Iterator it = infoList.begin(); it != infoList.end(); ++it ) {
- if ( *isStopped ){
- return FmErrCancel;
- }
-
- if ( it->isDir() ) {
- dirs.append( QDir( it->absoluteFilePath() ) );
- }
- }
-
- dirs.removeFirst();
- }
-
- detailsSizeList.append( new FmDriveDetailsSize( ( *it )->dataGroups(), totalSize ) );
}
+
+ detailsSizeList.append( new FmDriveDetailsSize( dataGroup.dataType(), totalSize ) );
return FmErrNone;
}
@@ -233,7 +203,7 @@
}
QFileInfoList infoList = dirs.first().entryInfoList( filter );
- for ( QFileInfoList::Iterator it = infoList.begin(); it != infoList.end(); ++it ) {
+ for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
--- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.h Tue Aug 24 10:24:14 2010 +0800
@@ -23,50 +23,29 @@
#include <QList>
#include <QStringList>
-class FmDriveDetailsDataGroup
-{
-public:
- enum TDataGroups{
- EGroupImages = 0,
- EGroupSoundFiles,
- EGroupMidpJava,
- EGroupNativeApps,
- EGroupVideos,
- EGroupDocuments,
- EGroupCalendar,
- EGroupContacts,
- EGroupMessages,
- EGroupOthers
- };
-
-public:
- FmDriveDetailsDataGroup( TDataGroups dataGroups, QStringList typeFilters )
- : mDataGroups( dataGroups ), mTypeFilters( typeFilters ) {}
- FmDriveDetailsDataGroup( const FmDriveDetailsDataGroup &other )
- {
- *this = other;
- }
-
- FmDriveDetailsDataGroup &operator= ( const FmDriveDetailsDataGroup &rhs )
- {
- this->mDataGroups = rhs.mDataGroups;
- this->mTypeFilters = rhs.mTypeFilters;
- return *this;
- }
-
- TDataGroups dataGroups() const { return mDataGroups; }
- QStringList typeFilters() const { return mTypeFilters; }
-
-private:
- TDataGroups mDataGroups;
- QStringList mTypeFilters;
-};
-
+/*
+ \class FmDriveDetailsSize
+ \brief The class FmDriveDetailsSize used to store view details result.
+ */
class FmDriveDetailsSize
{
public:
- FmDriveDetailsSize( FmDriveDetailsDataGroup::TDataGroups dataGroups, quint64 size )
- : mDataGroups( dataGroups ), mSize( size ) {}
+ enum TDataType{
+ ETypeImages = 0,
+ ETypeSoundFiles,
+ ETypeMidpJava,
+ ETypeNativeApps,
+ ETypeVideos,
+ ETypeDocuments,
+ ETypeCalendar,
+ ETypeContacts,
+ ETypeMessages,
+ ETypeOthers
+ };
+
+public:
+ FmDriveDetailsSize( TDataType dataType, quint64 size )
+ : mDataType( dataType ), mSize( size ) {}
FmDriveDetailsSize( const FmDriveDetailsSize &other )
{
*this = other;
@@ -74,40 +53,141 @@
FmDriveDetailsSize &operator= ( const FmDriveDetailsSize &rhs )
{
- this->mDataGroups = rhs.mDataGroups;
+ this->mDataType = rhs.mDataType;
this->mSize = rhs.mSize;
return *this;
}
- FmDriveDetailsDataGroup::TDataGroups dataGroups() const { return mDataGroups; }
+ /*!
+ request the stored data type
+ */
+ TDataType dataType() const { return mDataType; }
+
+ /*!
+ request the stored size that related to data type
+ */
quint64 size() const { return mSize; }
private:
- FmDriveDetailsDataGroup::TDataGroups mDataGroups;
+ /*!
+ store the data type
+ */
+ TDataType mDataType;
+
+ /*!
+ store the size that related to mDataType
+ */
quint64 mSize;
};
+/*
+ \class FmDriveDetailsDataGroup
+ \brief The class FmDriveDetailsDataGroup used to store command of get size of absolute file path.
+ */
+class FmDriveDetailsDataGroup
+{
+public:
+ FmDriveDetailsDataGroup( FmDriveDetailsSize::TDataType dataType,
+ QStringList filePathList )
+ : mDataType( dataType ), mFilePath( filePathList )
+ {
+ }
+ FmDriveDetailsDataGroup( const FmDriveDetailsDataGroup &other )
+ {
+ *this = other;
+ }
+
+ FmDriveDetailsDataGroup &operator= ( const FmDriveDetailsDataGroup &rhs )
+ {
+ this->mDataType = rhs.mDataType;
+ this->mFilePath = rhs.mFilePath;
+ return *this;
+ }
+
+ FmDriveDetailsSize::TDataType dataType() const { return mDataType; }
+ QStringList pathList() const { return mFilePath; }
+private:
+ /*!
+ Store which data type does mFilePath belong to.
+ */
+ FmDriveDetailsSize::TDataType mDataType;
+
+ /*!
+ Store absolute file path that will used to calcuate whole data size related to mDataType
+ */
+ QStringList mFilePath;
+};
+
+/*
+ \class FmDriveDetailsContent
+ \brief The class FmDriveDetailsContent is the interface of view details feature
+ */
class FmDriveDetailsContent
{
public:
- static QList<FmDriveDetailsDataGroup*> queryDetailsContent();
+ /*!
+ Gets data size for drive
+ \a driveName which drive is searching
+ \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
+ \a isStopped isStopped will be set as true if user cancel this operation
+ return Filemanage wide error. Please refer to fmdefine.h
+ */
static int querySizeofContent(
const QString &driveName, QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
-
+
+private:
+ /*!
+ Gets data size(related to file type,e.g. image, sound) by traverse designated drive name.
+ provide size except the path related to absolute path(getDataSizeByAbsolutePath)
+ \sa driveName which drive is searching
+ \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
+ \a isStopped isStopped will be set as true if user cancel this operation
+ return Filemanage wide error. Please refer to fmdefine.h
+ */
+ static int getDataSizeByTraversePath( const QString &driveName,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
+
+ /*!
+ Gets data size for single FmDriveDetailsDataGroup, the method is find file of absolute path
+ \a driveName which drive is searching
+ \a dataGroup which dataGroup is searching, for example, EGroupContacts...
+ \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
+ \a isStopped isStopped will be set as true if user cancel this operation
+ return Filemanage wide error. Please refer to fmdefine.h
+ */
+ static int getDataSizeByAbsolutePath( const QString &driveName, const FmDriveDetailsDataGroup &dataGroup,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
};
class FmFolderDetails
{
public:
+ /*!
+ Gets details for a list of folders
+ \a folderPathList folder path list
+ \a numofFolders output how many folders and subfolders in the list
+ \a numofFiles output how many files in the list
+ \a totalSize output the total size
+ \a isStopped isStopped will be set as true if user cancel this operation
+ \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true
+ return Filemanage wide error. Please refer to fmdefine.h
+ */
static int queryDetailOfContentList( const QStringList folderPathList,int &numofFolders,
int &numofFiles, quint64 &totalSize, volatile bool *isStopped, bool isSysHiddenIncluded = false );
-
+ /*!
+ Gets details for a folder
+ \a folderPath path of the folder
+ \a numofSubFolders output how many subfolders in the list, not include itself
+ \a numofFiles output how many files in the folder
+ \a sizeofFolder output the size of folder
+ \a isStopped isStopped will be set as true if user cancel this operation
+ \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true
+ return Filemanage wide error. Please refer to fmdefine.h
+ */
static int getNumofSubfolders( const QString &folderPath, int &numofSubFolders,
int &numofFiles, quint64 &sizeofFolder,
volatile bool *isStopped, bool isSysHiddenIncluded = false );
-
-
};
#endif /* FMDRIVEDETAILSTYPE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmdrivequery.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,96 @@
+/*
+ * 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 backup drive query of file manager
+ */
+
+#include "fmdrivequery.h"
+#include "fmviewmanager.h"
+#include "fmbackuprestorehandler.h"
+
+#include <QGraphicsLinearLayout>
+#include "hblistview.h"
+
+FmDriveQuery::FmDriveQuery( QGraphicsItem *parent ) : FmDialog( parent )
+{
+ setObjectName( "driveQueryDialog" );
+ mContentWidget = new QGraphicsWidget();
+ mContentWidget->setObjectName( "driveQueryContentWidget" );
+ setContentWidget(mContentWidget);
+
+ QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
+ vLayout->setOrientation( Qt::Vertical );
+
+ mListView = new HbListView();
+ mListView->setObjectName( "driveQueryListView" );
+ vLayout->addItem( mListView );
+
+ mListView->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
+
+ this->setTimeout( NoTimeout );
+ mContentWidget->setLayout( vLayout );
+
+ connect( mListView, SIGNAL( activated ( const QModelIndex& ) ), this, SLOT( activated( const QModelIndex& ) ) );
+ this->setDismissPolicy( NoDismiss );
+
+
+ mDriveModel = new FmDriveModel( this,
+ FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume, this );
+ mListView->setModel( mDriveModel );
+
+ // connect refreshModel signal of viewmanager for drive insert/remove event.
+ connect( FmViewManager::viewManager(), SIGNAL( refreshModel( QString ) ),
+ this, SLOT( refreshModel( QString ) ) );
+}
+
+FmDriveQuery::~FmDriveQuery(void)
+{
+ delete mDriveModel;
+ mDriveModel = 0;
+}
+
+void FmDriveQuery::getDriveList( QStringList &driveList )
+{
+ // provide drive list which is got from backup engine wrapper.
+ FmViewManager::viewManager()->operationService()->backupRestoreHandler()->getBackupDriveList( driveList );
+}
+
+void FmDriveQuery::activated( const QModelIndex &index )
+{
+ QString driveName( mDriveModel->driveName( index ) );
+
+ // if drive is not available, ignore activate signal.
+ FmDriverInfo driveInfo = FmUtils::queryDriverInfo( driveName );
+ if( !( driveInfo.driveState() & FmDriverInfo::EDriveAvailable ) ) {
+ return;
+ }
+
+ mSelectedDrive = driveName;
+ close();
+}
+
+QString FmDriveQuery::selectedDrive() const
+{
+ return mSelectedDrive;
+}
+
+void FmDriveQuery::refreshModel( QString path )
+{
+ if( !path.isEmpty() ) {
+ // ignore non-empty refresh signal as it means change of folder/file, not drive.
+ return;
+ }
+ mDriveModel->refresh();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmmessagebox.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,57 @@
+/*
+ * 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 filemanager messagebox
+ */
+
+#include "fmmessagebox.h"
+#include <hbmessagebox.h>
+
+/*!
+ This is a convenience function for showing an information dialog with \a informationText
+*/
+void FmMessageBox::information( const QString &informationText,
+ HbMessageBox::StandardButtons buttons )
+{
+ HbMessageBox::information ( informationText,
+ this, SLOT(dialogClosed(HbAction*)), buttons );
+ mEventLoop.exec();
+}
+
+/*!
+ This is a convenience function for showing a question dialog with \a questionText
+*/
+bool FmMessageBox::question( const QString &questionText,
+ HbMessageBox::StandardButtons buttons )
+{
+ HbMessageBox::question ( questionText,
+ this, SLOT(dialogClosed(HbAction*)), buttons );
+ mEventLoop.exec();
+ return mRet;
+}
+
+void FmMessageBox::dialogClosed(HbAction *action)
+{
+ HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
+ if(action == dlg->actions().at(0))
+ {
+ mRet = true;
+ }
+ else
+ {
+ mRet = false;
+ }
+ mEventLoop.exit();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmmessagebox.h Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,49 @@
+/*
+ * 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 filemanager messagebox
+ */
+
+#ifndef FMMESSAGEBOX_H
+#define FMMESSAGEBOX_H
+
+#include <QEventLoop>
+#include <hbmessagebox.h>
+#include <hbaction.h>
+
+class FmMessageBox : public QObject
+{
+Q_OBJECT
+public:
+ FmMessageBox()
+ {
+ }
+ ~FmMessageBox()
+ {
+ }
+ void information( const QString &informationText,
+ HbMessageBox::StandardButtons buttons );
+
+ bool question( const QString &questionText,
+ HbMessageBox::StandardButtons buttons );
+
+public slots:
+ void dialogClosed(HbAction *action);
+private:
+ QEventLoop mEventLoop;
+ bool mRet;
+};
+
+#endif
--- a/filemanager/src/filemanager/src/components/fmmultitextquery.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmmultitextquery.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -26,7 +26,7 @@
#include <hbaction.h>
FmMultiTextQuery::FmMultiTextQuery( HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) :
- HbDialog( parent ), mEchoMode( echoMode )
+ FmDialog( parent ), mEchoMode( echoMode )
{
init();
}
@@ -37,29 +37,35 @@
void FmMultiTextQuery::init()
{
+ setObjectName( "MultiTextQuery" );
setDismissPolicy( HbPopup::NoDismiss );
mContentWidget = new HbWidget();
+ mContentWidget->setObjectName( "MultiTextContentWidget" );
setContentWidget( mContentWidget );
QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
vLayout->setOrientation( Qt::Vertical );
mFirstLabel = new HbLabel();
+ mFirstLabel->setObjectName( "MutiTextFirstLabel" );
mFirstLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
vLayout->addItem( mFirstLabel );
mFirstEdit = new HbLineEdit();
mFirstEdit->setEchoMode( mEchoMode );
mFirstEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
+ mFirstEdit->setObjectName("firstLineEdit");
vLayout->addItem( mFirstEdit );
mSecondLabel = new HbLabel();
mSecondLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
+ mSecondLabel->setObjectName( "MutiTextSecondLabel" );
vLayout->addItem( mSecondLabel );
mSecondEdit = new HbLineEdit();
mSecondEdit->setEchoMode( mEchoMode );
mSecondEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
+ mSecondEdit->setObjectName("secondLineEdit");
vLayout->addItem( mSecondEdit );
mContentWidget->setLayout( vLayout );
@@ -70,6 +76,12 @@
}
+void FmMultiTextQuery::setLineEditMaxLength( int length )
+{
+ mFirstEdit->setMaxLength( length );
+ mSecondEdit->setMaxLength( length );
+}
+
void FmMultiTextQuery::setFirstEditText( const QString &text )
{
mFirstEdit->setText( text );
--- a/filemanager/src/filemanager/src/components/fmsingletextquery.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmsingletextquery.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -19,14 +19,14 @@
#include "fmsingletextquery.h"
#include <QGraphicsLinearLayout>
+#include <QRegExp>
#include <hbwidget.h>
#include <hblineedit.h>
#include <hbaction.h>
-FmSingleTextQuery::FmSingleTextQuery( Options options,
- HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) :
- HbDialog( parent ), mOptions( options ), mEchoMode( echoMode )
+FmSingleTextQuery::FmSingleTextQuery( HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) :
+ FmDialog( parent ), mEchoMode( echoMode )
{
init();
}
@@ -37,9 +37,12 @@
void FmSingleTextQuery::init()
{
+ setObjectName( "SingleTextQuery " );
setDismissPolicy( HbPopup::NoDismiss );
mContentWidget = new HbWidget();
- setContentWidget( mContentWidget );
+ mContentWidget->setObjectName( "SingleTextContentWidget" );
+ setContentWidget( mContentWidget );
+
QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
vLayout->setOrientation( Qt::Vertical );
@@ -47,6 +50,7 @@
mTextEdit = new HbLineEdit();
mTextEdit->setEchoMode( mEchoMode );
mTextEdit->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
+ mTextEdit->setObjectName( "textLineEdit" );
vLayout->addItem( mTextEdit );
mContentWidget->setLayout( vLayout );
@@ -74,13 +78,26 @@
mTextEdit->setMaxLength( length );
}
+void FmSingleTextQuery::setRegExpStringList( QStringList regExpStringList )
+{
+ mRegExpStringList = regExpStringList;
+}
+
void FmSingleTextQuery::checkActions()
{
- if( mOptions & DimPrimereActionWhenEmpty ) {
- if( !mTextEdit->text().isEmpty() ){
- this->primaryAction()->setEnabled( true );
- } else {
- this->primaryAction()->setEnabled( false );
+ // check if all regExp match, disable primary action if not match
+ bool validateResult = true;
+ foreach( const QString ®ExpString, mRegExpStringList ) {
+ if( !regExpString.isEmpty() ) {
+ QRegExp regExp( regExpString );
+ if( !regExp.exactMatch( mTextEdit->text() ) ) {
+ validateResult = false;
+ }
}
}
+ if( validateResult ) {
+ this->primaryAction()->setEnabled( true );
+ } else {
+ this->primaryAction()->setEnabled( false );
+ }
}
--- a/filemanager/src/filemanager/src/components/fmsingletextquery.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmsingletextquery.h Tue Aug 24 10:24:14 2010 +0800
@@ -19,32 +19,27 @@
#ifndef FMSINGLETEXTQUERY_H
#define FMSINGLETEXTQUERY_H
-#include <hbdialog.h>
+#include "fmdialog.h"
#include <hblineedit.h>
class HbWidget;
-class FmSingleTextQuery : public HbDialog
+class FmSingleTextQuery : public FmDialog
{
Q_OBJECT
public:
- enum Option
- {
- DimPrimereActionWhenEmpty = 0x00000001
- };
- Q_DECLARE_FLAGS(Options, Option)
- FmSingleTextQuery( Options options = 0,
- HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 );
+ explicit FmSingleTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 );
~FmSingleTextQuery();
public:
void setLineEditText( const QString &text );
QString getLineEditText();
void setLineEditMaxLength( int length );
+ void setRegExpStringList( QStringList regExpStringList );
public slots:
- void checkActions();
+ void checkActions();
private:
void init();
@@ -52,8 +47,10 @@
private:
HbWidget *mContentWidget;
HbLineEdit *mTextEdit;
- Options mOptions;
HbLineEdit::EchoMode mEchoMode;
+
+ // used to check if input text is valid. Disable primary action when text is not valid
+ QStringList mRegExpStringList;
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(FmSingleTextQuery::Options)
+
#endif
--- a/filemanager/src/filemanager/src/components/fmtimequery.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmtimequery.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -21,20 +21,21 @@
#include <QGraphicsItem>
#include <QGraphicsLinearLayout>
-#include <hbdatetimeedit.h>
+#include <hbdatetimepicker.h>
-FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : HbDialog( parent )
+FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : FmDialog( parent )
{
-
+ setObjectName( "timeQueryDialog" );
mContentWidget = new QGraphicsWidget();
setContentWidget(mContentWidget);
-
+ mContentWidget->setObjectName( "timeQueryContentWidget" );
QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
vLayout->setOrientation( Qt::Vertical );
- mTimeWidget = new HbDateTimeEdit();
- vLayout->addItem(mTimeWidget);
+ mTimeWidget = new HbDateTimePicker();
+ mTimeWidget->setObjectName( "timeQueryTimeWidget" );
+ vLayout->addItem( mTimeWidget );
mTimeWidget->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
mTimeWidget->setDisplayFormat( "hh:mm" );
--- a/filemanager/src/filemanager/src/components/fmtimequery.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmtimequery.h Tue Aug 24 10:24:14 2010 +0800
@@ -20,14 +20,13 @@
#define FMTIMEQUERY_H
#include "fmcommon.h"
+#include "fmdialog.h"
#include <QTime>
-#include <hbdialog.h>
-
class QGraphicsWidget;
-class HbDateTimeEdit;
-class FmTimeQuery : public HbDialog
+class HbDateTimePicker;
+class FmTimeQuery : public FmDialog
{
public:
FmTimeQuery(QGraphicsItem *parent=0);
@@ -47,7 +46,7 @@
private:
QGraphicsWidget *mContentWidget;
- HbDateTimeEdit *mTimeWidget;
+ HbDateTimePicker *mTimeWidget;
};
--- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -19,20 +19,20 @@
#include "fmviewdetailsdialog.h"
#include "fmutils.h"
#include "fmviewdetailsitem.h"
-#include "fmdatalistmodel.h"
#include "fmdrivedetailstype.h"
#include "fmviewmanager.h"
-#include <QDirModel>
#include <QFileInfo>
#include <QDateTime>
+#include <QStandardItemModel>
+#include <QStringList>
#include <hblabel.h>
#include <hblistview.h>
#include <hbaction.h>
FmViewDetailsDialog::FmViewDetailsDialog( QGraphicsItem *parent )
- : HbDialog( parent ),
+ : FmDialog( parent ),
mNumofSubFolers( 0 ),
mNumofFiles( 0 ),
mSizeofFolder( 0 ),
@@ -42,7 +42,8 @@
mSizeofJava( 0 ),
mSizeofNativeFiles( 0 ),
mSizeofDocument( 0 ),
- mSizeofCalendar( 0 )
+ mSizeofCalendar( 0 ),
+ mSizeofContacts( 0 )
{
init();
@@ -55,35 +56,33 @@
mListView->setModel( 0 );
delete mListView;
}
-
- if( mDirModel ){
- delete mDirModel;
- }
-
}
void FmViewDetailsDialog::init()
{
+ setObjectName( "viewDetailsDialog" );
mHeaderLabel = new HbLabel( this );
setHeadingWidget( mHeaderLabel );
+ mHeaderLabel->setObjectName( "viewDetailsHeaderLabel" );
mListView = new HbListView( this );
+ mListView->setObjectName( "viewDetailsListView" );
setContentWidget( mListView );
- mDataListModel = new FmDataListModel();
+ // init QStardardItemModel as 0 row and 1 column
+ mDataListModel = new QStandardItemModel( 0, 1 );
mListView->setModel( mDataListModel );
- mListView->setItemPrototype( new FmViewDetailsItem( this ) );
+ mListView->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape);
mOkAction = new HbAction( this );
- mOkAction->setText( tr("ok") );
+ mOkAction->setText( hbTrId("txt_common_button_ok") );
setPrimaryAction( mOkAction );
-
- mDirModel = new QDirModel();
}
void FmViewDetailsDialog::setDriveDetails( const QString &driverName )
{
const QString dataDir = "C:\\data";
+ QStringList dataList;
mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_memory_details" ) );
quint64 sizeOfOthers = 0;
@@ -94,132 +93,85 @@
mDataListModel->removeRows( 0, mDataListModel->rowCount() );
mDataListModel->insertRows( 0, EDriveDetailEntryEnd );
- detailString.append( hbTrId ( "txt_fmgr_dblist_memory_name" ) );
- QVariant variant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryName ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::fillDriveVolume( driverInfo.name(), true ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryName ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_memory_name" );
+ dataList << FmUtils::fillDriveVolume( driverInfo.name(), true ) ;
+ mDataListModel->setData( mDataListModel->index( EMemoryName, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_size_memory" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemorySize ), variant, Qt::DisplayRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_size_memory" );
+ dataList << FmUtils::formatStorageSize( driverInfo.size() ) ;
+ mDataListModel->setData( mDataListModel->index( EMemorySize, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( driverInfo.size() ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemorySize ), variant, Qt::UserRole );
-
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_free_memory" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryFree ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( driverInfo.freeSize() ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryFree ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_free_memory" );
+ dataList << FmUtils::formatStorageSize( driverInfo.freeSize() );
+ mDataListModel->setData( mDataListModel->index( EMemoryFree, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers = driverInfo.size() - driverInfo.freeSize();
// getContentDetails( dataDir );
- detailString.clear();
- detailString.append( hbTrId ( "Images:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryImages ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofImage ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryImages ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "Images:" ) ;
+ dataList << FmUtils::formatStorageSize( mSizeofImage );
+ mDataListModel->setData( mDataListModel->index( EMemoryImages, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers -= mSizeofImage;
- detailString.clear();
- detailString.append( hbTrId ( "Sounds:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemorySounds ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofSounds ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemorySounds ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "Sounds:" );
+ dataList << FmUtils::formatStorageSize( mSizeofSounds );
+ mDataListModel->setData( mDataListModel->index( EMemorySounds, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers -= mSizeofSounds;
- detailString.clear();
- detailString.append( hbTrId ( "Video:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryVideos ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofVideo ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryVideos ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "Video:" );
+ dataList << FmUtils::formatStorageSize( mSizeofVideo );
+ mDataListModel->setData( mDataListModel->index( EMemoryVideos, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers -= mSizeofVideo;
- detailString.clear();
- detailString.append( hbTrId ( "Java Files:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryMidpJava ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofJava ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryMidpJava ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "Java Files:" );
+ dataList << FmUtils::formatStorageSize( mSizeofJava );
+ mDataListModel->setData( mDataListModel->index( EMemoryMidpJava, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers -= mSizeofJava;
- detailString.clear();
- detailString.append( hbTrId ( "Sis files:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryNativeApps ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofNativeFiles ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryNativeApps ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "Sis files:" );
+ dataList << FmUtils::formatStorageSize( mSizeofNativeFiles );
+ mDataListModel->setData( mDataListModel->index( EMemoryNativeApps, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers -= mSizeofNativeFiles;
- detailString.clear();
- detailString.append( hbTrId ( "Documents:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryDocuments ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofDocument ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryDocuments ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "Documents:" );
+ dataList << FmUtils::formatStorageSize( mSizeofDocument );
+ mDataListModel->setData( mDataListModel->index( EMemoryDocuments, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers -= mSizeofDocument;
- detailString.clear();
- detailString.append( hbTrId ( "Calendars:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryCalendar ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofCalendar ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryCalendar ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "Calendars:" );
+ dataList << FmUtils::formatStorageSize( mSizeofCalendar );
+ mDataListModel->setData( mDataListModel->index( EMemoryCalendar, 0 ), dataList, Qt::DisplayRole );
sizeOfOthers -= mSizeofCalendar;
- detailString.clear();
- detailString.append( hbTrId ( "Others:" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EMemoryOthers ), variant, Qt::DisplayRole );
+ dataList.clear();
+ dataList << hbTrId ( "Contacts:" );
+ dataList << FmUtils::formatStorageSize( mSizeofContacts );
+ mDataListModel->setData( mDataListModel->index( EMemoryContacts, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( sizeOfOthers ) );
- variant = QVariant( detailString );;
- mDataListModel->setData( mDataListModel->index( EMemoryOthers ), variant, Qt::UserRole );
+ sizeOfOthers -= mSizeofContacts;
+
+ dataList.clear();
+ dataList << hbTrId ( "Others:" );
+ dataList << FmUtils::formatStorageSize( sizeOfOthers );
+ mDataListModel->setData( mDataListModel->index( EMemoryOthers, 0 ), dataList, Qt::DisplayRole );
}
void FmViewDetailsDialog::setFolderDetails( const QString &folderPath )
@@ -227,75 +179,44 @@
mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_folder_details" ) );
QString detailString( "" );
-
- QModelIndex modelIndex = mDirModel->index( folderPath );
-
+ QStringList dataList;
+ QFileInfo fileInfo( folderPath );
+
mDataListModel->removeRows( 0, mDataListModel->rowCount() );
mDataListModel->insertRows( 0, EFolderDetailEntryEnd );
- detailString.append( hbTrId ( "txt_fmgr_dblist_name_folder" ) );
- QVariant variant( detailString );
- mDataListModel->setData( mDataListModel->index( EFolderName ), variant, Qt::DisplayRole );
+ dataList << hbTrId ( "txt_fmgr_dblist_name_folder" );
+ dataList << fileInfo.fileName();
+ mDataListModel->setData( mDataListModel->index( EFolderName, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( mDirModel->fileName( modelIndex ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFolderName ), variant, Qt::UserRole );
-
- QFileInfo fileInfo = mDirModel->fileInfo( mDirModel->index( folderPath ) );
QDateTime modifiedDateTime = fileInfo.lastModified ();
QDate modifiedDate = modifiedDateTime.date();
QTime modifiedTime = modifiedDateTime.time();
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_date_folder" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EModifiedDate ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( modifiedDate.toString() );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EModifiedDate ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_date_folder" );
+ dataList << modifiedDate.toString();
+ mDataListModel->setData( mDataListModel->index( EModifiedDate, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_time_folder" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EModifiedTime ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( modifiedTime.toString() );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EModifiedTime ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_time_folder" );
+ dataList << modifiedTime.toString();
+ mDataListModel->setData( mDataListModel->index( EModifiedTime, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_size_folder" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFolderSize ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( mSizeofFolder ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFolderSize ), variant, Qt::UserRole );
-
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_subfolders" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( ENumofSubFolders ), variant, Qt::DisplayRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_size_folder" );
+ dataList << FmUtils::formatStorageSize( mSizeofFolder );
+ mDataListModel->setData( mDataListModel->index( EFolderSize, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString = QString::number( mNumofSubFolers );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( ENumofSubFolders ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_subfolders" );
+ dataList << QString::number( mNumofSubFolers );
+ mDataListModel->setData( mDataListModel->index( ENumofSubFolders, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_files" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( ENumofFiles ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString = QString::number( mNumofFiles );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( ENumofFiles ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_files" );
+ dataList << QString::number( mNumofFiles );
+ mDataListModel->setData( mDataListModel->index( ENumofFiles, 0 ), dataList, Qt::DisplayRole );
}
void FmViewDetailsDialog::setFileDetails( const QString &filePath )
@@ -303,70 +224,47 @@
mHeaderLabel->setPlainText( hbTrId( "txt_fmgr_title_file_details") );
QString detailString( "" );
-
- QModelIndex modelIndex = mDirModel->index( filePath );
+ QStringList dataList;
+
+ QFileInfo fileInfo( filePath );
mDataListModel->removeRows( 0, mDataListModel->rowCount() );
mDataListModel->insertRows( 0, EFileDetailEntryEnd );
- detailString.append( hbTrId ( "txt_fmgr_dblist_name_file" ) );
- QVariant variant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileName ), variant, Qt::DisplayRole );
+ dataList << hbTrId ( "txt_fmgr_dblist_name_file" );
+ dataList << fileInfo.fileName();
+ mDataListModel->setData( mDataListModel->index( EFileName, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( mDirModel->fileName( modelIndex ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileName ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_type_file" );
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_type_file" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileType ), variant, Qt::DisplayRole );
- QFileInfo fileInfo = mDirModel->fileInfo( mDirModel->index( filePath ) );
QString fileType = FmUtils::getFileType( filePath );
if( fileType.isEmpty() ){
fileType.append( fileInfo.suffix() );
}
- detailString.clear();
- detailString.append( fileType );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileType ), variant, Qt::UserRole );
+ dataList << fileType;
+ mDataListModel->setData( mDataListModel->index( EFileType, 0 ), dataList, Qt::DisplayRole );
QDateTime modifiedDateTime = fileInfo.lastModified ();
QDate modifiedDate = modifiedDateTime.date();
QTime modifiedTime = modifiedDateTime.time();
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_date_file" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileModifiedDate ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( modifiedDate.toString() );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileModifiedDate ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_date_file" );
+ dataList << modifiedDate.toString();
+ mDataListModel->setData( mDataListModel->index( EFileModifiedDate, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_time_file" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileModifiedTime ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( modifiedTime.toString() );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileModifiedTime ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_time_file" );
+ dataList << modifiedTime.toString();
+ mDataListModel->setData( mDataListModel->index( EFileModifiedTime, 0 ), dataList, Qt::DisplayRole );
- detailString.clear();
- detailString.append( hbTrId ( "txt_fmgr_dblist_size_file" ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileSize ), variant, Qt::DisplayRole );
-
- detailString.clear();
- detailString.append( FmUtils::formatStorageSize( fileInfo.size() ) );
- variant = QVariant( detailString );
- mDataListModel->setData( mDataListModel->index( EFileSize ), variant, Qt::UserRole );
+ dataList.clear();
+ dataList << hbTrId ( "txt_fmgr_dblist_size_file" );
+ dataList << FmUtils::formatStorageSize( fileInfo.size() );
+ mDataListModel->setData( mDataListModel->index( EFileSize, 0 ), dataList, Qt::DisplayRole );
}
void FmViewDetailsDialog::setNumofSubfolders( int numofSubFolders, int numofFiles, quint64 sizeofFolder )
@@ -388,61 +286,65 @@
mSizeofJava = 0;
mSizeofNativeFiles = 0;
mSizeofDocument = 0;
- mSizeofCalendar = 0;
+ mSizeofCalendar = 0;
+ mSizeofContacts = 0;
- for( QList< FmDriveDetailsSize* >::iterator it = detailsSizeList.begin();
+ for( QList< FmDriveDetailsSize* >::const_iterator it = detailsSizeList.begin();
it!= detailsSizeList.end(); ++it ){
- switch( ( *it )->dataGroups() ){
- case FmDriveDetailsDataGroup::EGroupImages:
+ switch( ( *it )->dataType() ){
+ case FmDriveDetailsSize::ETypeImages:
{
- mSizeofImage = ( *it )->size();
+ mSizeofImage = ( *it )->size();
+ break;
}
- break;
- case FmDriveDetailsDataGroup::EGroupSoundFiles:
+ case FmDriveDetailsSize::ETypeSoundFiles:
{
- mSizeofSounds = ( *it )->size();
+ mSizeofSounds = ( *it )->size();
+ break;
}
- break;
- case FmDriveDetailsDataGroup::EGroupMidpJava:
+ case FmDriveDetailsSize::ETypeMidpJava:
{
- mSizeofJava = ( *it )->size();
+ mSizeofJava = ( *it )->size();
+ break;
}
- break;
- case FmDriveDetailsDataGroup::EGroupNativeApps:
+ case FmDriveDetailsSize::ETypeNativeApps:
{
- mSizeofNativeFiles = ( *it )->size();
- }
+ mSizeofNativeFiles = ( *it )->size();
break;
- case FmDriveDetailsDataGroup::EGroupVideos:
+ }
+ case FmDriveDetailsSize::ETypeVideos:
{
- mSizeofVideo = ( *it )->size();
+ mSizeofVideo = ( *it )->size();
+ break;
}
+ case FmDriveDetailsSize::ETypeDocuments:
+ {
+ mSizeofDocument = ( *it )->size();
break;
- case FmDriveDetailsDataGroup::EGroupDocuments:
+ }
+ case FmDriveDetailsSize::ETypeCalendar:
{
- mSizeofDocument = ( *it )->size();
- }
+ mSizeofCalendar = ( *it )->size();
break;
- case FmDriveDetailsDataGroup::EGroupCalendar:
+ }
+ case FmDriveDetailsSize::ETypeContacts:
{
- mSizeofCalendar = ( *it )->size();
+ mSizeofContacts = ( *it )->size();
+ break;
}
- break;
default:
break;
-
}
-
}
}
-HbAction *FmViewDetailsDialog::executeDialog( HbDialog *dialog, const QString &associatedDrives )
+HbAction *FmViewDetailsDialog::executeDialog( FmDialog *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 );
+ FM_LOG( "executeDialog return 0_ " + associatedDrives );
return 0;
}
}
@@ -451,9 +353,9 @@
dlgCloseUnit.addAssociatedDrives( associatedDrives );
FmViewManager::viewManager()->addDlgCloseUnit( &dlgCloseUnit );
- FmLogger::log( " Exec Dialog start " );
+ FM_LOG( " Exec Dialog start " );
HbAction* action = dialog->exec();
- FmLogger::log( " Exec Dialog end " );
+ FM_LOG( " Exec Dialog end " );
FmViewManager::viewManager()->removeDlgCloseUnit( &dlgCloseUnit );
return action;
}
@@ -461,7 +363,7 @@
void FmViewDetailsDialog::showDriveViewDetailsDialog( const QString &driverName,
QList<FmDriveDetailsSize*> detailsSizeList, const QString& associatedDrives )
{
- FmLogger::log( "showDriveViewDetailsDialog_" + associatedDrives );
+ FM_LOG( "showDriveViewDetailsDialog_" + associatedDrives );
FmViewDetailsDialog viewDetailsDialog;
viewDetailsDialog.setSizeofContent( detailsSizeList );
--- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Tue Aug 24 10:24:14 2010 +0800
@@ -20,17 +20,15 @@
#define FMVIEWDETAILSDIALOG_H
#include "fmcommon.h"
-
-#include <hbdialog.h>
+#include "fmdialog.h"
-class FmDataListModel;
-class QDirModel;
+class QStandardItemModel;
class HbListView;
class HbLabel;
class HbAction;
class FmDriveDetailsSize;
-class FmViewDetailsDialog : public HbDialog
+class FmViewDetailsDialog : public FmDialog
{
Q_OBJECT
@@ -46,6 +44,7 @@
EMemoryNativeApps,
EMemoryDocuments,
EMemoryCalendar,
+ EMemoryContacts,
EMemoryOthers,
EDriveDetailEntryEnd
};
@@ -90,26 +89,26 @@
void setNumofSubfolders( int numofSubFolders, int numofFiles, quint64 sizeofFolder );
void setSizeofContent( QList<FmDriveDetailsSize*> detailsSizeList );
- static HbAction *executeDialog( HbDialog *dialog, const QString &associatedDrives );
+ static HbAction *executeDialog( FmDialog *dialog, const QString &associatedDrives );
private:
HbListView *mListView;
HbLabel *mHeaderLabel;
HbAction *mOkAction;
- FmDataListModel *mDataListModel;
- QDirModel *mDirModel;
+ QStandardItemModel *mDataListModel;
QString mDrive;
int mNumofSubFolers;
int mNumofFiles;
- int mSizeofFolder;
- int mSizeofImage;
- int mSizeofSounds;
- int mSizeofVideo;
- int mSizeofJava;
- int mSizeofNativeFiles;
- int mSizeofDocument;
- int mSizeofCalendar;
+ quint64 mSizeofFolder;
+ quint64 mSizeofImage;
+ quint64 mSizeofSounds;
+ quint64 mSizeofVideo;
+ quint64 mSizeofJava;
+ quint64 mSizeofNativeFiles;
+ quint64 mSizeofDocument;
+ quint64 mSizeofCalendar;
+ quint64 mSizeofContacts;
};
#endif /* FMVIEWDETAILSDIALOG_H_ */
--- a/filemanager/src/filemanager/src/components/fmviewdetailsitem.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsitem.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -26,10 +26,10 @@
FmViewDetailsItem::FmViewDetailsItem( QGraphicsItem *parent )
: HbListViewItem( parent ),
mDetailsContentLabel( 0 ),
- mDetailsLabel( 0 )
+ mDetailsLabel( 0 ),
+ mLayout( 0 )
{
- init();
}
FmViewDetailsItem::~FmViewDetailsItem()
@@ -38,7 +38,7 @@
HbAbstractViewItem *FmViewDetailsItem::createItem()
{
- return new FmViewDetailsItem( parentItem() );
+ return new FmViewDetailsItem( *this );
}
bool FmViewDetailsItem::canSetModelIndex( const QModelIndex &index ) const
@@ -54,6 +54,9 @@
void FmViewDetailsItem::updateChildItems()
{
+ if( !mLayout ) {
+ init();
+ }
QString string = modelIndex().data( Qt::DisplayRole ).toString();
mDetailsContentLabel->setPlainText( string );
@@ -66,25 +69,27 @@
void FmViewDetailsItem::init()
{
- QGraphicsLinearLayout *layout = new QGraphicsLinearLayout();
+ mLayout = new QGraphicsLinearLayout();
if( FmViewManager::viewManager()->orientation() == Qt::Vertical ){
- layout->setOrientation( Qt::Vertical );
+ mLayout->setOrientation( Qt::Vertical );
}
else{
- layout->setOrientation( Qt::Horizontal );
+ mLayout->setOrientation( Qt::Horizontal );
}
mDetailsContentLabel = new HbLabel("");
mDetailsContentLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
- layout->addItem( mDetailsContentLabel );
- layout->setAlignment( mDetailsContentLabel, Qt::AlignLeft );
+ mDetailsContentLabel->setObjectName( "detaisContentLabel" );
+ mLayout->addItem( mDetailsContentLabel );
+ mLayout->setAlignment( mDetailsContentLabel, Qt::AlignLeft );
mDetailsLabel = new HbLabel("");
mDetailsLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- layout->addItem( mDetailsLabel );
- layout->setAlignment( mDetailsLabel, Qt::AlignLeft );
+ mDetailsLabel->setObjectName( "detailsLabel" );
+ mLayout->addItem( mDetailsLabel );
+ mLayout->setAlignment( mDetailsLabel, Qt::AlignLeft );
- setLayout( layout );
+ setLayout( mLayout );
}
--- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -16,7 +16,6 @@
* The driver model file for file manager
*/
#include "fmdriverlistwidget.h"
-#include "listviewitems.h"
#include "fmutils.h"
#include "fmdlgutils.h"
#include "fmviewmanager.h"
@@ -24,25 +23,23 @@
#include "fmoperationbase.h"
#include "fmdrivemodel.h"
#include "fmfiledialog.h"
-
-#include <QDirModel>
+#include "fmoperationservice.h"
+#include <hbabstractviewitem.h>
+#include <QDir>
#include <QGraphicsLinearLayout>
#include <QFileSystemWatcher>
#include <hblistview.h>
#include <hbmenu.h>
#include <hbaction.h>
-#include <hbmessagebox.h>
#include <hbsearchpanel.h>
FmDriverListWidget::FmDriverListWidget( QGraphicsItem *parent )
-: HbWidget( parent ),
- mCurrentItem( 0 ),
- mOperationService( 0 )
+: HbWidget( parent ), mListView(0), mModel(0),
+ mCurrentItem(0), mSearchPanel(0),
+ mFileSystemWatcher(0), mLayout(0), mContextMenu(0), mListLongPressed( false )
{
- init();
- mOperationService = FmViewManager::viewManager()->operationService();
-
+ init();
mFileSystemWatcher = new QFileSystemWatcher( this );
connect( mFileSystemWatcher, SIGNAL( directoryChanged ( const QString & ) ),
this, SLOT( on_directoryChanged( const QString & ) ) );
@@ -52,11 +49,20 @@
FmDriverListWidget::~FmDriverListWidget()
{
+ if (mContextMenu) {
+ mContextMenu->deleteLater();
+ }
}
void FmDriverListWidget::on_list_activated( const QModelIndex &index )
{
- emit activated( mModel->driveName( index ) );
+ FM_LOG("FmDriverListWidget::on_list_activated");
+ if( mListLongPressed ) {
+ FM_LOG("FmDriverListWidget::on_list_activated return because long pressed");
+ return;
+ }
+ FM_LOG("FmDriverListWidget::on_list_activated emit activate to open drive");
+ emit activated( mModel->driveName( index ) );
}
void FmDriverListWidget::init()
@@ -64,31 +70,28 @@
mLayout = new QGraphicsLinearLayout( this );
mLayout->setOrientation( Qt::Vertical );
- mListView = new HbListView( this );
- mListView->setSelectionMode( HbAbstractItemView::SingleSelection );
-
+ mListView = new HbListView( this );
+ mListView->setLayoutName( "drive" );
mModel = new FmDriveModel( this,
- FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume );
+ FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume |
+ FmDriveModel::FillWithTotalSize | FmDriveModel::FillWithFreeSize );
mListView->setModel( mModel );
-
- mLayout->addItem( mListView );
-
+ mLayout->addItem( mListView );
mSearchPanel = new HbSearchPanel( this );
mSearchPanel->setObjectName( "searchPanel" );
mSearchPanel->setSearchOptionsEnabled( true );
mSearchPanel->setProgressive( false );
mSearchPanel->hide();
-// mLayout->addItem( mSearchPanel );
-
- mListView->setItemPrototype( new DiskListViewItem( mListView ) );
connect( mListView, SIGNAL( activated( const QModelIndex & ) ),
this, SLOT( on_list_activated( const QModelIndex & ) ) );
+ connect( mListView, SIGNAL( pressed( const QModelIndex & ) ),
+ this, SLOT( on_list_pressed( const QModelIndex & ) ) );
connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ),
this, SLOT( on_list_longPressed( HbAbstractViewItem *, const QPointF & ) ) );
connect( mSearchPanel, SIGNAL( searchOptionsClicked() ),
- this, SLOT( on_searchPanel_searchOptionsClicked() ) );
+ this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection );
connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ),
this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) );
@@ -99,125 +102,145 @@
setLayout( mLayout );
}
-void FmDriverListWidget::refreshModel( const QString &path )
+void FmDriverListWidget::refreshDrive()
{
- Q_UNUSED( path );
mModel->refresh();
}
void FmDriverListWidget::on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords )
{
- HbMenu *contextMenu = new HbMenu();
-
+ FM_LOG("FmDriverListWidget::on_list_longPressed");
+ mListLongPressed = true;
mCurrentItem = item;
QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
-
- FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
+
+ if( !mContextMenu ) {
+ mContextMenu = new HbMenu();
+ } else {
+ mContextMenu->clearActions();
+ }
+ FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
+ FmDriverInfo::DriveType driveType = driverInfo.driveType();
FmDriverInfo::DriveState state = driverInfo.driveState();
-
- if( !( state & FmDriverInfo::EDriveNotPresent ) && !( state & FmDriverInfo::EDriveLocked ) &&
- !( state & FmDriverInfo::EDriveCorrupted ) ) {
- HbAction *viewAction = new HbAction();
- viewAction->setObjectName( "viewAction" );
- viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_memory" ) );
- contextMenu->addAction( viewAction );
-
- //state = 0x210;
-
- connect( viewAction, SIGNAL( triggered() ),
- this, SLOT( on_viewAction_triggered() ) );
- }
-
- if( ( state & FmDriverInfo::EDriveRemovable ) && !( state & FmDriverInfo::EDriveMassStorage ) ){
- if ( driverInfo.volumeName().length() ){
- 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() ) );
- }
- else{
- HbAction *nameAction = new HbAction();
- nameAction->setObjectName( "nameAction" );
- nameAction->setText( hbTrId( "txt_fmgr_menu_name" ) );
- contextMenu->addAction( nameAction );
-
- connect( nameAction, SIGNAL( triggered() ),
- this, SLOT( on_nameAction_triggered() ) );
- }
-
- if( state & FmDriverInfo::EDrivePasswordProtected ){
- HbAction *changePwdAction = new HbAction();
- changePwdAction->setObjectName( "changePwdAction" );
- changePwdAction->setText( hbTrId( "txt_fmgr_menu_change_password" ) );
- contextMenu->addAction( changePwdAction );
-
- HbAction *removePwdAction = new HbAction();
- removePwdAction->setObjectName( "removePwdAction" );
- removePwdAction->setText( hbTrId( "txt_fmgr_menu_remove_password" ) );
- contextMenu->addAction( removePwdAction );
-
- connect( changePwdAction, SIGNAL( triggered() ),
- this, SLOT( on_changePwdAction_triggered() ) );
- connect( removePwdAction, SIGNAL( triggered() ),
- this, SLOT( on_removePwdAction_triggered() ) );
- }
- else{
- HbAction *setPwdAction = new HbAction();
- setPwdAction->setObjectName( "setPwdAction" );
- setPwdAction->setText( hbTrId( "txt_fmgr_menu_set_password" ) );
- contextMenu->addAction( setPwdAction );
-
- connect( setPwdAction, SIGNAL( triggered() ),
- this, SLOT( on_setPwdAction_triggered() ) );
- }
-
+ if( !( state & FmDriverInfo::EDriveNotPresent ) ) {
+ if( state & FmDriverInfo::EDriveAvailable ) {
+ HbAction *viewAction = new HbAction();
+ viewAction->setObjectName( "viewAction" );
+ viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_memory" ) );
+ mContextMenu->addAction( viewAction );
+ connect( viewAction, SIGNAL( triggered() ),
+ this, SLOT( on_viewAction_triggered() ), Qt::QueuedConnection );
+
+ if( driveType == FmDriverInfo::EDriveTypeMemoryCard || driveType == FmDriverInfo::EDriveTypeUsbMemory ) {
+ // MMC or Usb memory
+
+ // Name/Rename action
+ if ( driverInfo.volumeName().length() ){
+ HbAction *renameAction = new HbAction();
+ renameAction->setObjectName( "renameAction" );
+ renameAction->setText( hbTrId( "txt_fmgr_menu_rename" ) );
+ mContextMenu->addAction( renameAction );
+
+ connect( renameAction, SIGNAL( triggered() ),
+ this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection );
+ } else {
+ HbAction *nameAction = new HbAction();
+ nameAction->setObjectName( "nameAction" );
+ nameAction->setText( hbTrId( "txt_fmgr_menu_name" ) );
+ mContextMenu->addAction( nameAction );
+
+ connect( nameAction, SIGNAL( triggered() ),
+ this, SLOT( on_nameAction_triggered() ), Qt::QueuedConnection );
+ }
+
+ // Set/Change/Remove password action
+ if( driveType == FmDriverInfo::EDriveTypeMemoryCard ) { // MMC
+ if( state & FmDriverInfo::EDrivePasswordProtected ){
+ HbAction *changePwdAction = new HbAction();
+ changePwdAction->setObjectName( "changePwdAction" );
+ changePwdAction->setText( hbTrId( "txt_fmgr_menu_change_password" ) );
+ mContextMenu->addAction( changePwdAction );
+
+ HbAction *removePwdAction = new HbAction();
+ removePwdAction->setObjectName( "removePwdAction" );
+ removePwdAction->setText( hbTrId( "txt_fmgr_menu_remove_password" ) );
+ mContextMenu->addAction( removePwdAction );
+
+ connect( changePwdAction, SIGNAL( triggered() ),
+ this, SLOT( on_changePwdAction_triggered() ), Qt::QueuedConnection );
+ connect( removePwdAction, SIGNAL( triggered() ),
+ this, SLOT( on_removePwdAction_triggered() ), Qt::QueuedConnection );
+ }
+ else{
+ HbAction *setPwdAction = new HbAction();
+ setPwdAction->setObjectName( "setPwdAction" );
+ setPwdAction->setText( hbTrId( "txt_fmgr_menu_set_password" ) );
+ mContextMenu->addAction( setPwdAction );
+
+ connect( setPwdAction, SIGNAL( triggered() ),
+ this, SLOT( on_setPwdAction_triggered() ), Qt::QueuedConnection );
+ }
+ }
+ } //if( driveType == FmDriverInfo::EDriveTypeMemoryCard || driveType == FmDriverInfo::EDriveTypeUsbMemory )
+ } //if( state & FmDriverInfo::EDriveAvailable )
+
+ // Eject action
+ // put outside of EDriveAvailable so that removable drive which is corrupted or locked can be removed
if( state & FmDriverInfo::EDriveEjectable ){
HbAction *ejectAction = new HbAction();
ejectAction->setObjectName( "ejectAction" );
ejectAction->setText( hbTrId( "txt_fmgr_menu_eject" ) );
- contextMenu->addAction( ejectAction );
+ mContextMenu->addAction( ejectAction );
connect( ejectAction, SIGNAL( triggered() ),
- this, SLOT( on_ejectAction_triggered() ) );
- }
- }
-#ifndef _DEBUG_ENABLE_FORMATMENU_
-if ( ( state & FmDriverInfo::EDriveRemovable ) || ( state & FmDriverInfo::EDriveCorrupted )
- || ( state & FmDriverInfo::EDriveLocked ) ){
- if( !( state & FmDriverInfo::EDriveNotPresent ) ){
-#endif
- HbAction *formatAction = new HbAction();
- formatAction->setObjectName( "formatAction" );
- formatAction->setText( hbTrId( "txt_fmgr_menu_format" ) );
- contextMenu->addAction( formatAction );
-
- connect( formatAction, SIGNAL( triggered() ),
- this, SLOT( on_formatAction_triggered() ) );
-#ifndef _DEBUG_ENABLE_FORMATMENU_
+ this, SLOT( on_ejectAction_triggered() ), Qt::QueuedConnection );
+ }
+
+ // Format action
+ if ( ( state & FmDriverInfo::EDriveRemovable ) || ( state & FmDriverInfo::EDriveCorrupted )
+ || ( state & FmDriverInfo::EDriveLocked ) ){
+ HbAction *formatAction = new HbAction();
+ formatAction->setObjectName( "formatAction" );
+ formatAction->setText( hbTrId( "txt_fmgr_menu_format" ) );
+ mContextMenu->addAction( formatAction );
+
+ connect( formatAction, SIGNAL( triggered() ),
+ this, SLOT( on_formatAction_triggered() ), Qt::QueuedConnection );
}
- }
-#endif
+ } //if( !( state & FmDriverInfo::EDriveNotPresent ) )
+ // Unlock action
+ // put ouside of !EDriveNotPresent judgment so that
+ // user could unlock drive if connected to PC with mass storage mode
if( state & FmDriverInfo::EDriveLocked ){
HbAction *unLockedAction = new HbAction();
unLockedAction->setObjectName( "unLockedAction" );
unLockedAction->setText( hbTrId( "Unlock" ) );
- contextMenu->addAction( unLockedAction );
+ mContextMenu->addAction( unLockedAction );
connect( unLockedAction, SIGNAL( triggered() ),
- this, SLOT( on_unLockedAction_triggered() ) );
- }
+ this, SLOT( on_unLockedAction_triggered() ), Qt::QueuedConnection );
+ }
+
+ // Pop up menu or open drive
+ if( mContextMenu->actions().count() > 0 ) {
+ mContextMenu->setPreferredPos( coords );
+ mContextMenu->open();
+ } else {
+ emit activated( diskName );
+ }
+}
- contextMenu->exec( coords );
+void FmDriverListWidget::on_list_pressed( const QModelIndex & index )
+{
+ Q_UNUSED( index );
+ mListLongPressed = false;
}
void FmDriverListWidget::on_viewAction_triggered()
{
- QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
- mOperationService->asyncViewDriveDetails( diskName );
+ QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
+ FmViewManager::viewManager()->operationService()->asyncViewDriveDetails( diskName );
}
void FmDriverListWidget::on_renameAction_triggered()
@@ -228,24 +251,32 @@
FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
if ( state & FmDriverInfo::EDriveWriteProtected ){
- HbMessageBox::information( hbTrId( "Unable to perform operation. Memory card is read only." ) );
+ FmDlgUtils::information( hbTrId( "Unable to perform operation. Memory card is read only." ) );
return;
}
- QString title( tr( "Drive name ") );
- QString volumeName = driverInfo.volumeName();
-
+ QString title( hbTrId( "Drive name ") );
+ //save the volume status, empty or set
+ bool needToSetVolume = false;
+ QString volumeName = FmUtils::getVolumeNameWithDefaultNameIfNull( diskName, needToSetVolume );
+ QString oldVolumeName( volumeName );
QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) );
- while( FmDlgUtils::showTextQuery( title, volumeName, false, FmMaxLengthofDriveName, associatedDrives ) ){
+ //use isReturnFalseWhenNoTextChanged = false in order that FmUtils::renameDrive( driveName, volumeName ) will
+ //be excuted at lease once to set the volume name.
+ while( FmDlgUtils::showTextQuery( title, volumeName, QStringList(), FmMaxLengthofDriveName, associatedDrives, false ) ){
+ //if volume is not set or oldVolumeName != volumeName , FmUtils::renameDrive will be called
+ if ( oldVolumeName == volumeName && !needToSetVolume ) {
+ break;
+ }
int err = FmUtils::renameDrive( diskName, volumeName );
- if ( err == FmErrNone ){
- HbMessageBox::information( hbTrId( "The name has been changed!" ) );
+ if ( err == FmErrNone ) {
+ FmDlgUtils::information( hbTrId( "The name has been changed!" ) );
mModel->refresh();
break;
} else if( err == FmErrBadName ) {
- HbMessageBox::information( hbTrId( "Illegal characters! Use only letters and numbers." ) );
+ FmDlgUtils::information( hbTrId( "Illegal characters! Use only letters and numbers." ) );
} else{
- HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) );
+ FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
break;
}
}
@@ -269,20 +300,20 @@
QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) );
- if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd, associatedDrives ) ) {
+ if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd, FmMaxLengthofDrivePassword, associatedDrives ) ) {
if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){
- HbMessageBox::information( hbTrId( "The password has been set!" ) );
+ FmDlgUtils::information( hbTrId( "The password has been set!" ) );
}
else{
- HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) );
+ FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
}
}
}
void FmDriverListWidget::on_changePwdAction_triggered()
{
- QString title( hbTrId( "Password: ") );
- QString firstLabel( hbTrId( "New Password: ") );
+ QString title( hbTrId( "txt_common_dialog_password") );
+ QString firstLabel( hbTrId( "txt_common_dialog_new_password") );
QString secondLabel( hbTrId( "Confirm new Password: ") );
QString oldPwd;
@@ -291,13 +322,13 @@
QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) );
- while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, associatedDrives ) ) {
+ while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, FmMaxLengthofDrivePassword, associatedDrives ) ) {
if ( FmUtils::checkDrivePwd( diskName, oldPwd ) == 0 ){
- if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd ) ){
+ if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd, FmMaxLengthofDrivePassword, associatedDrives ) ){
if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){
- HbMessageBox::information( hbTrId( "The password has been changed!" ) );
+ FmDlgUtils::information( hbTrId( "The password has been changed!" ) );
} else {
- HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) );
+ FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
}
break;
} else {
@@ -305,7 +336,7 @@
break;
}
} else {
- HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) );
+ FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) );
}
}
@@ -318,21 +349,20 @@
QString oldPwd;
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::question( hbTrId( "Do you want to remove the password? Memory card becomes unlocked." ) ) ){
QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) );
- while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, associatedDrives ) ) {
+ while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, FmMaxLengthofDrivePassword, associatedDrives ) ) {
if ( FmUtils::checkDrivePwd( diskName, oldPwd ) == 0 ) {
if ( FmUtils::removeDrivePwd( diskName, oldPwd ) == 0 ){
- HbMessageBox::information( hbTrId( "The password has been removed!" ) );
+ FmDlgUtils::information( hbTrId( "The password has been removed!" ) );
}
else{
- HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) );
+ FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
}
break;
}
else {
- HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) );
+ FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) );
}
}
@@ -348,21 +378,21 @@
QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
//Do not add associatedDrives as Locked MMC is not available Drive but only present Drive
- while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd ) ) {
+ while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, FmMaxLengthofDrivePassword ) ) {
int err = FmUtils::unlockDrive( diskName, oldPwd );
if( err == FmErrNone ) {
- HbMessageBox::information( hbTrId( "The memory is unlocked!" ) );
+ FmDlgUtils::information( hbTrId( "The memory is unlocked!" ) );
break;
} else if ( err == FmErrAccessDenied ) {
- HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) );
+ FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) );
} else if (err == FmErrAlreadyExists ) {
- HbMessageBox::information( hbTrId( "The disk has already been unlocked!" ) );
+ FmDlgUtils::information( hbTrId( "The disk has already been unlocked!" ) );
break;
} else if( err == FmErrNotSupported ) {
- HbMessageBox::information( hbTrId( "The media does not support password locking!" ) );
+ FmDlgUtils::information( hbTrId( "The media does not support password locking!" ) );
break;
} else {
- HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) );
+ FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
break;
}
}
@@ -372,9 +402,9 @@
{
QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
- if( HbMessageBox::question( hbTrId( "Format? Data will be deleted during formatting." ) ) ){
- if( FmErrNone != mOperationService->asyncFormat( diskName ) )
- HbMessageBox::information( hbTrId( "Formatting failed." ) );
+ if( FmDlgUtils::question( hbTrId( "Format? Data will be deleted during formatting." ) ) ){
+ if( FmErrNone != FmViewManager::viewManager()->operationService()->asyncFormat( diskName ) )
+ FmDlgUtils::information( hbTrId( "Formatting failed." ) );
}
}
@@ -382,7 +412,7 @@
{
QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
- if( HbMessageBox::question( hbTrId( "Eject memory card? Some applications will be closed." ) ) ){
+ if( FmDlgUtils::question( hbTrId( "Eject memory card? Some applications will be closed." ) ) ){
FmUtils::ejectDrive( diskName );
}
}
@@ -395,15 +425,24 @@
void FmDriverListWidget::activeSearchPanel()
{
- mFindTargetPath.clear();
+ QStringList driveList;
+ FmUtils::getDriveList( driveList, true );
+ if(driveList.count() > 0 ) {
+ mFindTargetPath = driveList.first();
+ if( FmUtils::isDriveC( mFindTargetPath ) ) {
+ mFindTargetPath = QString( Folder_C_Data );
+ }
+ } else {
+ mFindTargetPath.clear();
+ }
mLayout->addItem( mSearchPanel );
mSearchPanel->show();
}
void FmDriverListWidget::on_searchPanel_searchOptionsClicked()
{
- mFindTargetPath = FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ),
- QString(""), QStringList() );
+ mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ),
+ QString(""), QStringList() ) );
}
void FmDriverListWidget::on_searchPanel_criteriaChanged( const QString &criteria )
--- a/filemanager/src/filemanager/src/fmdriverlistwidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmdriverlistwidget.h Tue Aug 24 10:24:14 2010 +0800
@@ -20,14 +20,14 @@
#define FMDRIVERLISTWIDGET_H
#include "fmcommon.h"
-#include "fmoperationservice.h"
#include <hbwidget.h>
-class QFileSystemWatcher;
+class FmDriveModel;
class HbListView;
class HbAbstractViewItem;
class HbSearchPanel;
-class FmDriveModel;
+class HbMenu;
+class QFileSystemWatcher;
class QGraphicsLinearLayout;
@@ -40,7 +40,7 @@
public:
int updatePwd( const QString& oldPwd, const QString& pwd);
- void refreshModel( const QString &path );
+ void refreshDrive();
void activeSearchPanel();
signals:
@@ -50,6 +50,7 @@
private slots:
void on_list_activated( const QModelIndex &index );
void on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords );
+ void on_list_pressed( const QModelIndex & index ) ;
void on_viewAction_triggered();
void on_renameAction_triggered();
@@ -74,11 +75,14 @@
HbAbstractViewItem* mCurrentItem;
HbSearchPanel* mSearchPanel;
- FmOperationService *mOperationService;
QFileSystemWatcher *mFileSystemWatcher;
QString mFindTargetPath;
QGraphicsLinearLayout *mLayout;
+ HbMenu *mContextMenu;
+
+ //used to avoid activate when long press list.
+ bool mListLongPressed;
};
#endif
--- a/filemanager/src/filemanager/src/fmdriverview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmdriverview.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -23,7 +23,6 @@
#include <QApplication>
-#include <hbmessagebox.h>
#include <hbmenu.h>
#include <hbaction.h>
#include <hbtoolbar.h>
@@ -32,6 +31,7 @@
FmDriverView::FmDriverView() : FmViewBase( EDriverView )
{
+ FM_LOG( "FmDriverView::FmDriverView" );
initMenu();
initToolBar();
initDiskListWidget();
@@ -81,7 +81,7 @@
{
mDriverList = new FmDriverListWidget( this );
connect( mDriverList, SIGNAL( activated( const QString& ) ),
- this, SLOT( activated( const QString& ) ) );
+ this, SLOT( activated( const QString& ) ), Qt::QueuedConnection );
connect( mDriverList, SIGNAL( startSearch( const QString&, const QString& ) ),
this, SLOT( startSearch( const QString&, const QString& ) ) );
@@ -109,13 +109,11 @@
FmViewManager::viewManager()->createFileView( pathName );
}
-void FmDriverView::refreshModel( const QString &path )
+void FmDriverView::refreshDrive()
{
- FmLogger::log( QString( "FmDriverView::refreshModel start" ) );
- QString logstring = QString( "Refresh Path:" );
- logstring.append( path );
- mDriverList->refreshModel( path );
- FmLogger::log( QString( "FmDriverView::refreshModel end" ) );
+ FM_LOG( QString( "FmDriverView::refreshDrive start" ) );
+ mDriverList->refreshDrive();
+ FM_LOG( QString( "FmDriverView::refreshDrive end" ) );
}
void FmDriverView::on_leftAction_triggered()
--- a/filemanager/src/filemanager/src/fmdriverview.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmdriverview.h Tue Aug 24 10:24:14 2010 +0800
@@ -43,7 +43,7 @@
void on_findAction_triggered();
void activated( const QString &pathName );
- void refreshModel( const QString &path );
+ void refreshDrive();
void startSearch( const QString &targetPath, const QString &criteria );
#ifdef FM_CHANGE_ORIENT_ENABLE
--- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -24,9 +24,10 @@
#include "fmviewmanager.h"
#include "fmfiledialog.h"
#include "fmdlgutils.h"
+#include "fmfileiconprovider.h"
#include <QFile>
-#include <QDirModel>
+#include <QFileSystemModel>
#include <QSizePolicy>
#include <QGraphicsLinearLayout>
@@ -36,9 +37,14 @@
#include <hbabstractviewitem.h>
#include <hbaction.h>
#include <hbsearchpanel.h>
-#include <hbmessagebox.h>
#include <hblabel.h>
+// These define comes from implementation of QFileSystemModel
+#define QFileSystemSortName 0
+#define QFileSystemSortSize 1
+#define QFileSystemSortType 2
+#define QFileSystemSortTime 3
+
FmFileBrowseWidget::FmFileBrowseWidget( HbWidget *parent, FmFileBrowseWidget::Style style )
: HbWidget( parent ),
mTreeView( 0 ),
@@ -50,7 +56,8 @@
mFileBrowseStyle( style ),
mCurrentItem( 0 ),
mOperationService( 0 ),
- mSearchPanel( 0 )
+ mSearchPanel( 0 ),
+ mListLongPressed( false )
{
initFileModel();
initListView();
@@ -70,19 +77,11 @@
//since there is a thread running in background
//if the model destroy later, the thread might not quit properly.
- 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 );
mListView->setModel( 0 );
delete mModel;
+
+ delete mFileIconProvider;
}
QFileInfo FmFileBrowseWidget::currentPath() const
@@ -121,20 +120,37 @@
void FmFileBrowseWidget::setRootPath( const QString &pathName )
{
QString logString = "FmFileBrowseWidget::setRootPath(" + pathName + ')';
- FmLogger::log( logString );
+ FM_LOG( logString );
- 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 );
- }
+ int err = checkPathAndSetStyle( pathName );
+ switch( err )
+ {
+ case FmErrNone:
+ {
+ mListView->setRootIndex( mModel->setRootPath( pathName ) );
+ emit currentPathChanged( pathName );
+ break;
+ }
+ case FmErrPathNotExist:
+ {
+ FmDlgUtils::information( hbTrId( "Path is not exist" ) );
+ break;
+ }
+ case FmErrDriveNotAvailable:
+ {
+ // do not take any action as widget set note in label already.
+ break;
+ }
+ case FmErrDriveDenied:
+ case FmErrPathDenied:
+ {
+ FmDlgUtils::information( hbTrId( "Can not access" ) );
+ break;
+ }
+ default:
+ Q_ASSERT_X( false, "setRootPath", "please handle all error from isPathAccessabel" );
+ break;
+ }
mCurrentDrive = pathName.left( 3 );
}
@@ -207,14 +223,6 @@
bool FmFileBrowseWidget::rename( const QString &oldName, const QString &newName )
{
return QFile::rename( oldName, newName );
- /*
- if (QFile::rename( oldName, newName )) {
- QModelIndex index = mModel->index( newName );
- mModel->refresh( index );
- index = mModel->index( oldName );
- mModel->refresh( index );
- }
- */
}
@@ -222,11 +230,11 @@
bool FmFileBrowseWidget::cdUp()
{
- if (mStyle == ListStyle) {
- QModelIndex index = mListView->rootIndex().parent();
- mModel->refresh(index);
- if (index.isValid()) {
- changeRootIndex( index );
+ if (mStyle == ListStyle) {
+ QModelIndex parentIndex = mListView->rootIndex().parent();
+ // QFileSystemModel will auto refresh for file/folder change
+ if (parentIndex.isValid()) {
+ changeRootIndex( parentIndex );
return true;
}
}
@@ -236,17 +244,31 @@
void FmFileBrowseWidget::on_list_activated( const QModelIndex &index )
{
+ mActivatedModelIndex = index;
+ emit listActivated();
+}
+
+void FmFileBrowseWidget::on_listActivated()
+{
+ FM_LOG("FmFileBrowseWidget::on_listActivated start");
+ if( mListLongPressed ) {
+ FM_LOG("FmFileBrowseWidget::on_list_activated end because longPressed");
+ return;
+ }
if (!mSelectable) {
- if (mModel->isDir(index) ) {
- changeRootIndex( index );
+ if (mModel->isDir(mActivatedModelIndex) ) {
+ FM_LOG("FmFileBrowseWidget::on_list_activated changeRootIndex>>");
+ changeRootIndex( mActivatedModelIndex );
+ FM_LOG("FmFileBrowseWidget::on_list_activated changeRootIndex<<");
} else {
- QString filePath( mModel->filePath( index ) );
+ QString filePath( mModel->filePath( mActivatedModelIndex ) );
QFileInfo fileInfo( filePath );
if ( fileInfo.isFile() ) {
mOperationService->syncLaunchFileOpen( filePath );
}
}
}
+ FM_LOG("FmFileBrowseWidget::on_listActivated end");
}
void FmFileBrowseWidget::on_tree_activated( const QModelIndex &index )
@@ -258,6 +280,7 @@
void FmFileBrowseWidget::on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords )
{
+ mListLongPressed = true;
HbMenu *contextMenu = new HbMenu();
mCurrentItem = item;
@@ -267,7 +290,7 @@
contextMenu->addAction( viewAction );
connect( viewAction, SIGNAL( triggered() ),
- this, SLOT( on_viewAction_triggered() ) );
+ this, SLOT( on_viewAction_triggered() ), Qt::QueuedConnection );
//copy
HbAction *copyAction = new HbAction();
@@ -276,11 +299,11 @@
contextMenu->addAction( copyAction );
connect( copyAction, SIGNAL( triggered() ),
- this, SLOT( on_copyAction_triggered() ) );
+ this, SLOT( on_copyAction_triggered() ), Qt::QueuedConnection );
QString filePath( mModel->filePath( item->modelIndex() ) );
- QString formatFilePath( FmUtils::formatPath( filePath ) );
+ QString formatFilePath( FmUtils::fillPathWithSplash( filePath ) );
QFileInfo fileInfo( filePath );
if( ( fileInfo.isFile() ) || ( fileInfo.isDir() && !( FmUtils::isDefaultFolder( formatFilePath ) ) ) ){
@@ -291,7 +314,7 @@
contextMenu->addAction( moveAction );
connect( moveAction, SIGNAL( triggered() ),
- this, SLOT( on_moveAction_triggered() ) );
+ this, SLOT( on_moveAction_triggered() ), Qt::QueuedConnection );
//Delete
HbAction *deleteAction = new HbAction();
@@ -300,7 +323,7 @@
contextMenu->addAction( deleteAction );
connect( deleteAction, SIGNAL( triggered() ),
- this, SLOT( on_deleteAction_triggered() ) );
+ this, SLOT( on_deleteAction_triggered() ), Qt::QueuedConnection );
//rename
HbAction *renameAction = new HbAction();
@@ -309,7 +332,7 @@
contextMenu->addAction( renameAction );
connect( renameAction, SIGNAL( triggered() ),
- this, SLOT( on_renameAction_triggered() ) );
+ this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection );
}
// if( fileInfo.isFile() ){
@@ -322,7 +345,13 @@
// this, SLOT( on_sendAction_triggered() ) );
// }
- contextMenu->exec( coords );
+ contextMenu->setPreferredPos( coords );
+ contextMenu->open();
+}
+
+void FmFileBrowseWidget::on_list_pressed( const QModelIndex & index )
+{
+ mListLongPressed = false;
}
void FmFileBrowseWidget::on_tree_longPressed( HbAbstractViewItem *item, const QPointF &coords )
@@ -357,6 +386,10 @@
connect( mListView, SIGNAL( activated( const QModelIndex& ) ),
this, SLOT( on_list_activated( const QModelIndex& ) ) );
+ connect( this, SIGNAL( listActivated() ),
+ this, SLOT( on_listActivated() ), Qt::QueuedConnection );
+ connect( mListView, SIGNAL( pressed( const QModelIndex & ) ),
+ this, SLOT( on_list_pressed( const QModelIndex & ) ) );
connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ),
this, SLOT( on_list_longPressed( HbAbstractViewItem *, const QPointF & ) ) );
}
@@ -375,9 +408,11 @@
void FmFileBrowseWidget::initFileModel()
{
- mModel = new QDirModel( this );
+ mModel = new QFileSystemModel( this );
mModel->setReadOnly( false );
- disconnect( mModel, SIGNAL( rowsInserted( const QModelIndex &, int, int ) ), 0 ,0 );
+
+ mFileIconProvider = new FmFileIconProvider();
+ mModel->setIconProvider( mFileIconProvider );
}
void FmFileBrowseWidget::initLayout()
@@ -397,7 +432,7 @@
mSearchPanel->hide();
connect( mSearchPanel, SIGNAL( searchOptionsClicked() ),
- this, SLOT( on_searchPanel_searchOptionsClicked() ) );
+ this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection );
connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ),
this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) );
@@ -416,19 +451,8 @@
void FmFileBrowseWidget::changeRootIndex( const QModelIndex &index )
{
- QFileInfo oldFileInfo = mModel->fileInfo( mListView->rootIndex() );
- FmViewManager::viewManager()->removeWatchPath( oldFileInfo.absoluteFilePath() );
-
- mModel->refresh(index);
- if ( mStyle == ListStyle ) {
- mListView->setRootIndex( index );
- } else if ( mStyle == TreeStyle ) {
- mTreeView->setRootIndex( index );
- }
- QFileInfo fileInfo = mModel->fileInfo( mListView->rootIndex() );
- QString string = fileInfo.absoluteFilePath();
- emit currentPathChanged( string );
- FmViewManager::viewManager()->addWatchPath( string );
+ QString filePath = mModel->fileInfo( index ).absoluteFilePath();
+ setRootPath( filePath );
}
bool FmFileBrowseWidget::isDriver(const QModelIndex &index) const
@@ -451,78 +475,89 @@
mModel->setFilter( filters );
}
-void FmFileBrowseWidget::refreshModel( const QString& path )
+void FmFileBrowseWidget::on_driveChanged()
{
+ FM_LOG( "FmFileBrowseWidget::on_driveChanged start" );
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 ) );
+ if(style()==ListStyle) {
+ // display normally, setRootPath again to check if drive is available
+ setRootPath( currPath );
+ } else{
+ // display label style, setRootPath to drive root
+ setRootPath( mCurrentDrive );
}
+ emit setTitle( FmUtils::fillDriveVolume( mCurrentDrive, true ) );
+ FM_LOG( "FmFileBrowseWidget::on_driveChanged end" );
}
-bool FmFileBrowseWidget::checkPathAndSetStyle( const QString& path )
+int 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 " ) );
+ FM_LOG( "FmFileBrowseWidget::checkPathAndSetStyle start_" + path );
+ int err = FmUtils::isPathAccessabel( path );
+ switch( err )
+ {
+ case FmErrNone:
+ {
+ setStyle( mFileBrowseStyle );
+ emit setEmptyMenu( false );
+ break;
+ }
+ case FmErrDriveNotAvailable:
+ {
+ QString driveName = FmUtils::getDriveNameFromPath( path );
+ FmDriverInfo::DriveState state = FmUtils::queryDriverInfo( driveName ).driveState();
+
+ if( state & FmDriverInfo::EDriveLocked ) {
+ mEmptyTipLabel->setPlainText( hbTrId( "Drive is locked" ) );
+ } else if( state & FmDriverInfo::EDriveNotPresent ) {
+ mEmptyTipLabel->setPlainText( hbTrId( "Drive 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 );
+ //hide search panel when the drive is removed
+ if ( mSearchPanel->isVisible() ){
+ mSearchPanel->hide();
+ mLayout->removeItem( mSearchPanel );
+ }
+ emit setEmptyMenu( true );
+ break;
+ }
+ case FmErrPathNotExist:
+ case FmErrDriveDenied:
+ case FmErrPathDenied:
+ {
+ // do not tack any action, error note shoule be shown by invoker.
+ // checkPathAndSetStyle just check path and set style.
+ break;
+ }
+ default:
+ Q_ASSERT_X( false, "checkPathAndSetStyle", "please handle all error from isPathAccessabel" );
+ break;
}
- setStyle( LabelStyle );
- emit setEmptyMenu( true );
- return false;
- } else {
- setStyle( mFileBrowseStyle );
- emit setEmptyMenu( false );
- return true;
- }
-
+ return err;
}
void FmFileBrowseWidget::sortFiles( TSortType sortType )
{
switch( sortType ){
case ESortByName:{
- mModel->setSorting( QDir::Name );
+ mModel->sort( QFileSystemSortName );
}
break;
case ESortByTime:{
- mModel->setSorting( QDir::Time );
+ mModel->sort( QFileSystemSortTime );
}
break;
case ESortBySize:{
- mModel->setSorting( QDir::Size );
+ mModel->sort( QFileSystemSortSize );
}
break;
case ESortByType:{
- mModel->setSorting( QDir::Type | QDir::DirsFirst );
+ mModel->sort( QFileSystemSortType );
}
break;
default:
@@ -539,8 +574,8 @@
void FmFileBrowseWidget::on_searchPanel_searchOptionsClicked()
{
- mFindTargetPath = FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""),
- QStringList() );
+ mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""),
+ QStringList() ) );
}
void FmFileBrowseWidget::on_searchPanel_criteriaChanged( const QString &criteria )
@@ -585,7 +620,7 @@
{
QStringList fileList;
fileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) );
- if ( HbMessageBox::question( hbTrId("Confirm Deletion?" ) )) {
+ if ( FmDlgUtils::question( hbTrId("Confirm Deletion?" ) )) {
int ret = mOperationService->asyncRemove( fileList );
switch( ret ) {
case FmErrNone:
@@ -593,13 +628,13 @@
break;
case FmErrAlreadyStarted:
// last operation have not finished
- HbMessageBox::information( hbTrId( "Operatin already started!" ) );
+ FmDlgUtils::information( hbTrId( "Operatin already started!" ) );
break;
case FmErrWrongParam:
- HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
+ FmDlgUtils::information( hbTrId( "Wrong parameters!" ) );
break;
default:
- HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
+ FmDlgUtils::information( hbTrId( "Operation fail to start!" ) );
}
}
}
@@ -622,13 +657,13 @@
break;
case FmErrAlreadyStarted:
// last operation have not finished
- HbMessageBox::information( hbTrId( "Operatin already started!" ) );
+ FmDlgUtils::information( hbTrId( "Operatin already started!" ) );
break;
case FmErrWrongParam:
- HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
+ FmDlgUtils::information( hbTrId( "Wrong parameters!" ) );
break;
default:
- HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
+ FmDlgUtils::information( hbTrId( "Operation fail to start!" ) );
}
}
@@ -639,7 +674,7 @@
QStringList fileList;
fileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) );
- QString targetPathName = FmFileDialog::getExistingDirectory( 0, tr( "move to" ),
+ QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "move to" ),
QString(""), QStringList() );
if( !targetPathName.isEmpty() ) {
@@ -652,13 +687,13 @@
break;
case FmErrAlreadyStarted:
// last operation have not finished
- HbMessageBox::information( hbTrId( "Operatin already started!" ) );
+ FmDlgUtils::information( hbTrId( "Operatin already started!" ) );
break;
case FmErrWrongParam:
- HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
+ FmDlgUtils::information( hbTrId( "Wrong parameters!" ) );
break;
default:
- HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
+ FmDlgUtils::information( hbTrId( "Operation fail to start!" ) );
}
}
}
@@ -668,21 +703,38 @@
{
QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() );
+ int maxFileNameLength = FmUtils::getMaxFileNameLength();
+ // regExpList used to disable primary action of text query dialog if input text is not match
+ QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot );
+ QString oldSuffix( fileInfo.suffix() );
QString newName( fileInfo.fileName() );
-
- while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true ) ){
+ while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, regExpList,
+ maxFileNameLength, QString() , true ) ){
+ // remove whitespace from the start and the end.
+ newName = newName.trimmed();
QString newTargetPath = FmUtils::fillPathWithSplash(
fileInfo.absolutePath() ) + newName;
QFileInfo newFileInfo( newTargetPath );
- if( newFileInfo.exists() ) {
- HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( newName ) );
+ QString errString;
+ // check if name/path is available for use
+ // add new Name to check, in order to avoid problem of newName is empty
+ if( !FmUtils::checkNewFolderOrFile( newName, newTargetPath, errString ) ) {
+ FmDlgUtils::information( errString );
continue;
}
-
if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) {
- HbMessageBox::information( hbTrId("Rename failed!") );
+ FmDlgUtils::information( hbTrId("Rename failed!") );
+ }
+ else {
+ // Rename succeed
+ if ( ( oldSuffix.compare( newFileInfo.suffix(), Qt::CaseInsensitive ) != 0 )
+ && newFileInfo.isFile() ) {
+ // popup warning when the suffix of file is changed.
+ FmDlgUtils::information( hbTrId( "File may become unusable when file name extension is changed" ) );
+ }
}
break;
- }
+ }
}
+
--- a/filemanager/src/filemanager/src/fmfilebrowsewidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.h Tue Aug 24 10:24:14 2010 +0800
@@ -28,7 +28,7 @@
#include <hbwidget.h>
#include <QDir>
-class QDirModel;
+class QFileSystemModel;
class QGraphicsLinearLayout;
class HbListView;
class HbTreeView;
@@ -36,6 +36,8 @@
class HbSearchPanel;
class HbLabel;
+class FmFileIconProvider;
+
class FmFileBrowseWidget : public HbWidget
{
Q_OBJECT
@@ -69,8 +71,7 @@
bool rename( const QString &oldName, const QString &newName );
void setModelFilter( QDir::Filters filters );
- bool checkPathAndSetStyle( const QString& path );
- void refreshModel( const QString& path );
+ int checkPathAndSetStyle( const QString& path );
void sortFiles( TSortType sortType );
void activeSearchPanel();
@@ -78,21 +79,27 @@
bool cdUp();
void setRootPath( const QString &pathName );
+ // triggered when drive is ejected/inserted
+ void on_driveChanged();
+
void on_searchPanel_searchOptionsClicked();
void on_searchPanel_criteriaChanged( const QString &criteria );
void on_searchPanel_exitClicked();
signals:
- void currentPathChanged( QString& );
+ void currentPathChanged( const QString& );
void startSearch( const QString &targetPath, const QString &criteria );
void setEmptyMenu( bool isMenuEmpty );
void setTitle( const QString &title );
+ void listActivated();
private slots:
void on_list_activated( const QModelIndex &index );
+ void on_listActivated();
void on_tree_activated( const QModelIndex &index );
void on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords );
- void on_tree_longPressed( HbAbstractViewItem *item, const QPointF &coords );
+ void on_list_pressed( const QModelIndex & index ) ;
+ void on_tree_longPressed( HbAbstractViewItem *item, const QPointF &coords );
void on_viewAction_triggered();
void on_copyAction_triggered();
@@ -116,13 +123,13 @@
HbTreeView *mTreeView;
HbListView *mListView;
QGraphicsLinearLayout *mLayout;
- QDirModel *mModel;
+ QFileSystemModel *mModel;
bool mSelectable;
//currentStyle
Style mStyle;
- //used to store orignal tree/list style
+ //used to store original tree/list style
Style mFileBrowseStyle;
HbAbstractViewItem* mCurrentItem;
@@ -133,6 +140,13 @@
HbLabel *mEmptyTipLabel;
QString mCurrentDrive;
+
+ //used to avoid activate when long press list.
+ bool mListLongPressed;
+ QModelIndex mActivatedModelIndex;
+
+ // provide icon from filemanger
+ FmFileIconProvider *mFileIconProvider;
};
#endif
--- a/filemanager/src/filemanager/src/fmfileview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfileview.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -34,13 +34,12 @@
#include <hbaction.h>
#include <hbtoolbar.h>
#include <hblineedit.h>
-#include <hbmessagebox.h>
#include <hbpushbutton.h>
#include <hbmainwindow.h>
FmFileView::FmFileView() : FmViewBase( EFileView ), mWidget( 0 ),
mUpButton( 0 ), mStyleAction( 0 ), mSelectableAction( 0 ),
- mFindAction( 0 ), mOperationService( 0 ), mMenu( 0 )
+ mFindAction( 0 ), mOperationService( 0 ), mMenu( 0 ), mIsFindDisabled( false )
{
mOperationService = FmViewManager::viewManager()->operationService();
initMenu();
@@ -94,8 +93,9 @@
void FmFileView::setFindDisabled( bool disable )
{
+ mIsFindDisabled = disable;
if( mFindAction ) {
- mFindAction->setDisabled( disable );
+ mFindAction->setDisabled( mIsFindDisabled );
}
}
@@ -109,33 +109,44 @@
menu()->addAction( action );
#endif
- mStyleAction = new HbAction( this );
- mStyleAction->setObjectName( "switchStyle" );
+// mStyleAction = new HbAction();
+// mStyleAction->setObjectName( "switchStyle" );
// menu()->addAction( mStyleAction );
- mSelectableAction = new HbAction( this );
+ mSelectableAction = new HbAction();
mSelectableAction->setObjectName( "setSelectable" );
menu()->addAction( mSelectableAction );
+ connect( mSelectableAction, SIGNAL( triggered() ),
+ this, SLOT( on_setSelectable_triggered() ), Qt::QueuedConnection );
- action = new HbAction( this );
+
+ action = new HbAction();
action->setObjectName( "delete" );
action->setText( hbTrId( "txt_fmgr_menu_delete" ) );
menu()->addAction( action );
+ connect( action, SIGNAL( triggered() ),
+ this, SLOT( on_delete_triggered() ), Qt::QueuedConnection );
- action = new HbAction( this );
+ action = new HbAction();
action->setObjectName( "copy" );
action->setText( hbTrId( "txt_fmgr_menu_copy" ) );
menu()->addAction( action );
+ connect( action, SIGNAL( triggered() ),
+ this, SLOT( on_copy_triggered() ), Qt::QueuedConnection );
- action = new HbAction( this );
+ action = new HbAction();
action->setObjectName( "move" );
action->setText( hbTrId( "txt_fmgr_menu_move" ) );
menu()->addAction( action );
+ connect( action, SIGNAL( triggered() ),
+ this, SLOT( on_move_triggered() ), Qt::QueuedConnection );
- action = new HbAction( this );
+ action = new HbAction();
action->setObjectName( "newFolder" );
- action->setText( hbTrId( "New Folder" ) );
+ action->setText( hbTrId( "txt_fmgr_opt_new_folder" ) );
menu()->addAction( action );
+ connect( action, SIGNAL( triggered() ),
+ this, SLOT( on_newFolder_triggered() ), Qt::QueuedConnection );
HbMenu *subMenu = new HbMenu( hbTrId( "Sort" ) );
HbAction *sortNameAction = new HbAction( subMenu );
@@ -161,13 +172,13 @@
menu()->addMenu( subMenu );
connect( sortNameAction, SIGNAL( triggered() ),
- this, SLOT( on_sortNameAction_triggered() ) );
+ this, SLOT( on_sortNameAction_triggered() ), Qt::QueuedConnection );
connect( sortTimeAction, SIGNAL( triggered() ),
- this, SLOT( on_sortTimeAction_triggered() ) );
+ this, SLOT( on_sortTimeAction_triggered() ), Qt::QueuedConnection );
connect( sortSizeAction, SIGNAL( triggered() ),
- this, SLOT( on_sortSizeAction_triggered() ) );
+ this, SLOT( on_sortSizeAction_triggered() ), Qt::QueuedConnection );
connect( sortTypeAction, SIGNAL( triggered() ),
- this, SLOT( on_sortTypeAction_triggered() ) );
+ this, SLOT( on_sortTypeAction_triggered() ), Qt::QueuedConnection );
mMenu = takeMenu();
}
@@ -202,6 +213,7 @@
mFindAction = new HbAction( this );
mFindAction->setObjectName( "leftAction" );
mFindAction->setText( hbTrId("txt_fmgr_opt_find") );
+ mFindAction->setDisabled( mIsFindDisabled );
toolBar()->addAction( mFindAction );
mToolBarRightAction = new HbAction( this );
@@ -215,18 +227,19 @@
connect( mFindAction, SIGNAL( triggered() ),
this, SLOT( on_leftAction_triggered() ) );
connect( mToolBarRightAction, SIGNAL( triggered() ),
- this, SLOT( on_rightAction_triggered() ) );
+ this, SLOT( on_rightAction_triggered() ), Qt::QueuedConnection );
}
void FmFileView::setStyle( FmFileBrowseWidget::Style style )
{
+ /*
if ( style == FmFileBrowseWidget::ListStyle ) {
mStyleAction->setText( hbTrId("Tree") );
} else if ( style == FmFileBrowseWidget::TreeStyle ) {
mStyleAction->setText( hbTrId("List") );
}
-
+ */
mWidget->setStyle( style );
}
@@ -243,7 +256,7 @@
void FmFileView::infoNoFileSelected()
{
- HbMessageBox::information( tr("No File/Folder selected" ) );
+ FmDlgUtils::information( hbTrId("No File/Folder selected" ) );
}
#ifdef FM_CHANGE_ORIENT_ENABLE
@@ -278,7 +291,7 @@
if (files.size() == 0) {
infoNoFileSelected();
} else {
- if (HbMessageBox::question( tr("Confirm Deletion?" ) )) {
+ if (FmDlgUtils::question( hbTrId("Confirm Deletion?" ) )) {
QStringList fileList;
for (int i = 0; i < files.size(); ++i) {
fileList.push_back( files[i].absoluteFilePath() );
@@ -290,13 +303,13 @@
break;
case FmErrAlreadyStarted:
// last operation have not finished
- HbMessageBox::information( hbTrId( "Operatin already started!" ) );
+ FmDlgUtils::information( hbTrId( "Operatin already started!" ) );
break;
case FmErrWrongParam:
- HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
+ FmDlgUtils::information( hbTrId( "Wrong parameters!" ) );
break;
default:
- HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
+ FmDlgUtils::information( hbTrId( "Operation fail to start!" ) );
}
setSelectable( false );
}
@@ -328,13 +341,13 @@
break;
case FmErrAlreadyStarted:
// last operation have not finished
- HbMessageBox::information( hbTrId( "Operatin already started!" ) );
+ FmDlgUtils::information( hbTrId( "Operatin already started!" ) );
break;
case FmErrWrongParam:
- HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
+ FmDlgUtils::information( hbTrId( "Wrong parameters!" ) );
break;
default:
- HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
+ FmDlgUtils::information( hbTrId( "Operation fail to start!" ) );
}
setSelectable( false );
}
@@ -349,7 +362,7 @@
if (files.size() == 0) {
infoNoFileSelected();
} else {
- QString targetPathName = FmFileDialog::getExistingDirectory( 0, tr( "move to" ),
+ QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "move to" ),
QString(""), QStringList() );
if( !targetPathName.isEmpty() && files.size() > 0 ) {
@@ -366,13 +379,13 @@
break;
case FmErrAlreadyStarted:
// last operation have not finished
- HbMessageBox::information( tr( "Operatin already started!" ) );
+ FmDlgUtils::information( hbTrId( "Operatin already started!" ) );
break;
case FmErrWrongParam:
- HbMessageBox::information( tr( "Wrong parameters!" ) );
+ FmDlgUtils::information( hbTrId( "Wrong parameters!" ) );
break;
default:
- HbMessageBox::information( tr( "Operation fail to start!" ) );
+ FmDlgUtils::information( hbTrId( "Operation fail to start!" ) );
}
setSelectable( false );
}
@@ -381,28 +394,35 @@
void FmFileView::on_newFolder_triggered()
{
- QString dirName;
+ int maxFileNameLength = FmUtils::getMaxFileNameLength();
+ QString associatedDrive = FmUtils::getDriveLetterFromPath( mWidget->currentPath().absoluteFilePath() );
QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() );
- QDir dir( path );
+ QString dirName = createDefaultFolderName( path );
+ QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot );
+
+ 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;
+ while( FmDlgUtils::showTextQuery( hbTrId( "txt_fmgr_title_new_folder" ), dirName,
+ regExpList, maxFileNameLength, associatedDrive , false ) ){
+ // remove whitespace from the start and the end.
+ dirName = dirName.trimmed();
+ QString newTargetPath = FmUtils::fillPathWithSplash(
+ dir.absolutePath() ) + dirName;
+ QString errString;
+ // check if name/path is available for use
+ if( !FmUtils::checkNewFolderOrFile( dirName, newTargetPath, errString ) ) {
+ FmDlgUtils::information( errString );
+ continue;
}
+ if( !dir.mkdir( dirName ) ) {
+ FmDlgUtils::information( hbTrId("Operation failed!") );
+ }
+ break;
+ }
}
}
+
void FmFileView::on_upAction_triggered()
{
mWidget->cdUp();
@@ -410,13 +430,6 @@
void FmFileView::on_leftAction_triggered()
{
-// FmFindDialog findDialog;
-// QString keyword;
-// QString findFolder;
-// bool ret = findDialog.exec( keyword, findFolder );
-//
-// if ( ret && !keyword.isEmpty() && !findFolder.isEmpty() )
-// FmViewManager::viewManager()->createFindView( keyword, findFolder );
mWidget->activeSearchPanel();
}
@@ -433,9 +446,9 @@
}
}
-void FmFileView::refreshModel( const QString &path )
+void FmFileView::on_driveChanged()
{
- mWidget->refreshModel( path );
+ mWidget->on_driveChanged();
}
void FmFileView::on_sortNameAction_triggered()
@@ -473,14 +486,14 @@
void FmFileView::on_mainWidget_setEmptyMenu( bool isMenuEmpty )
{
if( isMenuEmpty ){
- FmLogger::log( "setEmptyMenu true" );
+ FM_LOG( "setEmptyMenu true" );
if( !mMenu ) {
mMenu = takeMenu();
}
toolBar()->clearActions();
}
else {
- FmLogger::log( "setEmptyMenu false" );
+ FM_LOG( "setEmptyMenu false" );
if( mMenu ) {
setMenu( mMenu );
mMenu = 0;
@@ -493,3 +506,26 @@
{
this->setTitle( title );
}
+
+QString FmFileView::createDefaultFolderName( const QString &path )
+{
+ // create new folder name, for example, New folder(01), New folder(02)
+ QString checkedPath( FmUtils::fillPathWithSplash( path ) );
+ QString dirName( hbTrId( "txt_fmgr_dialog_entry_new_folder" ) );
+ QString dirAbsolutePath( checkedPath + dirName );
+ QFileInfo fileInfo( dirAbsolutePath );
+ int i = 0;
+ while ( fileInfo.exists() ) {
+ ++i;
+ QString numName;
+ if ( i < 10 ) {
+ numName.append( QString::number(0) );
+ }
+ numName.append( QString::number(i) );
+ // txt_fmgr_dialog_entry_new_folder_l1 is not available now. use actual text instead of it.
+ dirName = hbTrId( "New folder (%L1)" ).arg( numName );
+ dirAbsolutePath = checkedPath + dirName;
+ fileInfo.setFile( dirAbsolutePath );
+ }
+ return dirName;
+}
--- a/filemanager/src/filemanager/src/fmfileview.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfileview.h Tue Aug 24 10:24:14 2010 +0800
@@ -42,7 +42,9 @@
public slots:
void setRootPath( const QString &pathName );
- void refreshModel( const QString &path );
+
+ // triggered when drive is ejected/inserted. connected by FmViewManager
+ void on_driveChanged();
signals:
// connected by viewmanager to close view
@@ -82,6 +84,14 @@
void infoNoFileSelected();
void removeToolBarAction();
+ /**
+ * Create Default folder name while create folder.
+ *
+ * @param path Current path.
+ * @return Default folder name for new folder.
+ */
+ QString createDefaultFolderName( const QString &path );
+
private:
FmFileBrowseWidget *mWidget;
HbPushButton *mUpButton;
@@ -95,6 +105,9 @@
HbAction *mToolBarRightAction;
HbMenu *mMenu;
+
+ // store the disable state of find action. true for disabled
+ bool mIsFindDisabled;
};
#endif
--- a/filemanager/src/filemanager/src/fmfindresultmodel.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -18,16 +18,30 @@
#include "fmfindresultmodel.h"
#include "fmfindthread.h"
+#include "fmfileiconprovider.h"
#include <QDateTime>
-#include <QFileIconProvider>
+
+#include <hbglobal.h>
+
+/*!
+ \fn void finished()
+ This signal is emitted when find is finished.
+*/
+
+/*!
+ \fn void modelCountChanged( int count )
+ This signal is emitted when data count in model is changed
+ \a count is current data count in model.
+ Currently only start find and get more find result will emit this signal.
+*/
FmFindResultModel::FmFindResultModel( QObject *parent )
: QAbstractListModel( parent )
{
init();
connect( mFindThread, SIGNAL(finished()), this, SIGNAL(finished()) );
- connect( mFindThread, SIGNAL(found(int)), this, SLOT(on_findThread_found( int) ), Qt::BlockingQueuedConnection );
+ connect( mFindThread, SIGNAL(found(QStringList)), this, SLOT(on_findThread_found( QStringList) ), Qt::BlockingQueuedConnection );
}
FmFindResultModel::~FmFindResultModel()
@@ -35,17 +49,27 @@
delete mIconProvider;
}
+/*!
+ Returns the number of rows in the model. This value corresponds to the
+ number of items in the model's internal string list.
+
+ The optional \a parent argument is in most models used to specify
+ the parent of the rows to be counted. Because this is a list if a
+ valid parent is specified, the result will always be 0.
+
+ \sa insertRows(), removeRows(), QAbstractItemModel::rowCount()
+*/
int FmFindResultModel::rowCount( const QModelIndex &parent ) const
{
- if (!parent.isValid())
- return mFindResult.size();
+ if ( !parent.isValid() )
+ return mFindResult.count();
return 0;
}
int FmFindResultModel::columnCount( const QModelIndex &parent ) const
{
- if (!parent.isValid())
+ if ( !parent.isValid() )
return 4;
return 0;
@@ -93,10 +117,10 @@
return QVariant();
switch (section) {
- case 0: return tr("Name");
- case 1: return tr("Size");
- case 2: return tr("Type");
- case 3: return tr("Date Modified");
+ case 0: return hbTrId("Name");
+ case 1: return hbTrId("Size");
+ case 2: return hbTrId("Type");
+ case 3: return hbTrId("Date Modified");
default: return QVariant();
}
}
@@ -104,24 +128,46 @@
return QAbstractItemModel::headerData( section, orientation, role );
}
-bool FmFindResultModel::insertRows( int row, int count, const QModelIndex &parent )
+/*!
+ Inserts \a dataList into the model, beginning at the given \a row.
+
+ The \a parent index of the rows is optional and is only used for
+ consistency with QAbstractItemModel. By default, a null index is
+ specified, indicating that the rows are inserted in the top level of
+ the model.
+
+ \sa QAbstractItemModel::insertRows()
+*/
+
+bool FmFindResultModel::insertRows( int row, const QStringList &dataList, const QModelIndex &parent )
{
- Q_UNUSED( parent );
- if (row < 0 || count < 1)
+ if ( row < 0 || dataList.count() < 1 || row > rowCount(parent) )
return false;
- beginInsertRows( QModelIndex(), row, row + count - 1 );
+ beginInsertRows( QModelIndex(), row, row + dataList.count() - 1 );
+ mFindResult.append( dataList );
+ endInsertRows();
- endInsertRows();
+ // emit modelCountChanged could let FmFindWidget switch style between EmptyTipWidget and ResultListview
+ // FmFindWidget will show an empty tip widget such as "No found files or folderss" if set 0 as parameter
+ emit modelCountChanged( rowCount() );
- return true;
+ return true;
}
+/*!
+ Removes \a count rows from the model, beginning at the given \a row.
+
+ The \a parent index of the rows is optional and is only used for
+ consistency with QAbstractItemModel. By default, a null index is
+ specified, indicating that the rows are removed in the top level of
+ the model.
+
+ \sa QAbstractItemModel::removeRows()
+*/
bool FmFindResultModel::removeRows( int row, int count, const QModelIndex &parent )
-{
- Q_UNUSED( parent );
-
- if (row < 0 || count < 1 || row + count > mFindResult.size())
+{
+ if (row < 0 || count < 1 || (row + count) > rowCount(parent) )
return false;
beginRemoveRows( QModelIndex(), row, row + count - 1 );
@@ -130,7 +176,11 @@
mFindResult.removeAt(row);
endRemoveRows();
-
+
+ // emit modelCountChanged could let FmFindWidget switch style between EmptyTipWidget and ResultListview
+ // FmFindWidget will show an empty tip widget such as "No found files or folderss" if set 0 as parameter
+ emit modelCountChanged( rowCount() );
+
return true;
}
@@ -164,14 +214,13 @@
void FmFindResultModel::find()
{
- if (mFindThread->isRunning())
+ if(mFindThread->isRunning())
return;
if( findPath().isEmpty() ){
mFindThread->setLastResult( mFindResult );
}
- removeRows( 0, mFindResult.size() );
- emit modelCountChanged( mFindResult.size() );
+ removeRows( 0, rowCount() );
mFindThread->start();
}
@@ -186,11 +235,16 @@
return mFindThread->isRunning();
}
-void FmFindResultModel::on_findThread_found( int count )
+/*
+ Receive \a dataList as some found result
+ Then insert dataList to model
+*/
+void FmFindResultModel::on_findThread_found( const QStringList &dataList )
{
- int size = mFindResult.size();
- insertRows( mFindResult.size() - count, count );
- emit modelCountChanged( mFindResult.size() );
+ if( dataList.isEmpty() ) {
+ return;
+ }
+ insertRows( rowCount(), dataList );
}
bool FmFindResultModel::indexValid( const QModelIndex &index ) const
@@ -201,39 +255,43 @@
void FmFindResultModel::init()
{
- mFindThread = new FmFindThread( &mFindResult, this );
+ mFindThread = new FmFindThread( this );
mFindThread->setObjectName( "findThread" );
- mIconProvider = new QFileIconProvider();
+ mIconProvider = new FmFileIconProvider();
}
-bool FmFindResultModel::caseNameLessThan(const QString &s1, const QString &s2)
+bool FmFindResultModel::caseNameLessThan(const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2)
{
- QFileInfo info1( s1 );
- QFileInfo info2( s2 );
+ QFileInfo info1( s1.first );
+ QFileInfo info2( s2.first );
return info1.fileName() < info2.fileName();
}
-bool FmFindResultModel::caseTimeLessThan(const QString &s1, const QString &s2)
+bool FmFindResultModel::caseTimeLessThan(const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2)
{
- QFileInfo info1( s1 );
- QFileInfo info2( s2 );
+ QFileInfo info1( s1.first );
+ QFileInfo info2( s2.first );
return info1.lastModified() < info2.lastModified();
}
-bool FmFindResultModel::caseSizeLessThan(const QString &s1, const QString &s2)
+bool FmFindResultModel::caseSizeLessThan(const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2)
{
- QFileInfo info1( s1 );
- QFileInfo info2( s2 );
+ QFileInfo info1( s1.first );
+ QFileInfo info2( s2.first );
return info1.size() < info2.size();
}
-bool FmFindResultModel::caseTypeLessThan(const QString &s1, const QString &s2)
+bool FmFindResultModel::caseTypeLessThan(const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2)
{
- QFileInfo info1( s1 );
- QFileInfo info2( s2 );
+ QFileInfo info1( s1.first );
+ QFileInfo info2( s2.first );
if( info1.isDir() != info2.isDir() ){
return info1.isDir();
@@ -243,28 +301,54 @@
}
}
-
+/*!
+ \reimp
+ Sort by \a column, which is aligned to \a SortFlag
+ \sa SortFlag
+*/
void FmFindResultModel::sort ( int column, Qt::SortOrder order )
{
+ // Sort algorithm comes from
+ // void QListModel::sort(int column, Qt::SortOrder order)
+
Q_UNUSED( order );
-
-// emit layoutAboutToBeChanged();
-
- switch( ( SortFlag )column )
+ emit layoutAboutToBeChanged();
+
+ // store value and row pair.
+ QVector < QPair<QString,int> > sorting(mFindResult.count());
+ for (int i = 0; i < mFindResult.count(); ++i) {
+ QString item = mFindResult.at(i);
+ sorting[i].first = item;
+ sorting[i].second = i;
+ }
+
+ // sort in "sorting"
+ switch( ( SortFlag )column )
{
case Name:
- qSort( mFindResult.begin(), mFindResult.end(), caseNameLessThan );
+ qSort( sorting.begin(), sorting.end(), caseNameLessThan );
break;
case Time:
- qSort( mFindResult.begin(), mFindResult.end(), caseTimeLessThan );
+ qSort( sorting.begin(), sorting.end(), caseTimeLessThan );
break;
case Size:
- qSort( mFindResult.begin(), mFindResult.end(), caseSizeLessThan );
+ qSort( sorting.begin(), sorting.end(), caseSizeLessThan );
break;
case Type:
- qSort( mFindResult.begin(), mFindResult.end(), caseTypeLessThan );
+ qSort( sorting.begin(), sorting.end(), caseTypeLessThan );
break;
}
-// emit layoutChanged();
- emit refresh();
+
+ // create from Indexes and toIndexes, then set sorted data back to mFindResult
+ QModelIndexList fromIndexes;
+ QModelIndexList toIndexes;
+ for (int r = 0; r < sorting.count(); ++r) {
+ QString item = sorting.at(r).first;
+ toIndexes.append(createIndex(r, 0));
+ fromIndexes.append(createIndex(sorting.at(r).second, 0));
+ mFindResult[r] = sorting.at(r).first;
+ }
+ changePersistentIndexList(fromIndexes, toIndexes);
+
+ emit layoutChanged();
}
--- a/filemanager/src/filemanager/src/fmfindresultmodel.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.h Tue Aug 24 10:24:14 2010 +0800
@@ -21,12 +21,13 @@
#include "fmcommon.h"
+#include <QPair>
#include <QFileInfo>
#include <QStringList>
#include <QAbstractListModel>
class FmFindThread;
-class QFileIconProvider;
+class FmFileIconProvider;
class FmFindResultModel : public QAbstractListModel
{
@@ -50,7 +51,7 @@
int columnCount( const QModelIndex &parent = QModelIndex() ) const;
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
- bool insertRows( int row, int count, const QModelIndex &parent = QModelIndex() );
+ bool insertRows( int row, const QStringList &dataList, const QModelIndex &parent = QModelIndex() );
bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() );
QString filePath ( const QModelIndex & index ) const;
@@ -68,21 +69,21 @@
virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
- static bool caseNameLessThan( const QString &s1, const QString &s2 );
- static bool caseTimeLessThan( const QString &s1, const QString &s2 );
- static bool caseSizeLessThan( const QString &s1, const QString &s2 );
- static bool caseTypeLessThan( const QString &s1, const QString &s2 );
+ static bool caseNameLessThan( const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2 );
+ static bool caseTimeLessThan( const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2 );
+ static bool caseSizeLessThan( const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2 );
+ static bool caseTypeLessThan( const QPair<QString,int> &s1,
+ const QPair<QString,int> &s2 );
signals:
void finished();
-
- // 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 );
+ void on_findThread_found( const QStringList &dataList );
private:
bool indexValid( const QModelIndex &index ) const;
@@ -90,7 +91,7 @@
FmFindThread *mFindThread;
QStringList mFindResult;
- QFileIconProvider *mIconProvider;
+ FmFileIconProvider *mIconProvider;
};
#endif
--- a/filemanager/src/filemanager/src/fmfindthread.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindthread.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -20,10 +20,28 @@
#include <QDir>
-FmFindThread::FmFindThread( QStringList *r, QObject *parent )
+// current path, it may come from findDirs.first().entryInfoList()
+#define CurrentDir QString( "." )
+
+// parent path, it may come from findDirs.first().entryInfoList()
+#define ParentDir QString( ".." )
+
+// if got 5 result and have not send notify event, then send notify event
+const int notifyPerCount = 5;
+
+// if got notifyPerElapsedTime milliseconds and have not send notify event, then send notify event.
+const int notifyPerElapsedTime = 500;
+
+/*!
+ \fn void found( const QStringList &dataList )
+ This signal is emitted when some data has been found and \a dataList is provided as data list.
+ Please connect this signal by Qt::BlockingQueuedConnection as dataList will be cleared immediately
+*/
+
+FmFindThread::FmFindThread( QObject *parent )
: QThread( parent )
{
- mResult = r;
+ setPriority( LowPriority );
}
FmFindThread::~FmFindThread()
@@ -58,7 +76,7 @@
void FmFindThread::run()
{
mStop = false;
- setPriority( LowPriority );
+ tempResultList.clear();
if (findPattern.isEmpty() || !findPattern.isValid())
return;
@@ -73,7 +91,6 @@
QList<QDir> findDirs;
findDirs.append( dir );
- count = 0;
time.restart();
mStop = false;
while (!findDirs.isEmpty()) {
@@ -82,39 +99,44 @@
QString name = it->fileName();
QString absolutPath = it->absoluteFilePath();
if (findPattern.exactMatch( it->fileName() )) {
- mResult->append( it->absoluteFilePath() );
- ++count;
- if (count > 5)
+ tempResultList.append( it->absoluteFilePath() );
+ if (tempResultList.count() > notifyPerCount) {
emitFound();
- if (time.elapsed() > 500 && count > 0)
+ } else if (time.elapsed() > notifyPerElapsedTime && tempResultList.count() > 0) {
emitFound();
+ }
}
//We are stopped;
if (mStop) {
- if( count > 0 ) {
+ if( tempResultList.count() > 0 ) {
emitFound();
}
return;
}
-
- if (it->isDir() && it->fileName() != ".." && it->fileName() != "." )
+
+ // exclude directory named ".." and "."
+ if (it->isDir() && it->fileName() != ParentDir && it->fileName() != CurrentDir ) {
findDirs.append( QDir( it->absoluteFilePath() ) );
+ }
}
findDirs.removeFirst();
}
- if( count > 0 ) {
- emitFound();
- }
+ emitFound();
}
+/*
+ Emit signal "found" to send out found data
+*/
void FmFindThread::emitFound()
{
- emit found( count );
- count = 0;
- time.restart();
+ if( tempResultList.count() > 0 ) {
+ emit found( tempResultList );
+ tempResultList.clear();
+ time.restart();
+ }
}
void FmFindThread::setLastResult( QStringList r )
@@ -122,10 +144,13 @@
mLastResult = r;
}
+/*
+ Find keyword in last result
+ \sa setLastResult, this function must be called to set last result for findInResult
+*/
void FmFindThread::findInResult()
{
if( mFindPath.isEmpty() ){
- int count = mLastResult.count();
for (QStringList::Iterator it = mLastResult.begin(); it != mLastResult.end(); ++it) {
if (mStop){
return;
@@ -135,13 +160,14 @@
QString fileName = fileInfo.fileName();
if (findPattern.exactMatch( fileName ) ) {
- mResult->append( absolutPath );
- ++count;
- if (count > 5)
+ tempResultList.append( absolutPath );
+ if ( tempResultList.count() > notifyPerCount ) {
emitFound();
- if (time.elapsed() > 500 && count > 0)
- emitFound();
+ } else if (time.elapsed() > notifyPerElapsedTime && tempResultList.count() > 0) {
+ emitFound();
+ }
}
}
}
+ emitFound();
}
--- a/filemanager/src/filemanager/src/fmfindthread.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindthread.h Tue Aug 24 10:24:14 2010 +0800
@@ -30,7 +30,7 @@
{
Q_OBJECT
public:
- explicit FmFindThread( QStringList *r, QObject *parent = 0 );
+ explicit FmFindThread( QObject *parent = 0 );
~FmFindThread();
QString findPath() const;
@@ -44,7 +44,7 @@
void stop();
signals:
- void found( int );
+ void found( const QStringList &dataList );
protected:
void run();
@@ -58,8 +58,9 @@
QString mFindPath;
QTime time;
QRegExp findPattern;
- QStringList *mResult;
QStringList mLastResult;
+ // Used to store temp search result. if emit found, the result will be cleared.
+ QStringList tempResultList;
};
#endif
--- a/filemanager/src/filemanager/src/fmfindview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindview.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -44,7 +44,7 @@
void FmFindView::activated( const QString& pathName )
{
- FmLogger::log( QString( "activate path from findview:" ) + pathName );
+ FM_LOG( QString( "activate path from findview:" ) + pathName );
FmViewManager::viewManager()->createFileView( pathName, true, true );
}
@@ -52,7 +52,7 @@
{
setTitle( keyword );
mFindWidget->find( keyword, path );
- mWaitNote->exec();
+ mWaitNote->open();
}
void FmFindView::stopFind()
--- a/filemanager/src/filemanager/src/fmmainwindow.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmmainwindow.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -17,17 +17,20 @@
*/
#include "fmmainwindow.h"
+#include "fmcommon.h"
#include <hbaction.h>
-FmMainWindow::FmMainWindow()
+FmMainWindow::FmMainWindow() : mViewManager( 0 ), mFirstViewLoaded( false )
{
+ // connect(this, SIGNAL(viewReady()), this, SLOT(delayedLoading()));
init();
- QMetaObject::connectSlotsByName( this );
}
FmMainWindow::~FmMainWindow()
{
+ //save file manager activity to activity manager.
+ mViewManager->saveActivity();
FmViewManager::RemoveViewManager();
}
@@ -45,13 +48,15 @@
void FmMainWindow::init()
{
+ FM_LOG("FmMainWindow::init start");
mViewManager = FmViewManager::CreateViewManager( this );
-
mViewManager->createDriverView();
-
+ connect(this, SIGNAL(aboutToChangeView(HbView *, HbView *)),
+ mViewManager, SLOT(onAboutToChangeView(HbView *, HbView *)));
connect( this, SIGNAL( orientationChanged( Qt::Orientation ) ),
this, SLOT( onOrientationChanged( Qt::Orientation ) ) );
+ FM_LOG("FmMainWindow::init end");
// if ( orientation() == Qt::Vertical ) {
// createDriverView();
// } else {
@@ -59,3 +64,14 @@
// }
}
+void FmMainWindow::delayedLoading()
+{
+ FM_LOG("FmMainWindow::delayedLoading start");
+ if( mFirstViewLoaded ) {
+ return;
+ }
+ init();
+ mFirstViewLoaded = true;
+ FM_LOG("FmMainWindow::delayedLoading end");
+}
+
--- a/filemanager/src/filemanager/src/fmviewmanager.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -28,17 +28,21 @@
#include "fmoperationservice.h"
#include "fmoperationbase.h"
#include "fmdrivewatcher.h"
+#include "fmdialog.h"
+#include "fmdlgutils.h"
#include <hbview.h>
-#include <hbmessagebox.h>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbactivitymanager.h>
#include <QFileSystemWatcher>
#include <QFileInfo>
-#include <hbdialog.h>
+#include <QPixmap>
FmViewManager *FmViewManager::mViewManager = 0;
-FmDlgCloseUnit::FmDlgCloseUnit( HbDialog *dialog ) : mDialog( dialog )
+FmDlgCloseUnit::FmDlgCloseUnit( FmDialog *dialog ) : mDialog( dialog )
{
}
FmDlgCloseUnit::~FmDlgCloseUnit()
@@ -64,20 +68,14 @@
return mAssociatedDrives;
}
-HbDialog *FmDlgCloseUnit::dialog()
+FmDialog *FmDlgCloseUnit::dialog()
{
return mDialog;
}
-FmViewManager::FmViewManager( FmMainWindow* mainWindow )
+FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 )
{
mMainWindow = mainWindow;
- mOperationService = new FmOperationService( this );
- mOperationService->setObjectName( "operationService" );
-
- mFsWatcher = new QFileSystemWatcher( this );
- mFsWatcher->setObjectName( "fsWatcher" );
-
mDriveWatcher = new FmDriveWatcher( this );
mDriveWatcher->setObjectName( "driveWatcher" );
mDriveWatcher->startWatch();
@@ -87,7 +85,6 @@
FmViewManager::~FmViewManager(void)
{
-
FmViewBase *view = static_cast<FmViewBase *>( mMainWindow->currentView() );
while( view ) {
mMainWindow->removeView( view );
@@ -97,8 +94,6 @@
delete mOperationService;
mOperationService = 0;
- delete mFsWatcher;
- mFsWatcher = 0;
mDriveWatcher->cancelWatch();
delete mDriveWatcher;
@@ -127,6 +122,10 @@
FmOperationService *FmViewManager::operationService()
{
+ if ( !mOperationService ) {
+ mOperationService = new FmOperationService( this );
+ mOperationService->setObjectName( "operationService" );
+ }
return mOperationService;
}
@@ -134,7 +133,10 @@
{
FmViewBase *view = static_cast<FmViewBase *>( mMainWindow->currentView() );
view->setNavigationAction( 0 );
-
+ // grap the screen when only the drive view is in view stack.
+ if( viewCount() == 1 ) {
+ mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+ }
mMainWindow->removeView( view );
delete view;
@@ -144,16 +146,32 @@
}
}
-void FmViewManager::on_operationService_refreshModel( FmOperationBase *operationBase, const QString &path )
+void FmViewManager::on_operationService_driveSpaceChanged( FmOperationBase *operationBase )
{
Q_UNUSED( operationBase );
- emit refreshModel( path );
+ // request drive view to refresh
+ emit driveSpaceChanged();
+}
+
+void FmViewManager::on_operationService_notifyFinish( FmOperationBase *operationBase )
+{
+ if( !operationBase ){
+ Q_ASSERT_X( false, "FmViewManager",
+ "NULL is not accepted in on_operationService_notifyFinish()" );
+ return;
+ }
+
+ if( operationBase->operationType() == FmOperationService::EOperationTypeBackup )
+ {
+ // after finish backup, we need refresh backup date in backup view.
+ emit refreshBackupDate();
+ }
}
int FmViewManager::viewCount()
{
- return mMainWindow->viewCount();
+ return mMainWindow->views().count();
}
@@ -163,9 +181,23 @@
mMainWindow->addView( driverView );
mMainWindow->setCurrentView( driverView );
+ HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();
+ bool ok = activityManager->removeActivity("FMMemoryStoragesList");
- connect( this, SIGNAL( refreshModel( QString ) ),
- driverView, SLOT( refreshModel( QString ) ) );
+ connect( this, SIGNAL( driveSpaceChanged() ),
+ driverView, SLOT( refreshDrive() ) );
+ // Refresh drive view when gaining foreground
+ // ( switch back to filemanager from home screen or any other applications )
+ connect( mMainWindow, SIGNAL( revealed() ),
+ driverView, SLOT( refreshDrive() ) );
+
+ // use Qt::QueuedConnection because synchronous refresh is not work well while
+ // connected with another OTG device which have more than one external drive in it.
+ // File server only give driveChanged event once, but two drive is inserted.
+ // Synchronous refresh will miss another drive.
+ // So use Qt::QueuedConnection to performance asynchronous refresh.
+ connect( this, SIGNAL( driveChanged() ),
+ driverView, SLOT( refreshDrive() ), Qt::QueuedConnection );
}
void FmViewManager::createFileView( const QString &path,
@@ -175,15 +207,14 @@
QString absolutePath = fileInfo.absoluteFilePath();
QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath );
- FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( path ).driveState();
- if( driveState & FmDriverInfo::EDriveAvailable ) {
- if( !FmUtils::isPathAccessabel( checkedPath ) ) {
+ if( FmUtils::isDriveAvailable( path ) ) {
+ if( FmErrNone != FmUtils::isPathAccessabel( checkedPath ) ) {
checkedPath.clear();
}
}
if( checkedPath.isEmpty() ) {
- HbMessageBox::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) );
+ FmDlgUtils::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) );
return;
}
@@ -198,8 +229,8 @@
mMainWindow->addView( fileView );
mMainWindow->setCurrentView( fileView );
- connect( this, SIGNAL( refreshModel( const QString& ) ), //emit when need refresh models
- fileView, SLOT( refreshModel( const QString& ) ) );
+ connect( this, SIGNAL( driveChanged() ), //emit when drive changed.
+ fileView, SLOT( on_driveChanged() ) );
connect( fileView, SIGNAL( popViewAndShow() ), //emit when fileView need delete itself and pop&show view from stack.
this, SLOT( popViewAndShow() ), Qt::QueuedConnection );
@@ -229,7 +260,10 @@
mMainWindow->addView( backupView );
mMainWindow->setCurrentView( backupView );
-
+ connect( this, SIGNAL( driveChanged() ), //emit when need refresh model
+ backupView, SLOT( refreshModel() ) );
+ connect( this, SIGNAL( refreshBackupDate() ), //emit when need refresh backup date
+ backupView, SLOT( refreshBackupDate() ) );
}
void FmViewManager::createRestoreView()
@@ -238,6 +272,7 @@
mMainWindow->addView( restoreView );
mMainWindow->setCurrentView( restoreView );
+ connect( this, SIGNAL( driveChanged() ), restoreView, SLOT( refreshRestoreView() ) );
}
@@ -247,6 +282,7 @@
mMainWindow->addView( deleteBackupView );
mMainWindow->setCurrentView( deleteBackupView );
+ connect( this, SIGNAL( driveChanged() ), deleteBackupView, SLOT( refreshDeleteBackupView() ) );
}
@@ -254,33 +290,12 @@
return mMainWindow->orientation();
}
-void FmViewManager::on_fsWatcher_fileChanged(const QString &path)
-{
- emit refreshModel( path );
-}
-void FmViewManager::on_fsWatcher_directoryChanged(const QString &path)
-{
- emit refreshModel( path );
-}
-void FmViewManager::addWatchPath( const QString &path )
-{
- mFsWatcher->addPath( path );
-}
-void FmViewManager::removeWatchPath( const QString &path )
-{
- if( !mViewManager || !mFsWatcher ) {
- return;
- }
- mFsWatcher->removePath( path );
-}
-
-
void FmViewManager::on_driveWatcher_driveAddedOrChanged()
{
- FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) );
- emit refreshModel( QString("") );
+ FM_LOG( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) );
+ emit driveChanged();
checkDlgCloseUnit();
- FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) );
+ FM_LOG( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) );
}
@@ -292,10 +307,39 @@
for( int i = 0; i < drives.length(); i++ ) {
QString drive( drives[i] + QString( ":/" ) );
if( !FmUtils::isDriveAvailable( drive ) ) {
- FmLogger::log( " close Dialog start " );
+ FM_LOG( " close Dialog start " );
unit->dialog()->close();
- FmLogger::log( " close Dialog end " );
+ FM_LOG( " close Dialog end " );
}
}
}
}
+
+void FmViewManager::saveActivity()
+{
+ //grap the screen when current view is drive view.
+ FmDriverView *driveView = qobject_cast<FmDriverView *>(mMainWindow->currentView());
+ if ( ( driveView != 0 ) && ( driveView->viewType() == FmViewBase::EDriverView ) ) {
+ mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+ }
+ QVariantHash metadata;
+ metadata.insert("screenshot", mScreenShot);
+ HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();
+ // add the activity to the activity manager
+ bool ok = activityManager->addActivity("FMMemoryStoragesList", QVariant(), metadata);
+ if ( !ok )
+ {
+ qFatal("Add failed" );
+ }
+
+}
+
+void FmViewManager::onAboutToChangeView(HbView * oldView, HbView *newView)
+{
+ Q_UNUSED(newView);
+ //grap the screen when oldView is drive view.
+ FmDriverView *driveView = qobject_cast<FmDriverView *>(oldView);
+ if ( ( driveView != 0 ) && ( driveView->viewType() == FmViewBase::EDriverView ) ) {
+ mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+ }
+}
--- a/filemanager/src/filemanager/src/fmviewmanager.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.h Tue Aug 24 10:24:14 2010 +0800
@@ -22,6 +22,7 @@
#include <QObject>
#include <QList>
#include "fmcommon.h"
+#include <QPixmap>
class FmMainWindow;
class HbView;
@@ -30,21 +31,27 @@
class FmOperationBase;
class QFileSystemWatcher;
class FmDriveWatcher;
-class HbDialog;
+class FmDialog;
+/*
+ * this class is used to record relationship between dialog and drive name
+ * FmViewManager will auto-close dialog which related drive is not available again.
+ * for example. set name to MMC will pop a dialog, if add the dialog to FmViewManager::addDlgCloseUnit
+ * then after eject MMC, the dialog will be auto-closed by FmViewManager::checkDlgCloseUnit()
+ */
class FmDlgCloseUnit
{
public:
- FmDlgCloseUnit( HbDialog *dialog );
+ FmDlgCloseUnit( FmDialog *dialog );
~FmDlgCloseUnit();
void addAssociatedDrives( QString drives );
void removeAssociatedDrives( QString drives );
QString associatedDrives();
- HbDialog *dialog();
+ FmDialog *dialog();
private:
- HbDialog *mDialog;
+ FmDialog *mDialog;
QString mAssociatedDrives;
};
@@ -69,19 +76,18 @@
void createBackupView();
void createRestoreView();
void createDeleteBackupView();
-
- void addWatchPath( const QString &path );
- void removeWatchPath( const QString &path );
-
- // dialog close utils:
+ void saveActivity();
+ // add a close unit. this is used to auto-close dialog which related drive is not available again.
void addDlgCloseUnit( FmDlgCloseUnit* unit )
{
- FmLogger::log( "FmViewManager::addDlgCloseUnit_" + unit->associatedDrives() );
+ FM_LOG( "FmViewManager::addDlgCloseUnit_" + unit->associatedDrives() );
mDlgCloseUnitList.append( unit );
}
+
+ // remove a close unit.
void removeDlgCloseUnit( FmDlgCloseUnit* unit )
{
- FmLogger::log( "FmViewManager::removeDlgCloseUnit_" + unit->associatedDrives() );
+ FM_LOG( "FmViewManager::removeDlgCloseUnit_" + unit->associatedDrives() );
mDlgCloseUnitList.removeOne( unit );
}
@@ -92,31 +98,54 @@
public slots:
/// popViewAndShow will delete current view and pop view from stack, then show it.
void popViewAndShow();
- void on_operationService_refreshModel( FmOperationBase* operationBase, const QString &path );
- void on_fsWatcher_fileChanged(const QString &path);
- void on_fsWatcher_directoryChanged(const QString &path);
+
+ // triggered when drive space is changed
+ // this slots is used to watch filemanager internal events
+ // drive space event from other applictaion will not be observed here
+ void on_operationService_driveSpaceChanged( FmOperationBase* operationBase );
+
+ // triggered when drive is ejected/inserted, or other drive event. it will impact available property
void on_driveWatcher_driveAddedOrChanged();
+
+ // if operation finished, some addition works( such as refresh... ) should be done in some views
+ // so this is the central controller function
+ void on_operationService_notifyFinish( FmOperationBase *operationBase );
+
+ void onAboutToChangeView(HbView * oldView, HbView *newView);
+
signals:
- void refreshModel( const QString &path );
+ // emit when drive space is changed by some operation inside filemanager.
+ void driveSpaceChanged();
+
+ // emit when drive is ejected/inserted, this is watched by FmDriveWatcher
+ void driveChanged();
+
+ // when backup is created, backup date should be updated.
+ void refreshBackupDate();
private:
- /// create view will push current view to stack
- // HbView *createView( FmViewType viewType );
-
- // void adjustSecondarySoftKey();
-
+ // when drive is ejected, this function will be called and exam dialogs in mDlgCloseUnitList
+ // it will colse dialogs if related drive is not available
void checkDlgCloseUnit();
-
+
private:
static FmViewManager *mViewManager;
private:
- FmMainWindow *mMainWindow;
+ // main window
+ FmMainWindow *mMainWindow;
+
+ // operation service, used to start operations such as copy, move, delete, format...
FmOperationService *mOperationService;
- QFileSystemWatcher *mFsWatcher;
- FmDriveWatcher *mDriveWatcher;
+
+ // used to watch drive event, for example, eject/insert drive
+ FmDriveWatcher *mDriveWatcher;
+ // used to record some dialogs that related to drive
+ // the dialog should be closed in checkDlgCloseUnit if drive is not available
QList<FmDlgCloseUnit*> mDlgCloseUnitList;
+
+ QPixmap mScreenShot;
};
--- a/filemanager/src/filemanager/src/listviewitems.cpp Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +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:
-* Zhiqiang Yang <zhiqiang.yang@nokia.com>
-* Steven Yao <steven.yao@nokia.com>
-*
-* Description:
-* The source file of the disk list view item
-*
-*/
-#include "listviewitems.h"
-#include "fmutils.h"
-
-#include <QFileIconProvider>
-#include <QGraphicsLinearLayout>
-
-#include <hblabel.h>
-#include <hbcheckbox.h>
-#include <hbpushbutton.h>
-#include <hbabstractitemview.h>
-
-DiskListViewItem::DiskListViewItem( QGraphicsItem *parent )
- : HbListViewItem( parent ),
- mIconLabel( 0 ),
- mDiskNameLabel( 0 ),
- mSizeLabel( 0 ),
- mFreeLabel( 0 ),
- mCheckBox( 0 )
-
-{
- init();
-}
-
-DiskListViewItem::~DiskListViewItem()
-{
-}
-
-void DiskListViewItem::polish(HbStyleParameters& params)
-{
- Q_UNUSED(params);
-}
-
-bool DiskListViewItem::canSetModelIndex( const QModelIndex &index ) const
-{
- Q_UNUSED( index );
- return true;
-}
-
-
-HbAbstractViewItem *DiskListViewItem::createItem()
-{
- return new DiskListViewItem( parentItem() );
-}
-
-void DiskListViewItem::updateChildItems()
-{
- QVariant variant = modelIndex().data( Qt::DecorationRole );
- QIcon icon = qvariant_cast<QIcon>( variant );
- if( icon.isNull() ) {
- QFileIconProvider fileIconProvider;
- icon = fileIconProvider.icon( QFileIconProvider::Drive );
- }
- QString displayString = modelIndex().data( Qt::DisplayRole ).toString();
- QString diskName = modelIndex().data( Qt::UserRole ).toString();
-
- diskName = FmUtils::fillPathWithSplash( diskName );
-
- mIconLabel->setIcon( HbIcon( icon ) );
-
- FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
-
- mDiskNameLabel->setPlainText( displayString );
- mSizeLabel->setPlainText( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) );
- mFreeLabel->setPlainText( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) );
-
-// mCheckBox->setCheckState( checkState() );
-}
-
-void DiskListViewItem::setCheckedState( int state )
-{
- HbAbstractViewItem::setCheckState( static_cast<Qt::CheckState>(state) );
-}
-
-void DiskListViewItem::init()
-{
- QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout();
- hLayout->setOrientation( Qt::Horizontal );
-
- mIconLabel = new HbLabel();
- mIconLabel->setMinimumWidth(32);
- hLayout->addItem( mIconLabel );
- hLayout->setAlignment( mIconLabel, Qt::AlignTop );
- hLayout->setStretchFactor( mIconLabel, 1 );
-
- QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
- vLayout->setOrientation( Qt::Vertical );
-
- mDiskNameLabel = new HbLabel();
- mDiskNameLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
- vLayout->addItem( mDiskNameLabel );
- vLayout->setAlignment( mDiskNameLabel, Qt::AlignLeft );
-
- mSizeLabel = new HbLabel();
- mSizeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- vLayout->addItem( mSizeLabel );
- vLayout->setAlignment( mSizeLabel, Qt::AlignLeft );
-
- mFreeLabel = new HbLabel();
- mFreeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- vLayout->addItem( mFreeLabel );
- vLayout->setAlignment( mFreeLabel, Qt::AlignLeft );
-
- HbWidget *labelsWidget = new HbWidget();
- labelsWidget->setLayout(vLayout);
-
- hLayout->addItem( labelsWidget );
- hLayout->setStretchFactor( labelsWidget, 5 );
-
- setLayout( hLayout );
-}
-
-//file list item, not used.
-/*
-FileListViewItem::FileListViewItem( QGraphicsItem *parent )
- : HbListViewItem( parent ),
- mIconLabel( 0 ),
- mNameLabel( 0 ),
- mCheckBox( 0 )
-{
- init();
-}
-
-FileListViewItem::~FileListViewItem()
-{
-}
-
-void FileListViewItem::polish(HbStyleParameters& params)
-{
- Q_UNUSED(params);
-}
-
-bool FileListViewItem::canSetModelIndex( const QModelIndex &index ) const
-{
- Q_UNUSED( index );
- return true;
-
-// do not used
-// const QFileSystemModel *model = dynamic_cast<const QFileSystemModel *>(index.model());
-// QFileInfo info = model->fileInfo( index );
-// QString path = info.path();
-
-// return (path.right(1) != ":");
-
-}
-
-
-HbAbstractViewItem *FileListViewItem::createItem()
-{
- return new FileListViewItem( parentItem() );
-}
-
-void FileListViewItem::updateChildItems()
-{
- QVariant variant = modelIndex().data( Qt::DecorationRole );
- QIcon icon = qvariant_cast<QIcon>( variant );
- QString diskName = modelIndex().data( Qt::DisplayRole ).toString();
-
- QString debugString = "updateChindItems: diskName = " + diskName;
- FmLogger::log(debugString);
- mIconLabel->setIcon( HbIcon( icon ) );
- mNameLabel->setPlainText( diskName );
- mCheckBox->setCheckState( checkState() );
-}
-
-void FileListViewItem::setCheckedState( int state )
-{
- HbAbstractViewItem::setCheckState( static_cast<Qt::CheckState>(state) );
-}
-
-void FileListViewItem::init()
-{
- QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout();
- hLayout->setOrientation( Qt::Horizontal );
-
- mIconLabel = new HbLabel();
- mIconLabel->setMinimumWidth(32);
- hLayout->addItem( mIconLabel );
- hLayout->setAlignment( mIconLabel, Qt::AlignTop );
- hLayout->setStretchFactor( mIconLabel, 1 );
-
- mNameLabel = new HbLabel();
- mNameLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
- mNameLabel->setAlignment( Qt::AlignVCenter );
- hLayout->addItem( mNameLabel );
- hLayout->setAlignment( mNameLabel, Qt::AlignLeft );
- hLayout->setStretchFactor( mNameLabel, 20 );
-
- mCheckBox = new HbCheckBox( this );
- connect( mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setCheckedState(int)) );
- hLayout->addItem( mCheckBox );
- hLayout->setAlignment( mCheckBox, Qt::AlignLeft );
-
- setLayout( hLayout );
-}
-*/
--- a/filemanager/src/filemanager/src/listviewitems.h Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +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:
-* Zhiqiang Yang <zhiqiang.yang@nokia.com>
-*
-* Description:
-* The header file of the disk list view item
-*
-*/
-
-#ifndef LISTVIEWITEMS_H
-#define LISTVIEWITEMS_H
-
-#include "fmcommon.h"
-
-#include <hblistviewitem.h>
-
-class HbCheckBox;
-class HbLabel;
-
-class DiskListViewItem : public HbListViewItem
-{
- Q_OBJECT
-
-public:
- DiskListViewItem( QGraphicsItem *parent = 0 );
- ~DiskListViewItem();
-
- virtual bool canSetModelIndex( const QModelIndex &index ) const;
- virtual HbAbstractViewItem *createItem();
- virtual void updateChildItems();
-
-private slots:
- void setCheckedState( int state );
-
-private:
- virtual void polish(HbStyleParameters& params);
-
-private:
- void init();
-
- HbLabel *mIconLabel;
- HbLabel *mDiskNameLabel;
- HbLabel *mSizeLabel;
- HbLabel *mFreeLabel;
- HbCheckBox *mCheckBox;
-};
-
-/* not used
-class FileListViewItem : public HbListViewItem
-{
- Q_OBJECT
-
-public:
- FileListViewItem( QGraphicsItem *parent = 0 );
- ~FileListViewItem();
-
- virtual bool canSetModelIndex( const QModelIndex &index ) const;
- virtual HbAbstractViewItem *createItem();
- virtual void updateChildItems();
-
- virtual void polish(HbStyleParameters& params);
-private slots:
- void setCheckedState( int state );
-
-private:
- void init();
-
- HbLabel *mIconLabel;
- HbLabel *mNameLabel;
- HbCheckBox *mCheckBox;
-};
-*/
-
-#endif //LISTVIEWITEMS_H
--- a/filemanager/src/filemanager/src/main.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/main.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -23,24 +23,28 @@
#include "fmmainwindow.h"
#include <hbapplication.h>
-
+#include <hbstyleloader.h>
+#include <hbtranslator.h>
#include <QTranslator>
#include <QLocale>
int main( int argc, char *argv[] )
{
- HbApplication app( argc, argv );
- app.setApplicationName( "filemanager" );
-
- QTranslator translator;
- QString lang = QLocale::system().name();
- QString path = "z:/resource/qt/translations/";
- translator.load( path + "filemanager_" + lang );
- app.installTranslator(&translator);
-
+ FM_LOG( "main start" );
+ HbApplication app( argc, argv );
+
+ HbTranslator translator("filemanager");
+ translator.loadCommon();
+ app.setApplicationName( hbTrId("txt_fmgr_title_file_manager") );
+
+ HbStyleLoader::registerFilePath(":/resources/hblistviewitem.css");
+ HbStyleLoader::registerFilePath(":/resources/hblistviewitem.widgetml");
+
+ FM_LOG( "main_createMainwindow start" );
FmMainWindow mw;
+ FM_LOG( "main_createMainwindow end" );
mw.show();
-
+ FM_LOG( "main end" );
return app.exec();
}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -17,114 +17,150 @@
*/
#include "fmoperationbase.h"
+#include "fmdrivedetailstype.h"
+#include <QtAlgorithms>
+/*
+ * \fn void showNote( const QString ¬e )
+ * This signal is emitted when operation needs operation service to show some note.
+ * \a note indicates the note to show.
+ */
+/* \fn void notifyWaiting( bool cancelable )
+ * This signal is emitted when operation needs operation service to wait.
+ * \a cancelable indicates whether it could be canceled.
+ */
+
+/* \fn void notifyPreparing( bool cancelable )
+ * This signal is emitted when operation needs operation service to prepare.
+ * \a cancelable indicates whether it could be canceled.
+ */
+
+/* \fn void notifyStart( bool cancelable, int maxSteps )
+ * This signal is emitted when operation starts and operation service shows progress bar.
+ * \a cancelable indicates whether it could be canceled.
+ * \a maxStep indicates the max of progress bar.
+ */
+
+/* \fn void notifyProgress( int currentStep )
+ * This signal is emitted when operation needs operation service update progress bar.
+ * \a currentStep the current step.
+ */
+
+/* \fn void notifyFinish()
+ * This signal is emitted when operation finished.
+ */
+
+/* \fn void notifyError( int error, const QString &errString )
+ * This signal is used to notify error.
+ * \a error the error id.
+ * \a errString the error string.
+ */
+
+/*
+ Constructs the base operation with
+ \a parent parent
+ \a operationType the type of current operation.
+*/
FmOperationBase::FmOperationBase( QObject *parent, FmOperationService::TOperationType operationType ) :
QObject( parent ), mOperationType( operationType )
{
}
+/*
+ Destructs the operation
+*/
FmOperationBase::~FmOperationBase()
{
}
+/*
+ Returns the current operation type
+*/
FmOperationService::TOperationType FmOperationBase::operationType()
{
return mOperationType;
}
-
-//FmOperationFormat
-//FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ),
-// mDriverName( mDriverName )
-//{
-//}
-//FmOperationFormat::~FmOperationFormat()
-//{
-//}
-//
-//QString FmOperationFormat::driverName()
-//{
-// return mDriverName;
-//}
-
-//FmOperationDriveDetails
-FmOperationDriveDetails::FmOperationDriveDetails( QObject *parent, QString driverName ) :
- FmOperationBase( parent, FmOperationService::EOperationTypeDriveDetails ),
- mDriverName( driverName )
-{
-}
-FmOperationDriveDetails::~FmOperationDriveDetails()
-{
-}
-
-QString FmOperationDriveDetails::driverName()
-{
- return mDriverName;
-}
-
-QList<FmDriveDetailsSize*> &FmOperationDriveDetails::detailsSizeList()
-{
- return mDetailsSizeList;
-}
-
-//FmOperationFolderDetails
-FmOperationFolderDetails::FmOperationFolderDetails( QObject *parent, const QString folderPath ) :
- FmOperationBase( parent, FmOperationService::EOperationTypeFolderDetails ),
- mFolderPath( folderPath ),
- mNumofSubFolders( 0 ),
- mNumofFiles( 0 ),
- mSizeofFolder( 0 )
-
-{
-}
-FmOperationFolderDetails::~FmOperationFolderDetails()
+/*
+ Starts the operation, called by FmOperationThread.
+ Use empty implementation because Backup and Restore
+ are not done within thread, so they will not reimplement
+ this function.
+ \sa FmOperationThread::run
+*/
+void FmOperationBase::start( volatile bool */*isStopped*/ )
{
}
-QString FmOperationFolderDetails::folderPath()
-{
- return mFolderPath;
-}
-
-int &FmOperationFolderDetails::numofSubFolders()
+/*
+ Does some additional work before starting the operation.
+ Returns the error number.
+*/
+int FmOperationBase::prepare()
{
- return mNumofSubFolders;
-}
-
-int &FmOperationFolderDetails::numofFiles()
-{
- return mNumofFiles;
-}
-
-quint64 &FmOperationFolderDetails::sizeofFolder()
-{
- return mSizeofFolder;
+ return FmErrNone;
}
-
-FmOperationBackup::FmOperationBackup( QObject *parent )
- : FmOperationBase( parent, FmOperationService::EOperationTypeBackup )
+/*
+ Constructs a backup operation with
+ \a parent parent
+ \a targetDrive backup target drive
+ backup \a content is mask for contents want to backup. Refer to mContent in FmBackupSettings
+*/
+FmOperationBackup::FmOperationBackup( QObject *parent, const QString &targetDrive, quint32 content )
+ : FmOperationBase( parent, FmOperationService::EOperationTypeBackup ),
+ mTargetDrive( targetDrive ), mContent( content )
{
}
+
+/*
+ Destructs the backup operation
+*/
FmOperationBackup::~FmOperationBackup()
{
}
+/*
+ Get target backup drive
+*/
+QString FmOperationBackup::targetDrive() const
+{
+ return mTargetDrive;
+}
+/*
+ Get backup content mask. Refer to mContent in FmBackupSettings
+*/
+quint32 FmOperationBackup::content() const
+{
+ return mContent;
+}
+
+/*
+ Constructs a restore operation with
+ \a parent parent
+ \a selection the selected backup items
+*/
FmOperationRestore::FmOperationRestore( QObject *parent, quint64 selection )
: FmOperationBase( parent, FmOperationService::EOperationTypeRestore ), mSelection( selection )
{
}
+/*
+ Destructs the restore operation
+*/
FmOperationRestore::~FmOperationRestore()
{
}
-quint64 FmOperationRestore::selection()
+/*
+ Returns the backup items
+*/
+quint64 FmOperationRestore::selection() const
{
return mSelection;
}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationbase.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.h Tue Aug 24 10:24:14 2010 +0800
@@ -32,67 +32,49 @@
virtual ~FmOperationBase();
FmOperationService::TOperationType operationType();
+ virtual int prepare();
+ virtual void start( volatile bool *isStopped );
+
+signals:
+ void showNote( const QString ¬e );
+ void notifyWaiting( bool cancelable );
+ void notifyPreparing( bool cancelable );
+ void notifyStart( bool cancelable, int maxSteps );
+ void notifyProgress( int currentStep );
+ void notifyFinish();
+ void notifyError( int error, const QString &errString );
+
private:
FmOperationService::TOperationType mOperationType;
};
-//class FmOperationFormat : public FmOperationBase
-//{
-//public:
-// explicit FmOperationFormat( QObject *parent, QString mDriverName );
-// virtual ~FmOperationFormat();
-// QString driverName();
-//private:
-// QString mDriverName;
-//};
-
-class FmOperationDriveDetails : public FmOperationBase
-{
-public:
- explicit FmOperationDriveDetails( QObject *parent, QString driverName );
-
- virtual ~FmOperationDriveDetails();
- QString driverName();
- QList<FmDriveDetailsSize*> &detailsSizeList();
-private:
- QString mDriverName;
- QList<FmDriveDetailsSize*> mDetailsSizeList;
-};
-
-class FmOperationFolderDetails : public FmOperationBase
-{
-public:
- explicit FmOperationFolderDetails( QObject *parent, const QString folderPath );
-
- virtual ~FmOperationFolderDetails();
- QString folderPath();
- int &numofSubFolders();
- int &numofFiles();
- quint64 &sizeofFolder();
-
-private:
- QString mFolderPath;
- int mNumofSubFolders;
- int mNumofFiles;
- quint64 mSizeofFolder;
-};
-
class FmOperationBackup : public FmOperationBase
{
+Q_OBJECT
public:
- explicit FmOperationBackup( QObject *parent );
+ explicit FmOperationBackup( QObject *parent, const QString &targetDrive, quint32 content );
virtual ~FmOperationBackup();
+
+ QString targetDrive() const;
+ quint32 content() const ;
+private:
+ // used to save backup target drive
+ QString mTargetDrive;
+
+ // used to save FmBackupSettings::content()
+ quint32 mContent;
};
class FmOperationRestore : public FmOperationBase
{
+Q_OBJECT
public:
explicit FmOperationRestore( QObject *parent, quint64 selection );
virtual ~FmOperationRestore();
- quint64 selection();
+ quint64 selection() const;
private:
quint64 mSelection;
};
--- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +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:
-*
-*/
-
-#include "fmoperationcopy.h"
-#include "fmcommon.h"
-#include "fmoperationbase.h"
-#include "fmdrivedetailstype.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QStringList>
-#include <QStack>
-
-
-FmOperationCopy::FmOperationCopy( QObject *parent, QStringList sourceList, QString targetPath ) :
- FmOperationBase( parent, FmOperationService::EOperationTypeCopy ),
- mSourceList( sourceList ), mTargetPath( targetPath ),
- mStop( 0 ), mTotalSize( 0 ), mErrString( 0 ), mCopiedSize( 0 ), mTotalSteps( 100 ), mCurrentStep( 0 )
-{
-}
-
-FmOperationCopy::~FmOperationCopy()
-{
-}
-
-QStringList FmOperationCopy::sourceList()
-{
- return mSourceList;
-}
-
-QString FmOperationCopy::targetPath()
-{
- return mTargetPath;
-}
-
-int FmOperationCopy::start( volatile bool *isStopped, QString *errString )
-{
- mStop = isStopped;
- mErrString = errString;
- mTotalSize = 0;
- mCopiedSize = 0;
- mCurrentStep = 0;
-
- if( mSourceList.empty() ) {
- return FmErrWrongParam;
- }
-
- emit notifyPreparing( true );
-
- int numofFolders = 0;
- int numofFiles = 0;
-
- int ret = FmFolderDetails::queryDetailOfContentList( mSourceList, numofFolders,
- numofFiles, mTotalSize, mStop, true );
- if( ret != FmErrNone ) {
- return ret;
- }
-
- emit notifyStart( true, mTotalSteps );
-
- foreach( const QString& source, mSourceList ) {
- QFileInfo fi( source );
- if( !fi.exists() ) {
- *mErrString = source;
- ret = FmErrSrcPathDoNotExist;
- return ret;
- }
- QString newName;
- bool isAcceptReplace = false;
- QFileInfo destFi( mTargetPath + fi.fileName() );
-
- // while for duplicated file/dir
- while( destFi.exists() ) {
- 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 );
- }
- }
- if( ret != FmErrNone ) {
- return ret;
- }
- ret = copy( source, mTargetPath, newName );
- if( ret != FmErrNone ) {
- return ret;
- }
- }
- return FmErrNone;
-}
-
-
-
-int FmOperationCopy::copy( const QString &source, const QString &targetPath,
- const QString &newTargetName )
-{
- if( *mStop ) {
- return FmErrCancel;
- }
-
- QFileInfo fi( source );
- if( !fi.exists() ) {
- *mErrString = source;
- return FmErrSrcPathDoNotExist;
- }
- QString newName;
- if( !newTargetName.isEmpty() ) {
- newName = targetPath + newTargetName;
- } else {
- newName = targetPath + fi.fileName();
- }
-
- int ret = FmErrNone;
-
- if (fi.isFile()) {
- quint64 fileSize = fi.size();
- if ( !QFile::copy( source, newName )) {
- *mErrString = source;
- ret = FmErrCannotCopy;
- } else {
- IncreaseProgress( fileSize );
- }
- } else if (fi.isDir()) {
- ret = copyDirInsideContent( source, newName );
- } else {
- qWarning( "Things other than file and directory are not copied" );
- ret = FmErrIsNotFileOrFolder;
- }
-
- return ret;
-}
-
-
-
-int FmOperationCopy::copyDirInsideContent( const QString &srcPath, const QString &destPath )
-{
- if( destPath.contains( srcPath, Qt::CaseInsensitive ) ) {
- *mErrString = destPath;
- return FmErrCopyDestToSubFolderInSrc;
- }
-
- QFileInfo srcInfo( srcPath );
- if( !srcInfo.isDir() || !srcInfo.exists() ) {
- *mErrString = srcPath;
- return FmErrSrcPathDoNotExist;
- }
-
- QFileInfo destInfo( destPath );
- if( !destInfo.exists() ) {
- if( !destInfo.dir().mkdir( destInfo.absoluteFilePath() ) ) {
- *mErrString = destPath;
- return FmErrCannotMakeDir;
- }
- }
-
- if( !srcInfo.isDir() ) {
- *mErrString = destPath;
- return FmErrCannotMakeDir;
- }
-
- //start to copy
- QFileInfoList infoList = QDir( srcPath ).entryInfoList( QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden | QDir::System );
- while( !infoList.isEmpty() ) {
- if( *mStop ) {
- return FmErrCancel;
- }
-
- QFileInfo fileInfo = infoList.takeFirst();
- if( fileInfo.isFile() ){
- //copy file
- QString newFilePath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
- if (!QFile::copy( fileInfo.absoluteFilePath(), newFilePath ) ) {
- *mErrString = fileInfo.absoluteFilePath();
- return FmErrCannotCopy;
- }
- IncreaseProgress( fileInfo.size() );
- } else if( fileInfo.isDir() ) {
- //makedir
- QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
- if( !QDir( newDirPath ).exists() && !QDir( destPath ).mkdir( newDirPath ) ) {
- *mErrString = newDirPath;
- return FmErrCannotMakeDir;
- }
- // add dir content to list.
- QFileInfoList infoListDir = QDir( fileInfo.absoluteFilePath() ).entryInfoList(
- QDir::NoDotAndDotDot | QDir::AllEntries );
- while( !infoListDir.isEmpty() ) {
- infoList.push_front( infoListDir.takeLast() );
- }
-
- } else {
- *mErrString = fileInfo.absoluteFilePath();
- return FmErrIsNotFileOrFolder;
- }
-
- }
-
- return FmErrNone;
-}
-
-void FmOperationCopy::IncreaseProgress( quint64 size )
-{
- if( mTotalSize <=0 ) {
- return;
- }
- mCopiedSize += size;
- int step = ( mCopiedSize * 100 ) / mTotalSize;
- if( step > mCurrentStep ) {
- mCurrentStep = step;
- emit notifyProgress( mCurrentStep );
- }
-}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.h Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +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:
-*
-*/
-
-#ifndef FMOPERATIONCOPY_H
-#define FMOPERATIONCOPY_H
-#include <QObject>
-#include <QString>
-
-#include "fmoperationbase.h"
-
-class FmOperationCopy : public FmOperationBase
-{
-Q_OBJECT
-public:
- explicit FmOperationCopy( QObject *parent, QStringList sourceList, QString targetPath );
- virtual ~FmOperationCopy();
- int start( volatile bool *isStopped, QString *errString );
-
- QStringList sourceList();
- QString targetPath();
-
-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 );
-
-private:
- int copy( const QString &source, const QString &targetPath, const QString &newTargetName = QString() );
- int copyDirInsideContent( const QString &srcPath, const QString &destPath );
- void IncreaseProgress( quint64 size );
-
-private:
- QStringList mSourceList;
- QString mTargetPath;
-
-private:
- volatile bool *mStop;
- quint64 mTotalSize;
-
- QString *mErrString;
-
- quint64 mCopiedSize;
- int mTotalSteps;
- int mCurrentStep;
-};
-#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,446 @@
+/*
+* 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 "fmoperationcopyormove.h"
+#include "fmcommon.h"
+#include "fmoperationbase.h"
+#include "fmdrivedetailstype.h"
+#include "fmutils.h"
+
+#include <QDir>
+#include <QFileInfo>
+#include <QStringList>
+#include <QStack>
+
+/* \fn void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted )
+ * This signal is emitted when the same file as \a srcFile exists.
+ * \a destFile the destination file.
+ * \a isAccepted whether to replace the destination file.
+ */
+
+/* \fn void askForRename( const QString &srcFile, QString *destFile )
+ * This signal is emitted when \a srcFile needs to be renamed.
+ * \a destFile return the new name.
+ */
+
+/* \fn void driveSpaceChanged()
+ * This signal is emitted when copy or move is completed, and used to update the drive size.
+ */
+
+//the size of one time copy
+const int FmOneTimeCopyOrMoveSize = 1024;
+//the total steps of progress bar
+const int FmTotalProgressBarSteps = 100;
+/*
+ * Constructs a copy or move operation with
+ * \a operationService parent
+ * \a type the type of operation(EOperationTypeCopy or EOperationTypeMove)
+ * \a sourceList the source file or path lists that will be copied
+ * \a targetPath the target path where the source file will be copied
+ */
+FmOperationCopyOrMove::FmOperationCopyOrMove( FmOperationService *operationService, FmOperationService::TOperationType type, const QStringList &sourceList, const QString &targetPath )
+ : FmOperationBase( operationService, type ),
+ mOperationService( operationService ), mSourceList( sourceList ), mTargetPath( targetPath ),
+ mStop( 0 ), mTotalSize( 0 ), mCopiedOrMovedSize( 0 ), mTotalSteps( FmTotalProgressBarSteps ), mCurrentStep( 0 )
+{
+ mTargetPath = FmUtils::fillPathWithSplash( mTargetPath );
+ connect( this, SIGNAL( askForRename( QString, QString* ) ),
+ mOperationService, SLOT( on_operation_askForRename( QString, QString* )), Qt::BlockingQueuedConnection );
+ connect( this, SIGNAL( askForReplace( QString, QString, bool* ) ),
+ mOperationService, SLOT( on_operation_askForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection );
+ connect( this, SIGNAL( driveSpaceChanged() ),
+ mOperationService, SLOT( on_operation_driveSpaceChanged() ) );
+}
+
+/*
+ * Destructs the copy or move operation.
+ */
+FmOperationCopyOrMove::~FmOperationCopyOrMove()
+{
+}
+
+/*
+ * Returns the source file or path list
+ */
+QStringList FmOperationCopyOrMove::sourceList()
+{
+ return mSourceList;
+}
+
+/*
+ * Returns the target path
+ */
+QString FmOperationCopyOrMove::targetPath()
+{
+ return mTargetPath;
+}
+
+/*
+ * Starts the operation.
+ * \a isStopped flag the outside stop operation
+ */
+void FmOperationCopyOrMove::start( volatile bool *isStopped )
+{
+ mStop = isStopped;
+ mTotalSize = 0;
+ mCopiedOrMovedSize = 0;
+ mCurrentStep = 0;
+
+ if ( mSourceList.empty() ) {
+ emit notifyError( FmErrWrongParam, mErrString );
+ return ;
+ }
+ emit notifyPreparing( true );
+
+ int numofFolders = 0;
+ int numofFiles = 0;
+
+ int ret = FmFolderDetails::queryDetailOfContentList( mSourceList, numofFolders,
+ numofFiles, mTotalSize, mStop, true );
+ if( ret != FmErrNone ) {
+ emit notifyError( ret, mErrString );
+ return;
+ }
+ if ( !targetHasEnoughSpace() ) {
+ emit notifyError( FmErrDiskFull, mErrString );
+ return;
+ }
+ emit notifyStart( true, mTotalSteps );
+
+ foreach( const QString& source, mSourceList ) {
+ // formatPath, but do not append splash in the end
+ // Otherwise could not get fileName in QFileInfo::fileName
+ QString checkedSource( FmUtils::formatPath( source ) );
+ QFileInfo fi( checkedSource );
+ if( !fi.exists() ) {
+ mErrString = checkedSource;
+ emit notifyError( FmErrSrcPathDoNotExist, mErrString );
+ return;
+ }
+ QString newName;
+ bool isAcceptReplace = false;
+ QFileInfo destFi( mTargetPath + fi.fileName() );
+
+ // while for duplicated file/dir
+ while( destFi.exists() ) {
+ 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 {
+ queryForRename( destFi.absoluteFilePath(), &newName );
+ if( newName.isEmpty() ) {
+ ret = FmErrCancel;
+ break;
+ }
+ QString targetName = mTargetPath + newName;
+ destFi.setFile( targetName );
+ }
+ } else{
+ // destination is dir
+ queryForRename( destFi.absoluteFilePath(), &newName );
+ if( newName.isEmpty() ) {
+ ret = FmErrCancel;
+ break;
+ }
+ QString targetName = mTargetPath + newName;
+ destFi.setFile( targetName );
+ }
+ }
+ if( ret != FmErrNone ) {
+ emit notifyError( ret, mErrString );
+ // refresh drive space no care if cancel, error or finished.
+ // as filemanger cannot notify drive space changed
+ // do not refresh path as QFileSystemModel will do auto-refresh
+ emit driveSpaceChanged();
+ return;
+ }
+ ret = copyOrMove( checkedSource, mTargetPath, newName );
+ if( ret != FmErrNone ) {
+ emit notifyError( ret, mErrString );
+ emit driveSpaceChanged();
+ return;
+ }
+ }
+ emit notifyFinish();
+ emit driveSpaceChanged();
+}
+
+/*
+ * Copy or move the \a source to \a targetPath
+ * with \a newTargetName
+ */
+int FmOperationCopyOrMove::copyOrMove( const QString &source, const QString &targetPath,
+ const QString &newTargetName )
+{
+ if( *mStop ) {
+ return FmErrCancel;
+ }
+
+ QFileInfo fi( source );
+ if( !fi.exists() ) {
+ mErrString = source;
+ return FmErrSrcPathDoNotExist;
+ }
+ QString newName;
+ if( !newTargetName.isEmpty() ) {
+ newName = targetPath + newTargetName;
+ } else {
+ newName = targetPath + fi.fileName();
+ }
+
+ int ret = FmErrNone;
+
+ if ( fi.isFile() ) {
+ if ( FmUtils::getDriveLetterFromPath( source ) ==
+ FmUtils::getDriveLetterFromPath( targetPath ) &&
+ operationType() == FmOperationService::EOperationTypeMove )
+ {
+ return FmUtils::moveInsideDrive( source, newName );
+
+ }
+ quint64 fileSize = fi.size();
+ ret = copyOneFile( source, newName );
+ if (ret != FmErrNone) {
+ mErrString = source;
+ return ret;
+ }
+ if ( operationType() == FmOperationService::EOperationTypeMove
+ && !QFile::remove( source ) ) {
+ mErrString = source;
+ return FmErrCannotRemove;
+ }
+ } else if ( fi.isDir() ) {
+ if( operationType() == FmOperationService::EOperationTypeMove
+ && FmUtils::isDefaultFolder( source ) ){
+ ret = FmErrRemoveDefaultFolder;
+ }
+ else{
+ ret = copyOrMoveDirInsideContent( source, newName );
+ }
+ if( ret!= FmErrNone ) {
+ return ret;
+ }
+ if ( operationType() == FmOperationService::EOperationTypeMove
+ && !fi.dir().rmdir( fi.absoluteFilePath() ) ) {
+ mErrString = fi.absolutePath();
+ return FmErrCannotRemove;
+ }
+ } else {
+ qWarning( "Things other than file and directory are not copied" );
+ ret = FmErrIsNotFileOrFolder;
+ }
+
+ return ret;
+}
+
+/*
+ copy \a srcPath as \a destPath
+ both \a srcPath and \a destPath are Directory
+*/
+int FmOperationCopyOrMove::copyOrMoveDirInsideContent( const QString &srcPath, const QString &destPath )
+{
+ QFileInfo srcInfo( srcPath );
+ QFileInfo destInfo( destPath );
+
+ if( FmUtils::isSubLevelPath( srcPath, destPath ) ) {
+ mErrString = destPath;
+ if ( operationType() == FmOperationService::EOperationTypeMove ) {
+ return FmErrMoveDestToSubFolderInSrc;
+ } else {
+ return FmErrCopyDestToSubFolderInSrc;
+ }
+
+ }
+
+ if( !srcInfo.isDir() || !srcInfo.exists() ) {
+ mErrString = srcPath;
+ return FmErrSrcPathDoNotExist;
+ }
+
+ if( !destInfo.exists() ) {
+ if( !destInfo.dir().mkdir( destInfo.absoluteFilePath() ) ) {
+ mErrString = destPath;
+ return FmErrCannotMakeDir;
+ }
+ }
+ destInfo.setFile( destPath );
+ if( !destInfo.isDir() ) {
+ mErrString = destPath;
+ return FmErrCannotMakeDir;
+ }
+
+ //start to copy
+ QFileInfoList infoList = QDir( srcPath ).entryInfoList( QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden | QDir::System );
+ while( !infoList.isEmpty() ) {
+ if( *mStop ) {
+ return FmErrCancel;
+ }
+
+ QFileInfo fileInfo = infoList.takeFirst();
+ if( fileInfo.isFile() ){
+ //copy file
+ QString newFilePath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
+ int ret = copyOneFile( fileInfo.absoluteFilePath(), newFilePath );
+ if ( ret != FmErrNone ) {
+ mErrString = fileInfo.absoluteFilePath();
+ return ret;
+ }
+ if( operationType() == FmOperationService::EOperationTypeMove
+ && !QFile::remove( fileInfo.absoluteFilePath() ) ) {
+ mErrString = fileInfo.absoluteFilePath();
+ return FmErrCannotRemove;
+ }
+ } else if( fileInfo.isDir() ) {
+ //makedir
+ QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
+ if( !QDir( newDirPath ).exists() && !QDir( destPath ).mkdir( newDirPath ) ) {
+ mErrString = newDirPath;
+ return FmErrCannotMakeDir;
+ }
+ // add dir content to list.
+ QFileInfoList infoListDir = QDir( fileInfo.absoluteFilePath() ).entryInfoList(
+ QDir::NoDotAndDotDot | QDir::AllEntries );
+ if ( operationType() == FmOperationService::EOperationTypeMove ) {
+ if( infoListDir.isEmpty() ) {
+ if ( !fileInfo.dir().rmdir( fileInfo.absoluteFilePath() ) ) {
+ mErrString = fileInfo.absolutePath();
+ return FmErrCannotRemove;
+ }
+ } else {
+ infoList.push_front( fileInfo );
+ }
+ }
+ while( !infoListDir.isEmpty() ) {
+ infoList.push_front( infoListDir.takeLast() );
+ }
+
+ } else {
+ mErrString = fileInfo.absoluteFilePath();
+ return FmErrIsNotFileOrFolder;
+ }
+
+ }
+
+ return FmErrNone;
+}
+
+/*
+ * Increase the progress bar
+ * \a size the current copy or moved size
+ */
+void FmOperationCopyOrMove::increaseProgress( quint64 size )
+{
+ if( mTotalSize <=0 ) {
+ return;
+ }
+ mCopiedOrMovedSize += size;
+ int step = ( mCopiedOrMovedSize * FmTotalProgressBarSteps ) / mTotalSize;
+ if( step > mCurrentStep ) {
+ mCurrentStep = step;
+ emit notifyProgress( mCurrentStep );
+ }
+}
+
+/*
+ * Emits askForRename signal.
+ * \a srcFile the source file path.
+ * \a destFile get the new name from user input
+ */
+void FmOperationCopyOrMove::queryForRename( const QString &srcFile, QString *destFile )
+{
+ emit askForRename( srcFile, destFile );
+}
+
+/*
+ * Copies one file from \a srcFile to \a desFile
+ */
+int FmOperationCopyOrMove::copyOneFile( const QString &srcFile, const QString &desFile )
+{
+ QFile src( srcFile );
+ QFile des( desFile );
+ if ( !src.open( QIODevice::ReadOnly ) || !des.open( QIODevice::WriteOnly ) ) {
+ return FmErrCannotCopy;
+ }
+ QDataStream outputStream( &src );
+ QDataStream inputStream( &des );
+ //used to cache data from source file to target file during one copy
+ QScopedPointer<char> tempString( new char[FmOneTimeCopyOrMoveSize] );
+ memset( tempString.data(), 0, FmOneTimeCopyOrMoveSize );
+ while ( !outputStream.atEnd() ) {
+ if ( *mStop ) {
+ src.close();
+ des.close();
+ QFile::remove( desFile );
+ return FmErrCancel;
+ }
+ int ret = outputStream.readRawData(tempString.data(), FmOneTimeCopyOrMoveSize );
+ if (ret == -1) {
+ src.close();
+ des.close();
+ QFile::remove( desFile );
+ return FmErrCannotCopy;
+ }
+ ret = inputStream.writeRawData(tempString.data(), ret);
+ if (ret == -1) {
+ src.close();
+ des.close();
+ QFile::remove( desFile );
+ return FmErrCannotCopy;
+ }
+ memset( tempString.data(), 0, FmOneTimeCopyOrMoveSize );
+ increaseProgress( ret );
+ }
+ src.close();
+ des.close();
+ if ( FmUtils::setFileAttributes( srcFile, desFile ) != FmErrNone ) {
+ QFile::remove( desFile );
+ return FmErrCannotCopy;
+ }
+ return FmErrNone;
+}
+
+/*
+ * Prepare some work before starting operation.
+ * Returns error number.
+ */
+int FmOperationCopyOrMove::prepare()
+{
+ if( mSourceList.empty() ) {
+ return FmErrWrongParam;
+ } else {
+ return FmErrNone;
+ }
+}
+
+bool FmOperationCopyOrMove::targetHasEnoughSpace()
+{
+ QString sourceDrive = FmUtils::getDriveLetterFromPath( mSourceList.front() );
+ QString targetDrive = FmUtils::getDriveLetterFromPath( mTargetPath );
+ if ( sourceDrive == targetDrive &&
+ operationType() == FmOperationService::EOperationTypeMove ) {
+ return true;
+ } else {
+ return FmUtils::hasEnoughSpace( targetDrive, mTotalSize );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.h Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,63 @@
+/*
+* 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:
+*
+*/
+
+#ifndef FMOPERATIONCOPYORMOVE_H
+#define FMOPERATIONCOPYORMOVE_H
+
+#include <QObject>
+#include <QString>
+
+#include "fmoperationbase.h"
+
+class FmOperationCopyOrMove : public FmOperationBase
+{
+ Q_OBJECT
+
+public:
+ explicit FmOperationCopyOrMove( FmOperationService *operationService, FmOperationService::TOperationType type, const QStringList &sourceList, const QString &targetPath );
+ virtual ~FmOperationCopyOrMove();
+ virtual int prepare();
+ virtual void start( volatile bool *isStopped );
+ QStringList sourceList();
+ QString targetPath();
+
+signals:
+ void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted );
+ void askForRename( const QString &srcFile, QString *destFile );
+ void driveSpaceChanged();
+
+private:
+ int copyOrMove( const QString &source, const QString &targetPath, const QString &newTargetName = QString() );
+ int copyOrMoveDirInsideContent( const QString &srcPath, const QString &destPath );
+ void increaseProgress( quint64 size );
+ void queryForRename( const QString &srcFile, QString *destFile );
+ int copyOneFile( const QString &srcFile, const QString &desFile );
+ bool targetHasEnoughSpace();
+
+private:
+ FmOperationService *mOperationService;
+ QStringList mSourceList;
+ QString mTargetPath;
+ volatile bool *mStop;
+ QString mErrString;
+
+ quint64 mTotalSize;
+ quint64 mCopiedOrMovedSize;
+ int mTotalSteps;
+ int mCurrentStep;
+};
+#endif
--- a/filemanager/src/filemanager/src/operationservice/fmoperationformat.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat.h Tue Aug 24 10:24:14 2010 +0800
@@ -28,16 +28,13 @@
{
Q_OBJECT
public:
- explicit FmOperationFormat( QObject *parent, QString mDriverName );
+ explicit FmOperationFormat( QObject *parent, const QString &mDriverName );
virtual ~FmOperationFormat();
- QString driverName();
+ QString driverName();
+ virtual void start( volatile bool *isStopped );
- int start();
-
signals:
- void notifyStart( bool cancelable, int maxSteps );
- void notifyProgress( int currentStep );
- void notifyPreparing( bool cancelable );
+ void driveSpaceChanged();
private:
QString mDriverName;
--- a/filemanager/src/filemanager/src/operationservice/fmoperationformat_s60.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat_s60.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -26,28 +26,50 @@
#include <e32property.h>
#include <coreapplicationuisdomainpskeys.h>
-FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ),
+/* \fn void driveSpaceChanged()
+ * This signal is emitted when copy or move is completed, and used to update the drive size.
+ */
+
+/*
+ * Constructs a format operation with \a parent
+ * \a mDriverName the drive to be formatted.
+ */
+FmOperationFormat::FmOperationFormat( QObject *parent, const QString &mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ),
mDriverName( mDriverName )
{
+ connect( this, SIGNAL( driveSpaceChanged() ),
+ parent, SLOT( on_operation_driveSpaceChanged() ) );
}
+
+/*
+ * Destructs the operation.
+ */
FmOperationFormat::~FmOperationFormat()
{
}
+/*
+ * Returns the to be formatted drive name
+ */
QString FmOperationFormat::driverName()
{
return mDriverName;
}
-int FmOperationFormat::start()
+/*
+ * Starts to format.
+ * \a isStopped not used
+ */
+void FmOperationFormat::start( volatile bool */*isStopped*/ )
{
QString logString = "FmOperationFormat::start";
- FmLogger::log( logString );
+ FM_LOG( logString );
emit notifyPreparing( false );
if( mDriverName.isEmpty() ) {
- return FmErrWrongParam;
+ emit notifyError( FmErrWrongParam, QString() );
+ return;
}
RFormat format;
@@ -56,7 +78,8 @@
int err = fs.Connect();
if( err != KErrNone ){
- return FmErrTypeFormatFailed;
+ emit notifyError( FmErrTypeFormatFailed, QString() );
+ return;
}
TInt drive = 0;
@@ -73,19 +96,19 @@
if( err == KErrNone ){
logString = "emit notifyStart";
- FmLogger::log( logString );
+ FM_LOG( logString );
mTotalSteps = finalValue;
emit notifyStart( false, finalValue );
}
logString = "Format open error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
if( err == KErrLocked ){
err = fs.ErasePassword( drive );
logString = "ErasePassword error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
if( err == KErrNone ){
err = format.Open(
@@ -93,12 +116,12 @@
if( err == KErrNone ){
logString = "emit notifyStart";
- FmLogger::log( logString );
+ FM_LOG( logString );
mTotalSteps = finalValue;
emit notifyStart( false, finalValue );
}
logString = "Second format open error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
}
}
@@ -110,13 +133,13 @@
if( err == KErrNone ){
logString = "emit notifyStart";
- FmLogger::log( logString );
+ FM_LOG( logString );
mTotalSteps = finalValue;
emit notifyStart( false, finalValue );
}
logString = "Reallyformat open error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
}
}
@@ -126,7 +149,7 @@
err = fs.FileSystemName( fsName, drive );
logString = "FileSystemName error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
if ( err == KErrNone && fsName.Length() > 0 )
{
@@ -137,7 +160,7 @@
ECoreAppUIsEjectCommandUsed );
logString = "Prevent SysAp shutting down applications" ;
- FmLogger::log( logString );
+ FM_LOG( logString );
}
else
{
@@ -146,7 +169,7 @@
err = KErrCancel;
logString = QString( "Format cancel" );
- FmLogger::log( logString );
+ FM_LOG( logString );
}
}
@@ -154,17 +177,17 @@
while ( finalValue ){
logString = "Format tracks:" + QString::number( finalValue );
- FmLogger::log( logString );
+ FM_LOG( logString );
err = format.Next( finalValue );
if( err != KErrNone ){
logString = "Format error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
break;
}
logString = "emit notifyProgress";
- FmLogger::log( logString );
+ FM_LOG( logString );
emit notifyProgress( mTotalSteps - finalValue );
}
}
@@ -177,9 +200,14 @@
}
if( err == KErrNone ){
- return FmErrNone;
+ emit notifyFinish();
}
else{
- return FmErrTypeFormatFailed;
+ emit notifyError( FmErrTypeFormatFailed, QString() );
}
+ // refresh drive space no care if cancel, error or finished.
+ // as filemanger cannot notify drive space changed
+ // do not refresh path as QFileSystemModel will do auto-refresh
+ emit driveSpaceChanged();
+
}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -22,26 +22,46 @@
#include <QString>
-FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ),
+/* \fn void driveSpaceChanged()
+ * This signal is emitted when copy or move is completed, and used to update the drive size.
+ */
+
+/*
+ * Constructs a format operation with \a parent
+ * \a mDriverName the drive to be formatted.
+ */
+FmOperationFormat::FmOperationFormat( QObject *parent, const QString &mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ),
mDriverName( mDriverName )
{
}
+
+/*
+ * Destructs the operation.
+ */
FmOperationFormat::~FmOperationFormat()
{
}
+/*
+ * Returns the to be formatted drive name
+ */
QString FmOperationFormat::driverName()
{
return mDriverName;
}
-int FmOperationFormat::start()
+/*
+ * Starts to format.
+ * \a isStopped not used
+ */
+void FmOperationFormat::start( volatile bool */*isStopped*/ )
{
QString logString = "FmOperationFormat::start";
- FmLogger::log( logString );
+ FM_LOG( logString );
if( mDriverName.isEmpty() ) {
- return FmErrWrongParam;
+ emit notifyError( FmErrWrongParam, QString() );
+ return;
}
int totalCount( 100 );
emit notifyStart( totalCount, false );
@@ -49,6 +69,7 @@
emit notifyProgress( i );
}
- return FmErrNone;
+ emit notifyFinish();
+ emit driveSpaceChanged();
}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +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:
-*
-*/
-
-#include "fmoperationmove.h"
-#include "fmcommon.h"
-#include "fmoperationbase.h"
-#include "fmdrivedetailstype.h"
-#include "fmutils.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QStringList>
-#include <QStack>
-
-FmOperationMove::FmOperationMove( QObject *parent, QStringList sourceList, QString targetPath ) :
- FmOperationBase( parent, FmOperationService::EOperationTypeMove ),
- mSourceList( sourceList ), mTargetPath( targetPath ),
- mStop( 0 ), mTotalSize( 0 ), mErrString( 0 ), mMovedSize( 0 ), mTotalSteps( 100 ), mCurrentStep( 0 )
-{
-}
-
-FmOperationMove::~FmOperationMove()
-{
-}
-
-QStringList FmOperationMove::sourceList()
-{
- return mSourceList;
-}
-QString FmOperationMove::targetPath()
-{
- return mTargetPath;
-}
-
-int FmOperationMove::start( volatile bool *isStopped, QString *errString )
-{
- mStop = isStopped;
- mErrString = errString;
-
- mTotalSize = 0;
- mMovedSize = 0;
- mCurrentStep = 0;
-
-
- if( mSourceList.empty() ) {
- return FmErrWrongParam;
- }
-
- emit notifyPreparing( true );
-
- int numofFolders = 0;
- int numofFiles = 0;
-
- int ret = FmFolderDetails::queryDetailOfContentList( mSourceList, numofFolders,
- numofFiles, mTotalSize, mStop, true );
- if( ret != FmErrNone ) {
- return ret;
- }
-
- emit notifyStart( true, mTotalSteps );
- foreach( const QString& source, mSourceList ) {
- QFileInfo fi( source );
- if( !fi.exists() ) {
- *mErrString = source;
- ret = FmErrSrcPathDoNotExist;
- return ret;
- }
- QString newName;
- bool isAcceptReplace = false;
- QFileInfo destFi( mTargetPath + fi.fileName() );
- // while for duplicated file/dir
- while( destFi.exists() ) {
- 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 );
- }
- }
- if( ret != FmErrNone ) {
- return ret;
- }
-
- int ret = move( source, mTargetPath, newName );
- if( ret != FmErrNone ) {
- return ret;
- }
- }
- return FmErrNone;
-}
-
-int FmOperationMove::move( const QString &source, const QString &targetPath, const QString &newTargetName )
-{
- if( *mStop ) {
- return FmErrCancel;
- }
-
- QFileInfo fi( source );
- if( !fi.exists() ) {
- *mErrString = source;
- return FmErrSrcPathDoNotExist;
- }
- QString newName;
- if( !newTargetName.isEmpty() ) {
- newName = targetPath + newTargetName;
- } else {
- newName = targetPath + fi.fileName();
- }
-
- int ret = FmErrNone;
- if (fi.isFile()) {
- int fileSize = fi.size();
- if ( !QFile::copy( source, newName )) {
- *mErrString = source;
- ret = FmErrCannotCopy;
- }
- if( !QFile::remove( source ) ) {
- *mErrString = source;
- ret = FmErrCannotRemove;
- }
- IncreaseProgress( fileSize );
- } else if (fi.isDir()) {
- if( FmUtils::isDefaultFolder( source ) ){
- ret = FmErrRemoveDefaultFolder;
- }
- else{
- ret = moveDirInsideContent( source, newName );
- }
-
- if( ret!= FmErrNone ) {
- return ret;
- }
- if ( !fi.dir().rmdir( fi.absoluteFilePath() ) ) {
- *mErrString = fi.absolutePath();
- return FmErrCannotRemove;
- }
- } else {
- qWarning( "Things other than file and directory are not copied" );
- ret = FmErrIsNotFileOrFolder;
- }
-
- return ret;
-}
-int FmOperationMove::moveDirInsideContent( const QString &srcPath, const QString &destPath )
-{
- if( destPath.contains( srcPath, Qt::CaseInsensitive ) ) {
- *mErrString = destPath;
- return FmErrMoveDestToSubFolderInSrc;
- }
-
- QFileInfo srcInfo( srcPath );
- if( !srcInfo.isDir() || !srcInfo.exists() ) {
- *mErrString = srcPath;
- return FmErrSrcPathDoNotExist;
- }
-
- QFileInfo destInfo( destPath );
- if( !destInfo.exists() ) {
- if( !destInfo.dir().mkdir( destInfo.absoluteFilePath() ) ) {
- *mErrString = destPath;
- return FmErrCannotMakeDir;
- }
- }
- if( !srcInfo.isDir() ) {
- *mErrString = destPath;
- return FmErrCannotMakeDir;
- }
-
- //start to move
- QFileInfoList infoList = QDir( srcPath ).entryInfoList( QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden | QDir::System );
- while( !infoList.isEmpty() ) {
- if( *mStop ) {
- return FmErrCancel;
- }
-
- QFileInfo fileInfo = infoList.takeFirst();
- if( fileInfo.isFile() ){
- //copy file
- quint64 fileSize = fileInfo.size();
- QString newFilePath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
- if (!QFile::copy( fileInfo.absoluteFilePath(), newFilePath ) ) {
- *mErrString = fileInfo.absoluteFilePath();
- return FmErrCannotCopy;
- }
- if( !QFile::remove( fileInfo.absoluteFilePath() ) ) {
- *mErrString = fileInfo.absoluteFilePath();
- return FmErrCannotRemove;
- }
- IncreaseProgress( fileSize );
- } else if( fileInfo.isDir() ) {
- //makedir
- QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
- if( !QDir( newDirPath ).exists() && !QDir( destPath ).mkdir( newDirPath ) ) {
- *mErrString = newDirPath;
- return FmErrCannotMakeDir;
- }
- // add dir content to list.
- QFileInfoList infoListDir = QDir( fileInfo.absoluteFilePath() ).entryInfoList(
- QDir::NoDotAndDotDot | QDir::AllEntries );
- if( infoListDir.isEmpty() ) {
- if ( !fileInfo.dir().rmdir( fileInfo.absoluteFilePath() ) ) {
- *mErrString = fileInfo.absolutePath();
- return FmErrCannotRemove;
- }
- } else {
- infoList.push_front( fileInfo );
- }
- while( !infoListDir.isEmpty() ) {
- infoList.push_front( infoListDir.takeLast() );
- }
-
- } else {
- *mErrString = fileInfo.absoluteFilePath();
- return FmErrIsNotFileOrFolder;
- }
-
- }
-
- return FmErrNone;
-}
-
-void FmOperationMove::IncreaseProgress( quint64 size )
-{
- if( mTotalSize <=0 ) {
- return;
- }
- mMovedSize += size;
- int step = ( mMovedSize * 100 ) / mTotalSize;
- if( step > mCurrentStep ) {
- mCurrentStep = step;
- emit notifyProgress( mCurrentStep );
- }
-}
-
-
--- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.h Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +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:
-*
-*/
-
-#ifndef FMOPERATIONMOVE_H
-#define FMOPERATIONMOVE_H
-#include <QObject>
-#include <QString>
-
-#include "fmoperationbase.h"
-
-class FmOperationMove : public FmOperationBase
-{
-Q_OBJECT
-public:
- explicit FmOperationMove( QObject *parent, QStringList sourceList, QString targetPath );
- virtual ~FmOperationMove();
- QStringList sourceList();
- QString targetPath();
- int start( volatile bool *isStopped, QString *errString );
-
-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 );
-
-private:
- int move( const QString &source, const QString &targetPath, const QString &newTargetName = QString() );
- int moveDirInsideContent( const QString &srcPath, const QString &destPath );
- void IncreaseProgress( quint64 size );
-
-private:
- QStringList mSourceList;
- QString mTargetPath;
-
-private:
- volatile bool *mStop;
- quint64 mTotalSize;
- QString *mErrString;
-
- quint64 mMovedSize;
- int mTotalSteps;
- int mCurrentStep;
-};
-
-#endif
--- a/filemanager/src/filemanager/src/operationservice/fmoperationremove.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationremove.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -26,33 +26,54 @@
#include <QStringList>
#include <QStack>
-FmOperationRemove::FmOperationRemove( QObject *parent, QStringList pathList ) :
- FmOperationBase( parent, FmOperationService::EOperationTypeRemove ),
- mPathList( pathList ), mStop( 0 ), mTotalCount( 0 ),
- mErrString( 0 ), mRemovedCount( 0 ), mTotalSteps( 100 ), mCurrentStep( 0 )
+/* \fn void driveSpaceChanged()
+ * This signal is emitted when copy or move is completed, and used to update the drive size.
+ */
+
+/*
+ * Constructs a remove operation with
+ * \a parent parent
+ * \a pathList the file or path to be removed.
+ */
+FmOperationRemove::FmOperationRemove(QObject *parent, const QStringList &pathList ) :
+ FmOperationBase( parent, FmOperationService::EOperationTypeRemove ),
+ mPathList( pathList ),
+ mStop( 0 ),
+ mTotalCount( 0 ), mRemovedCount( 0 ), mTotalSteps( 100 ), mCurrentStep( 0 )
{
+ connect( this, SIGNAL( driveSpaceChanged() ),
+ parent, SLOT( on_operation_driveSpaceChanged() ) );
}
+/*
+ * Destructs the operation.
+ */
FmOperationRemove::~FmOperationRemove()
{
}
+/*
+ * Returns the path list
+ */
QStringList FmOperationRemove::pathList()
{
return mPathList;
}
-int FmOperationRemove::start( volatile bool *isStopped, QString *errString )
+/*
+ * Starts the operation.
+ * \a isStopped flag the outside stop operation
+ */
+void FmOperationRemove::start( volatile bool *isStopped )
{
mStop = isStopped;
- mErrString = errString;
-
mTotalCount = 0;
mRemovedCount = 0;
mCurrentStep = 0;
if( mPathList.empty() ) {
- return FmErrWrongParam;
+ emit notifyError( FmErrWrongParam, mErrString );
+ return ;
}
emit notifyPreparing( true );
@@ -64,7 +85,8 @@
int ret = FmFolderDetails::queryDetailOfContentList( mPathList, numofFolders,
numofFiles, totalSize, mStop, true );
if( ret != FmErrNone ) {
- return ret;
+ emit notifyError( ret, mErrString );
+ return;
}
mTotalCount = numofFolders + numofFiles;
@@ -73,12 +95,21 @@
foreach( const QString& srcPath, mPathList ) {
int ret = remove( srcPath );
if( ret != FmErrNone ) {
- return ret;
+ emit notifyError( ret, mErrString );
+ // refresh drive space no care if cancel, error or finished.
+ // as filemanger cannot notify drive space changed
+ // do not refresh path as QFileSystemModel will do auto-refresh
+ emit driveSpaceChanged();
+ return;
}
}
- return FmErrNone;
+ emit notifyFinish();
+ emit driveSpaceChanged();
}
+/*
+ * Removes the file or dir with name \a fileName
+ */
int FmOperationRemove::remove( const QString &fileName )
{
if( *mStop ) {
@@ -89,7 +120,7 @@
QFileInfo fi( fileName );
if (fi.isFile()) {
if( !QFile::remove( fileName ) ) {
- *mErrString = fileName;
+ mErrString = fileName;
ret = FmErrCannotRemove;
}
IncreaseProgressOnce();
@@ -109,6 +140,9 @@
return ret;
}
+/*
+ * Remove the dir with name \a pathName
+ */
int FmOperationRemove::recursiveRemoveDir( const QString &pathName )
{
QFileInfo fi( pathName );
@@ -123,7 +157,7 @@
if (infoList.size() == 0) {
QDir dirToRemove( dirs.pop() );
if ( !dirToRemove.rmdir( dirToRemove.absolutePath() ) ) {
- *mErrString = dirToRemove.absolutePath();
+ mErrString = dirToRemove.absolutePath();
return FmErrCannotRemove;
}
IncreaseProgressOnce();
@@ -139,7 +173,7 @@
dirList.push_front( QDir( it->absoluteFilePath() ) );
} else {
if ( !QFile::remove( it->absoluteFilePath() ) ) {
- *mErrString = it->absoluteFilePath();
+ mErrString = it->absoluteFilePath();
return FmErrCannotRemove;
}
IncreaseProgressOnce();
@@ -153,6 +187,9 @@
return FmErrNone;
}
+/*
+ * Increase the progress bar
+ */
void FmOperationRemove::IncreaseProgressOnce()
{
if( mTotalCount <= 0 )
--- a/filemanager/src/filemanager/src/operationservice/fmoperationremove.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationremove.h Tue Aug 24 10:24:14 2010 +0800
@@ -23,21 +23,18 @@
class FmOperationRemove : public FmOperationBase
{
-Q_OBJECT
+ Q_OBJECT
+
public:
- explicit FmOperationRemove( QObject *parent, QStringList pathList );
+ explicit FmOperationRemove( QObject *parent, const QStringList &pathList );
virtual ~FmOperationRemove();
QStringList pathList();
- int start( volatile bool *isStopped, QString *errString );
-
+ void start( volatile bool *isStopped );
+
signals:
- void askForRename( const QString &srcFile, QString &destFile );
-
- void notifyPreparing( bool cancelable );
- void notifyStart( bool cancelable, int maxSteps );
- void notifyProgress( int currentStep );
-
+ void driveSpaceChanged();
+
private:
int remove( const QString &fileName );
int recursiveRemoveDir( const QString &path );
@@ -46,15 +43,13 @@
private:
QStringList mPathList;
-private:
- volatile bool *mStop;
- quint64 mTotalCount;
+ volatile bool *mStop;
+ QString mErrString;
- QString *mErrString;
-
- quint64 mRemovedCount;
- int mTotalSteps;
- int mCurrentStep;
+ quint64 mTotalCount;
+ quint64 mRemovedCount;
+ int mTotalSteps;
+ int mCurrentStep;
};
#endif
--- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -18,35 +18,83 @@
#include "fmoperationbase.h"
#include "fmoperationservice.h"
#include "fmoperationformat.h"
+#include "fmbkupengine.h"
+#include "fmbackupsettings.h"
+#include "fmbackuprestorehandler.h"
+#include "fmoperationviewdetails.h"
#include "fmviewdetailsdialog.h"
#include "fmdlgutils.h"
#include "fmutils.h"
-
+#include <hbaction.h>
#include <hbprogressdialog.h>
#include <hbaction.h>
-#include <hbmessagebox.h>
+#include <hbglobal.h>
+#include <QFileInfo>
+/*
+ * Constructs one operation result processer with \a operation Service.
+ */
FmOperationResultProcesser::FmOperationResultProcesser( FmOperationService *operationService )
: mOperationService( operationService ), mNote( 0 )
{
}
+/*
+ * Destructs the operation result processer
+ */
FmOperationResultProcesser::~FmOperationResultProcesser(void)
{
}
+/*
+ * Called by operation service on_operation_askForRename
+ * \sa FmOperationService::on_operation_askForRename
+ */
void FmOperationResultProcesser::onAskForRename(
FmOperationBase* operationBase, const QString &srcFile, QString *destFile )
{
Q_UNUSED( operationBase );
+ int maxFileNameLength = FmUtils::getMaxFileNameLength();
QString questionText = QString( "file " ) +
srcFile + QString( " already exist, please rename:" );
- QString value;
- FmDlgUtils::showTextQuery( questionText, value, true );
- *destFile = value;
+ QString value;
+ QFileInfo srcFileInfo(srcFile);
+ QStringList regExpList = (QStringList() << Regex_ValidFileFolderName << Regex_ValidNotEndWithDot );
+
+ bool ret = FmDlgUtils::showTextQuery( questionText, value, regExpList,
+ maxFileNameLength, QString(), false );
+ while ( ret ) {
+ // remove whitespace from the start and the end.
+ value = value.trimmed();
+ QString newTargetPath = FmUtils::fillPathWithSplash(
+ srcFileInfo.absolutePath() ) + value;
+ QString errString;
+ // check if name/path is available for use.
+ if( !FmUtils::checkNewFolderOrFile( value, newTargetPath, errString ) ) {
+ FmDlgUtils::information( errString );
+ ret = FmDlgUtils::showTextQuery( questionText, value, regExpList, maxFileNameLength, QString(), false );
+ continue;
+ } else {
+ break;
+ }
+ }
+ if( ret ) {
+ // Got file/folder name for rename, save it to destFile
+ *destFile = value;
+ QFileInfo destFileInfo( *destFile );
+ if ( ( srcFileInfo.suffix().compare( destFileInfo.suffix(), Qt::CaseInsensitive ) != 0 )
+ && srcFileInfo.isFile() ) {
+ // popup warning when the suffix of file is changed.
+ FmDlgUtils::information( hbTrId( "File may become unusable when file name extension is changed" ) );
+ }
+ }
}
+/*
+ * Called by operation service on_operation_askForReplace
+ * \sa FmOperationService::on_operation_askForReplace
+ */
void FmOperationResultProcesser::onAskForReplace(
FmOperationBase* operationBase, const QString &srcFile, const QString &destFile, bool *isAccepted )
{
@@ -55,16 +103,30 @@
QString questionText = QString( "file " ) +
srcFile + QString( " already exist, replace it?" );
- if( HbMessageBox::question( questionText ) ) {
+ if( FmDlgUtils::question( questionText ) ) {
*isAccepted = true;
} else {
*isAccepted = false;
}
}
+/*
+ * Called by operation service on_operation_showNote
+ * \sa FmOperationService::on_operation_showNote
+ */
+void FmOperationResultProcesser::onShowNote( FmOperationBase* operationBase, const char *noteString )
+{
+ Q_UNUSED( operationBase );
+ FmDlgUtils::information(hbTrId(noteString));
+}
+
+/*
+ * Called by operation service on_operation_notifyWaiting
+ * \sa FmOperationService::on_operation_notifyWaiting
+ */
void FmOperationResultProcesser::onNotifyWaiting( FmOperationBase* operationBase, bool cancelable )
{
- QString title = tr("Operation");
+ QString title = hbTrId("Operation");
switch( operationBase->operationType() )
{
case FmOperationService::EOperationTypeBackup:
@@ -87,6 +149,10 @@
showWaiting( title, cancelable );
}
+/*
+ * Called by operation service on_operation_notifyPreparing
+ * \sa FmOperationService::on_operation_notifyPreparing
+ */
void FmOperationResultProcesser::onNotifyPreparing( FmOperationBase* operationBase, bool cancelable )
{
QString title = hbTrId("Operation");
@@ -117,9 +183,13 @@
showPreparing( title, cancelable );
}
+/*
+ * Called by operation service on_operation_notifyStart
+ * \sa FmOperationService::on_operation_notifyStart
+ */
void FmOperationResultProcesser::onNotifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps )
{
- QString title = tr("Operation");
+ QString title = hbTrId("Operation");
switch( operationBase->operationType() )
{
case FmOperationService::EOperationTypeBackup:
@@ -147,12 +217,20 @@
showProgress( title, cancelable, maxSteps );
}
+/*
+ * Called by operation service on_operation_notifyProgress
+ * \sa FmOperationService::on_operation_notifyProgress
+ */
void FmOperationResultProcesser::onNotifyProgress( FmOperationBase* operationBase, int currentStep )
{
Q_UNUSED( operationBase );
setProgress( currentStep );
}
+/*
+ * Called by operation service on_operation_notifyFinish
+ * \sa FmOperationService::on_operation_notifyFinish
+ */
void FmOperationResultProcesser::onNotifyFinish( FmOperationBase* operationBase )
{
@@ -179,83 +257,157 @@
}
case FmOperationService::EOperationTypeFormat:
{
- HbMessageBox::information( QString( hbTrId("Format succeed!")) );
+ FmDlgUtils::information( QString( hbTrId("Format succeed!")) );
FmOperationFormat *paramFormat = static_cast<FmOperationFormat*>( operationBase );
- QString title( tr( "Drive name ") );
+ QString title( hbTrId( "Drive name ") );
QString driveName( paramFormat->driverName() );
- QString volumeName;
- while( FmDlgUtils::showTextQuery( title, volumeName, false, FmMaxLengthofDriveName ) ){
+ FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName );
+ FmDriverInfo::DriveState state = driverInfo.driveState();
+ FmDriverInfo::DriveType driveType = driverInfo.driveType();
+
+ // If drive is available and it is mmc or usb memory
+ if( ( state & FmDriverInfo::EDriveAvailable ) &&
+ ( driveType == FmDriverInfo::EDriveTypeMemoryCard ||
+ driveType == FmDriverInfo::EDriveTypeUsbMemory ) ) {
+ bool needToSetVolume = false;
+ QString volumeName = FmUtils::getVolumeNameWithDefaultNameIfNull( driveName, needToSetVolume );
+ //use isReturnFalseWhenNoTextChanged = false in order that FmUtils::renameDrive( driveName, volumeName ) will
+ //be excuted at lease once to set the volume name.
+ while( FmDlgUtils::showTextQuery( title, volumeName, QStringList(), FmMaxLengthofDriveName, QString(), false ) ){
int err = FmUtils::renameDrive( driveName, volumeName );
- if ( err == FmErrNone ){
- HbMessageBox::information( hbTrId( "The name has been changed!" ) );
- mOperationService->on_operationThread_refreshModel( driveName );
+ if ( err == FmErrNone ) {
+ FmDlgUtils::information( hbTrId( "The name has been changed!" ) );
+ mOperationService->on_operation_driveSpaceChanged();
break;
} else if( err == FmErrBadName ) {
- HbMessageBox::information( hbTrId( "Illegal characters! Use only letters and numbers." ) );
+ FmDlgUtils::information( hbTrId( "Illegal characters! Use only letters and numbers." ) );
} else{
- HbMessageBox::information( hbTrId( "Error occurred, operation cancelled!" ) );
+ FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
break;
}
}
+ }
break;
}
case FmOperationService::EOperationTypeBackup:
{
- HbMessageBox::information( QString( hbTrId("Backup succeed!")) );
+ FmDlgUtils::information( QString( hbTrId("Backup succeed!")) );
break;
}
case FmOperationService::EOperationTypeRestore:
{
- HbMessageBox::information( QString( hbTrId("Restore succeed!")) );
+ FmDlgUtils::information( QString( hbTrId("Restore succeed!")) );
break;
}
default:
- HbMessageBox::information( QString( hbTrId("Operation finished")) );
+ FmDlgUtils::information( QString( hbTrId("Operation finished")) );
}
}
-void FmOperationResultProcesser::onNotifyError( FmOperationBase* operationBase, int error, QString errString )
+
+/*
+ * Called by operation service on_operation_notifyError
+ * \sa FmOperationService::on_operation_notifyError
+ */
+void FmOperationResultProcesser::onNotifyError( FmOperationBase* operationBase, int error, const QString &errString )
{
Q_UNUSED( errString );
failAndCloseProgress();
switch( error )
{
+ case FmErrCancel:
+ cancelProgress();
+ // Do not pop up general cancel note as it is not needed( according to TB9.2 ).
+ // If it should be added later, please do not use blocking note.
+ // Blocking note will cause second backup operaion freeze after cancel previous backup operation
+ // as QEventLoop::exec will cause some problem when used for blocking dialog.
+ // HbDialog has already removed exec function which is implemented with QEventLoop::exec.
+ // If need use QEventLoop::exec to block code execute sequence, It should be invoked in a Qt::QueuedConnection slot.
+ return;
case FmErrAlreadyStarted:
- HbMessageBox::information( QString( hbTrId("Operation already started!")) );
+ FmDlgUtils::information( QString( hbTrId("Operation already started!")) );
+ return;
+ case FmErrLocked:
+ {
+ FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase);
+ if( operationBackup ) {
+ // special error note for backup
+ QString targetDrive( operationBackup->targetDrive() );
+ QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) );
+ QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume );
+ FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_locked") ).arg( driveString ) );
+ } else {
+ FmDlgUtils::information( QString( hbTrId("Operation failed because drive is locked!")) );
+ }
+ return;
+ }
+ case FmErrPathNotFound:
+ FmDlgUtils::information( QString( hbTrId("Operation failed because can not find target path or drive is not available!") ) );
+ return;
+ case FmErrCorrupt:
+ {
+ FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase);
+ if( operationBackup ) {
+ // special error note for backup
+ QString targetDrive( operationBackup->targetDrive() );
+ QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) );
+ QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume );
+ FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_corrupted") ).arg( driveString ) );
+ } else {
+ FmDlgUtils::information( QString( hbTrId("Operation failed because target media is corrupted!") ) );
+ }
+ return;
+ }
+ case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup
+ {
+ FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase);
+ if( operationBackup ) {
+ // special error note for backup
+ QString targetDrive( operationBackup->targetDrive() );
+ QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) );
+ QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume );
+ FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_unavailable") ).arg( driveString ) );
+ } else {
+ FmDlgUtils::information( QString( hbTrId("Operation failed because device is not ready!") ) );
+ }
+ return;
+ }
+ case FmErrDisMounted: // Caused by eject MMC when preparing backup, will be localized later
+ FmDlgUtils::information( QString( hbTrId("Operation failed because backup target drive has been removed!") ) );
return;
case FmErrDiskFull:
- HbMessageBox::information( QString( hbTrId("Not enough space. Operation cancelled.!")) );
+ FmDlgUtils::information( QString( hbTrId("Not enough space. Operation cancelled!")) );
return;
case FmErrCopyDestToSubFolderInSrc:
- HbMessageBox::information( QString( hbTrId("Can not copy to sub folder!")) );
+ FmDlgUtils::information( QString( hbTrId("Can not copy to sub folder!")) );
return;
case FmErrMoveDestToSubFolderInSrc:
- HbMessageBox::information( QString( hbTrId("Can not move to sub folder!")) );
+ FmDlgUtils::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 ) ) );
+ FmDlgUtils::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 ) ) );
+ FmDlgUtils::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 ) ) );
+ FmDlgUtils::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 ) ) );
+ FmDlgUtils::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 ) ) );
+ FmDlgUtils::information( QString( hbTrId( "Could not remove the default folder %1 " ).arg( errString ) ) );
return;
}
}
@@ -264,29 +416,28 @@
switch( operationBase->operationType() )
{
case FmOperationService::EOperationTypeFormat:
- HbMessageBox::information( QString( hbTrId("Format failed!")) );
+ FmDlgUtils::information( QString( hbTrId("Format failed!")) );
break;
default:
- HbMessageBox::information( QString( hbTrId("Operation failed")) );
+ FmDlgUtils::information( QString( hbTrId("Operation failed")) );
}
}
-void FmOperationResultProcesser::onNotifyCanceled( FmOperationBase* operationBase )
-{
- Q_UNUSED( operationBase );
- cancelProgress();
- HbMessageBox::information( QString( hbTrId("Operation Canceled!") ) );
-}
-
-
+/*
+ * Responds to waiting note's cancel signal.
+ */
void FmOperationResultProcesser::onProgressCancelled()
{
mOperationService->cancelOperation();
}
-//
+/*
+ * Shows the waiting dialog with
+ * \a title the title of the dialog.
+ * \a cancelable whether it could be cancelled.
+ */
void FmOperationResultProcesser::showWaiting( QString title, bool cancelable )
{
qDebug("show warning");
@@ -304,14 +455,25 @@
// mNote->setProgressDialogType( HbProgressDialog::WaitNote );
// }
mNote->setText( title );
- if( !cancelable )
- mNote->primaryAction()->setDisabled( true );
- else
- mNote->primaryAction()->setDisabled( false );
- mNote->exec();
+ //KRAZY: ignore krazy warning because QAction must be used.
+ QList<QAction *> actionList = mNote->actions();
+ if (actionList.size() > 0) {
+ QAction *cancelAction = actionList.at(0);
+ if (!cancelable) {
+ cancelAction->setDisabled( true );
+ } else {
+ cancelAction->setDisabled( false );
+ }
+ }
+ mNote->open();
}
+/*
+ * Shows the preparing dialog with
+ * \a title the title of the dialog.
+ * \a cancelable whether it could be cancelled.
+ */
void FmOperationResultProcesser::showPreparing( QString title, bool cancelable )
{
qDebug("show preparing");
@@ -333,15 +495,24 @@
mNote->setMaximum( 65535 );
mNote->setProgressValue( 0 );
mNote->setText( title );
- if( !cancelable ){
- mNote->primaryAction()->setDisabled( true );
- }
- else{
- mNote->primaryAction()->setDisabled( false );
- }
- mNote->exec();
+ //KRAZY: ignore krazy warning because QAction must be used.
+ QList<QAction *> actionList = mNote->actions();
+ if (actionList.size() > 0) {
+ QAction *cancelAction = actionList.at(0);
+ if (!cancelable) {
+ cancelAction->setDisabled( true );
+ } else {
+ cancelAction->setDisabled( false );
+ }
+ }
+ mNote->open();
}
+/*
+ * Shows the progress dialog with
+ * \a title the title of the dialog.
+ * \a cancelable whether it could be cancelled.
+ */
void FmOperationResultProcesser::showProgress( QString title, bool cancelable, int maxValue )
{
qDebug("show progress");
@@ -365,23 +536,32 @@
mNote->setMaximum( maxValue );
mNote->setProgressValue( 0 );
-
- if( !cancelable ){
- mNote->primaryAction()->setDisabled( true );
- }
- else{
- mNote->primaryAction()->setDisabled( false );
- }
-
- mNote->exec();
+ //KRAZY: ignore krazy warning because QAction must be used.
+ QList<QAction *> actionList = mNote->actions();
+ if (actionList.size() > 0) {
+ QAction *cancelAction = actionList.at(0);
+ if(!cancelable) {
+ cancelAction->setDisabled( true );
+ } else {
+ cancelAction->setDisabled( false );
+ }
+ }
+ mNote->open();
}
+/*
+ * Sets the current progress value to be \a value
+ */
void FmOperationResultProcesser::setProgress( int value )
{
qDebug("set progress");
if( mNote )
mNote->setProgressValue( value );
}
+
+/*
+ * Finishes the progress.
+ */
void FmOperationResultProcesser::finishProgress()
{
qDebug("finish progress");
@@ -390,6 +570,9 @@
}
}
+/*
+ * Cancels the progress bar.
+ */
void FmOperationResultProcesser::cancelProgress()
{
qDebug("cancel progress");
@@ -398,6 +581,9 @@
}
}
+/*
+ * Fails and closes the progress bar.
+ */
void FmOperationResultProcesser::failAndCloseProgress()
{
qDebug("fail progress");
--- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Tue Aug 24 10:24:14 2010 +0800
@@ -33,6 +33,7 @@
void onAskForRename( FmOperationBase* operationBase, const QString &srcFile, QString *destFile );
void onAskForReplace( FmOperationBase* operationBase, const QString &srcFile, const QString &destFile, bool *isAccepted );
+ void onShowNote( FmOperationBase* operationBase, const char *noteString );
void onNotifyWaiting( FmOperationBase* operationBase, bool cancelable );
void onNotifyPreparing( FmOperationBase* operationBase, bool cancelable );
void onNotifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps );
@@ -40,8 +41,8 @@
void onNotifyFinish( FmOperationBase* operationBase );
- void onNotifyError( FmOperationBase* operationBase, int error, QString errString );
- void onNotifyCanceled( FmOperationBase* operationBase );
+ void onNotifyError( FmOperationBase* operationBase, int error, const QString &errString );
+
private slots:
void onProgressCancelled();
private:
--- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -19,151 +19,196 @@
#include "fmoperationservice.h"
#include "fmoperationthread.h"
#include "fmbackupconfigloader.h"
-#include "fmbackuprestorehandler.h"
#include "fmbkupengine.h"
+#include "fmbackupsettings.h"
#include "fmviewdetailsdialog.h"
#include "fmoperationresultprocesser.h"
-#include "fmoperationcopy.h"
-#include "fmoperationmove.h"
+#include "fmoperationcopyormove.h"
#include "fmoperationremove.h"
#include "fmoperationformat.h"
-
+#include "fmoperationviewdetails.h"
+#include "fmbackuprestorehandler.h"
#include <hbaction.h>
-#include <hbmessagebox.h>
+
+/* \fn void driveSpaceChanged( FmOperationBase* operationBase )
+ * This signal is emitted when disk size changed.
+ */
+
+/* \fn void notifyWaiting( FmOperationBase* operationBase, bool cancelable )
+ * This signal is emitted when the operation emits notifyWaiting.
+ */
+
+/* \fn void notifyPreparing( FmOperationBase* operationBase, bool cancelable )
+ * This signal is emitted when the operation emits notifyPreparing.
+ */
+
+/* \fn void notifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps )
+ * This signal is emitted when the operation emits notifyStart.
+ */
+/* \fn void notifyProgress( FmOperationBase* operationBase, int currentStep )
+ * This signal is emitted when the operation emits notifyProgress.
+ */
+
+/* \fn void notifyFinish( FmOperationBase* operationBase )
+ * This signal is emitted when the operation emits notifyFinish.
+ */
+
+/* \fn void notifyError( FmOperationBase* operationBase, int error, QString errString )
+ * This signal is emitted when the operation emits notifyError.
+ */
+
+/* \fn void notifyCanceled( FmOperationBase* operationBase )
+ * This signal is emitted when the operation emits notifyCanceled.
+ */
+
+/*
+ * Constructs one operation Service with \a parent.
+ */
FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ),
- mCurrentOperation( 0 )
+ mCurrentOperation( 0 ), mBackupRestoreHandler( 0 )
{
mThread = new FmOperationThread( this );
mThread->setObjectName( "operationThread" );
- mBackupRestoreHandler = new FmBackupRestoreHandler( this );
- mBackupRestoreHandler->setObjectName( "backupRestore" ) ;
-
mOperationResultProcesser = new FmOperationResultProcesser( this );
QMetaObject::connectSlotsByName( this );
}
+/*
+ * Destructs the operation service.
+ */
FmOperationService::~FmOperationService()
{
- delete mThread;
-
+ delete mThread;
+ mThread = 0;
delete mBackupRestoreHandler;
-
+ mBackupRestoreHandler = 0;
}
+/*
+ * Returns true if the thread is running, false if not.
+ */
bool FmOperationService::isRunning()
{
- if( mCurrentOperation ) {
- return true;
- } else {
- return false;
- }
-
+ return mThread->isRunning();
}
-int FmOperationService::asyncCopy( QStringList sourceList, QString targetPath )
-{
- if ( isRunning() )
- return FmErrAlreadyStarted;
- Q_ASSERT( !mCurrentOperation );
-
- if( sourceList.empty() ) {
- return FmErrWrongParam;
- }
- mCurrentOperation = new FmOperationCopy( mThread, sourceList, targetPath );
-
- int ret = mThread->asyncCopy( mCurrentOperation );
- if( ret != FmErrNone ) {
+/*
+ * Copies the file or foler \a targetPath asynchronously.
+ */
+int FmOperationService::asyncCopy( const QStringList &sourceList, const QString &targetPath )
+{
+ Q_ASSERT( !mCurrentOperation );
+ mCurrentOperation = new FmOperationCopyOrMove( this, FmOperationService::EOperationTypeCopy, sourceList, targetPath );
+ connectSignalsAndSlots( mCurrentOperation );
+ int ret = mThread->prepareOperationAndStart( mCurrentOperation );
+ if ( ret!= FmErrNone ) {
resetOperation();
- }
- return ret;
+ return ret;
+ }
+ return FmErrNone;
}
-int FmOperationService::asyncMove( QStringList sourceList, QString targetPath )
+/*
+ * Moves the file or foler \a sourceList to \a targetPath asynchronously.
+ */
+int FmOperationService::asyncMove( const QStringList &sourceList, const QString &targetPath )
{
- if ( isRunning() )
- return FmErrAlreadyStarted;
Q_ASSERT( !mCurrentOperation );
- if( sourceList.empty() ) {
- return FmErrWrongParam;
- }
- mCurrentOperation = new FmOperationMove( mThread, sourceList, targetPath );
-
- int ret = mThread->asyncMove( mCurrentOperation );
- if( ret != FmErrNone ) {
+ mCurrentOperation = new FmOperationCopyOrMove( this, FmOperationService::EOperationTypeMove, sourceList, targetPath );
+ connectSignalsAndSlots( mCurrentOperation );
+ int ret = mThread->prepareOperationAndStart( mCurrentOperation );
+ if ( ret!= FmErrNone ) {
resetOperation();
- }
- return ret;
+ return ret;
+ }
+ return FmErrNone;
}
-int FmOperationService::asyncRemove( QStringList pathList )
+/*
+ * Removes the file or dir \a pathList asynchronously.
+ */
+int FmOperationService::asyncRemove( const QStringList &pathList )
{
- if ( isRunning() )
- return FmErrAlreadyStarted;
Q_ASSERT( !mCurrentOperation );
- mCurrentOperation = new FmOperationRemove( mThread, pathList );
-
- int ret = mThread->asyncRemove( mCurrentOperation );
- if( ret != FmErrNone ) {
+ mCurrentOperation = new FmOperationRemove( this, pathList );
+ connectSignalsAndSlots( mCurrentOperation );
+ int ret = mThread->prepareOperationAndStart( mCurrentOperation );
+ if ( ret!= FmErrNone ) {
resetOperation();
- }
- return ret;
+ return ret;
+ }
+ return FmErrNone;
}
-int FmOperationService::asyncFormat( QString driverName )
+/*
+ * Formats the drive \a driverName asynchronously.
+ */
+int FmOperationService::asyncFormat( const QString &driverName )
{
- if ( isRunning() )
- return FmErrAlreadyStarted;
Q_ASSERT( !mCurrentOperation );
- mCurrentOperation = new FmOperationFormat( mThread, driverName );
-
- int ret = mThread->asyncFormat( mCurrentOperation );
- if( ret != FmErrNone ) {
+ mCurrentOperation = new FmOperationFormat( this, driverName );
+ connectSignalsAndSlots( mCurrentOperation );
+ int ret = mThread->prepareOperationAndStart( mCurrentOperation );
+ if ( ret!= FmErrNone ) {
resetOperation();
- }
- return ret;
-}
-int FmOperationService::asyncViewDriveDetails( const QString driverName )
-{
- if ( isRunning() )
- return FmErrAlreadyStarted;
- Q_ASSERT( !mCurrentOperation );
-
- mCurrentOperation = new FmOperationDriveDetails( mThread, driverName );
-
- int ret = mThread->asyncViewDriveDetails( mCurrentOperation );
- if( ret != FmErrNone ) {
- resetOperation();
- }
- return ret;
+ return ret;
+ }
+ return FmErrNone;
}
-int FmOperationService::asyncViewFolderDetails( const QString folderPath )
+/*
+ * Views drive \a driverName details asynchronously.
+ */
+int FmOperationService::asyncViewDriveDetails( const QString &driverName )
{
- if ( isRunning() )
- return FmErrAlreadyStarted;
Q_ASSERT( !mCurrentOperation );
-
- mCurrentOperation = new FmOperationFolderDetails( mThread, folderPath );
-
- int ret = mThread->asyncViewFolderDetails( mCurrentOperation );
- if( ret != FmErrNone ) {
+
+ mCurrentOperation = new FmOperationDriveDetails( this, driverName );
+ connectSignalsAndSlots( mCurrentOperation );
+ int ret = mThread->prepareOperationAndStart( mCurrentOperation );
+ if ( ret!= FmErrNone ) {
resetOperation();
- }
- return ret;
+ return ret;
+ }
+ return FmErrNone;
}
+/*
+ * Views folder \a folderPath details asynchronously.
+ */
+int FmOperationService::asyncViewFolderDetails( const QString &folderPath )
+{
+ Q_ASSERT( !mCurrentOperation );
+
+ mCurrentOperation = new FmOperationFolderDetails( this, folderPath );
+ connectSignalsAndSlots( mCurrentOperation );
+ int ret = mThread->prepareOperationAndStart( mCurrentOperation );
+ if ( ret!= FmErrNone ) {
+ resetOperation();
+ return ret;
+ }
+ return FmErrNone;
+}
+
+/*
+ * Backups asynchronously.
+ */
int FmOperationService::asyncBackup()
{
if ( isRunning() )
return FmErrAlreadyStarted;
Q_ASSERT( !mCurrentOperation );
- FmOperationBackup *operationBackup = new FmOperationBackup( mBackupRestoreHandler );
+ // BackupSettingsL will not leave, coding convention will be improvied in another task.
+ QString targetDrive( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->availableTargetDrive() );
+ quint32 content( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->content() );
+ FmOperationBackup *operationBackup =
+ new FmOperationBackup( backupRestoreHandler(), targetDrive, content );
mCurrentOperation = operationBackup;
int ret = backupRestoreHandler()->startBackup( operationBackup );
if( ret ){
@@ -174,6 +219,10 @@
}
}
+/*
+ * Restores asynchronously.
+ * \a selection selected restore items
+ */
int FmOperationService::asyncRestore( quint64 selection )
{
if ( isRunning() )
@@ -191,11 +240,18 @@
}
}
+/*
+ * Delete backup synchronously.
+ * \a selection selected backup items
+ */
int FmOperationService::syncDeleteBackup( quint64 selection )
{
- return mBackupRestoreHandler->deleteBackup( selection );
+ return backupRestoreHandler()->deleteBackup( selection );
}
+/*
+ * Cancels current operation.
+ */
void FmOperationService::cancelOperation()
{
switch( mCurrentOperation->operationType() )
@@ -226,7 +282,9 @@
}
}
-
+/*
+ * Set valume synchronously. not used.
+ */
int FmOperationService::syncSetVolume( const QString &driverName, const QString &volume )
{
Q_UNUSED( driverName );
@@ -234,6 +292,9 @@
return FmErrNone;
}
+/*
+ * Set drive password synchronously. not used.
+ */
int FmOperationService::syncSetdDriverPassword( const QString &driverName,
const QString &oldPassword,
const QString &newPassword )
@@ -244,6 +305,9 @@
return FmErrNone;
}
+/*
+ * Rename synchronously. not used.
+ */
int FmOperationService::syncRename( const QString &oldPath, const QString &newName )
{
Q_UNUSED( oldPath );
@@ -251,22 +315,30 @@
return FmErrNone;
}
+/*
+ * Launches the file in synchronous way.
+ */
int FmOperationService::syncLaunchFileOpen( const QString &filePath )
{
return FmUtils::launchFile( filePath );
}
-
-
+/*
+ * Returns the backup handler.
+ */
FmBackupRestoreHandler *FmOperationService::backupRestoreHandler()
{
if( !mBackupRestoreHandler ) {
- mBackupRestoreHandler = new FmBackupRestoreHandler( this );
+ mBackupRestoreHandler = new FmBackupRestoreHandler( this );
+ mBackupRestoreHandler->setObjectName( "backupRestore" ) ;
QMetaObject::connectSlotsByName( this );
}
return mBackupRestoreHandler;
}
+/*
+ * Deletes the operation and set it to be 0.
+ */
void FmOperationService::resetOperation()
{
if( mCurrentOperation ) {
@@ -275,109 +347,201 @@
}
}
-/////////////////////////////////////////////////////
-///Thread
-void FmOperationService::on_operationThread_askForRename( const QString &srcFile, QString *destFile )
+/*
+ * Connects \a operation's sinals to slots
+ */
+void FmOperationService::connectSignalsAndSlots( FmOperationBase *operation )
+{
+
+ connect( operation, SIGNAL( showNote( QString ) ),
+ this, SLOT( on_operation_showNote( QString )), Qt::BlockingQueuedConnection );
+ connect( operation, SIGNAL( notifyError( int, QString ) ),
+ this, SLOT( on_operation_notifyError( int, QString ) ) );
+ connect( operation, SIGNAL( notifyStart( bool, int ) ),
+ this, SLOT( on_operation_notifyStart( bool, int ) ) );
+ connect( operation, SIGNAL( notifyProgress( int ) ),
+ this, SLOT( on_operation_notifyProgress( int ) ) );
+ connect( operation, SIGNAL( notifyFinish() ),
+ this, SLOT( on_operation_notifyFinish()) );
+ connect( operation, SIGNAL( notifyWaiting( bool ) ),
+ this, SLOT( on_operation_notifyWaiting( bool )) );
+
+}
+
+/*
+ * Responds to mCurrentOperation's askForRename signal.
+ * \a srcFile the source file.
+ * \a destFile the new file name.
+ */
+void FmOperationService::on_operation_askForRename( const QString &srcFile, QString *destFile )
{
mOperationResultProcesser->onAskForRename(
mCurrentOperation, srcFile, destFile );
}
-void FmOperationService::on_operationThread_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted )
+/*
+ * Responds to mCurrentOperation's askForReplace signal.
+ * \a srcFile the source file.
+ * \a destFile the target file.
+ * \a isAccepted whether to replace the target file.
+ */
+void FmOperationService::on_operation_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted )
{
mOperationResultProcesser->onAskForReplace(
mCurrentOperation, srcFile, destFile, isAccepted );
}
-void FmOperationService::on_operationThread_refreshModel( const QString &path )
+/*
+ * Responds to mCurrentOperation's showNote signal.
+ * \a noteString the note content.
+ */
+void FmOperationService::on_operation_showNote( const char *noteString )
{
- emit refreshModel( mCurrentOperation, path );
+ mOperationResultProcesser->onShowNote( mCurrentOperation, noteString );
}
-void FmOperationService::on_operationThread_notifyWaiting( bool cancelable )
+
+/*
+ * Responds to mCurrentOperation's showNote signal.
+ * \a noteString the note content.
+ */
+void FmOperationService::on_operation_notifyWaiting( bool cancelable )
{
mOperationResultProcesser->onNotifyWaiting(
mCurrentOperation, cancelable );
emit notifyWaiting( mCurrentOperation, cancelable );
}
-void FmOperationService::on_operationThread_notifyPreparing( bool cancelable )
+
+/*
+ * Responds to mCurrentOperation's notifyPreparing signal.
+ * \a cancelable indicates whether the progress bar could be cancelled.
+ */
+void FmOperationService::on_operation_notifyPreparing( bool cancelable )
{
mOperationResultProcesser->onNotifyPreparing(
mCurrentOperation, cancelable );
emit notifyPreparing( mCurrentOperation, cancelable );
}
-void FmOperationService::on_operationThread_notifyStart( bool cancelable, int maxSteps )
+
+/*
+ * Responds to mCurrentOperation's notifyPreparing signal.
+ * \a cancelable indicates whether the progress bar could be cancelled.
+ * \maxSteps the length of progress bar.
+ */
+void FmOperationService::on_operation_notifyStart( bool cancelable, int maxSteps )
{
mOperationResultProcesser->onNotifyStart(
mCurrentOperation, cancelable, maxSteps );
emit notifyStart( mCurrentOperation, cancelable, maxSteps );
}
-void FmOperationService::on_operationThread_notifyProgress( int currentStep )
+
+/*
+ * Responds to mCurrentOperation's notifyPreparing signal.
+ * \a currentStep indicates the current length of progress bar.
+ */
+void FmOperationService::on_operation_notifyProgress( int currentStep )
{
mOperationResultProcesser->onNotifyProgress(
mCurrentOperation, currentStep );
emit notifyProgress( mCurrentOperation, currentStep );
}
-void FmOperationService::on_operationThread_notifyFinish()
+
+/*
+ * Responds to mCurrentOperation's notifyFinish signal, indicate the
+ * progress is over.
+ */
+void FmOperationService::on_operation_notifyFinish()
{
mOperationResultProcesser->onNotifyFinish( mCurrentOperation );
emit notifyFinish( mCurrentOperation );
resetOperation();
}
-void FmOperationService::on_operationThread_notifyError(int error, QString errString )
+
+/*
+ * Responds to mCurrentOperation's notifyError signal.
+ * \a error error id.
+ * \a errString the error string.
+ */
+void FmOperationService::on_operation_notifyError(int error, QString errString )
{
mOperationResultProcesser->onNotifyError(
mCurrentOperation, error, errString );
emit notifyError( mCurrentOperation, error, errString );
resetOperation();
}
-void FmOperationService::on_operationThread_notifyCanceled()
+
+/*
+ * Responds to mCurrentOperation's driveSpaceChanged
+ */
+void FmOperationService::on_operation_driveSpaceChanged()
{
- mOperationResultProcesser->onNotifyCanceled(
- mCurrentOperation );
- emit notifyCanceled( mCurrentOperation );
- resetOperation();
+ emit driveSpaceChanged( mCurrentOperation );
}
-///
-/////////////////////////////////////////////////////
-/////////////////////////////////////////////////////
-///BackupRestore
+/*
+ * Responds to mBackupRestoreHandler's notifyPreparing
+ * \a cancelable indicates whether it could be cancelled.
+ */
void FmOperationService::on_backupRestore_notifyPreparing( bool cancelable )
{
mOperationResultProcesser->onNotifyPreparing(
mCurrentOperation, cancelable );
emit notifyPreparing( mCurrentOperation, cancelable );
}
+
+/*
+ * Responds to mBackupRestoreHandler's notifyStart
+ * \a cancelable indicates whether it could be cancelled.
+ * \a maxSteps the lenth of progress bar.
+ */
void FmOperationService::on_backupRestore_notifyStart( bool cancelable, int maxSteps )
{
mOperationResultProcesser->onNotifyStart(
mCurrentOperation, cancelable, maxSteps );
emit notifyStart( mCurrentOperation, cancelable, maxSteps );
}
+
+/*
+ * Responds to mBackupRestoreHandler's notifyProgress
+ * \a currentStep the current progress bar's step.
+ */
void FmOperationService::on_backupRestore_notifyProgress( int currentStep )
{
mOperationResultProcesser->onNotifyProgress(
mCurrentOperation, currentStep );
emit notifyProgress( mCurrentOperation, currentStep );
}
+
+/*
+ * Responds to mBackupRestoreHandler's notifyFinish
+ */
void FmOperationService::on_backupRestore_notifyFinish()
{
mOperationResultProcesser->onNotifyFinish( mCurrentOperation );
emit notifyFinish( mCurrentOperation );
resetOperation();
}
-void FmOperationService::on_backupRestore_notifyError(int error, QString errString )
+
+/*
+ * Responds to mBackupRestoreHandler's notifyError
+ * \a error the error id.
+ * \a errString the error string.
+ */
+void FmOperationService::on_backupRestore_notifyError(int error, const QString &errString )
{
mOperationResultProcesser->onNotifyError(
mCurrentOperation, error, errString );
emit notifyError( mCurrentOperation, error, errString );
resetOperation();
}
+
+/*
+ * Responds to mBackupRestoreHandler's notifyCanceled
+ */
void FmOperationService::on_backupRestore_notifyCanceled()
{
- mOperationResultProcesser->onNotifyCanceled(
- mCurrentOperation );
- emit notifyCanceled( mCurrentOperation );
+ mOperationResultProcesser->onNotifyError(
+ mCurrentOperation, FmErrCancel, QString() );
+ emit notifyError( mCurrentOperation, FmErrCancel, QString() );
resetOperation();
}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Tue Aug 24 10:24:14 2010 +0800
@@ -57,17 +57,17 @@
//return error if any path exist.
//renturn error if list count is not as the same the other.
- int asyncCopy( QStringList sourceList, QString targetPath );
+ int asyncCopy( const QStringList &sourceList, const QString &targetPath );
- int asyncMove( QStringList sourceList, QString targetPath );
+ int asyncMove( const QStringList &sourceList, const QString &targetPath );
- int asyncRemove( QStringList pathList );
+ int asyncRemove( const QStringList &pathList );
//return error if can not be format.
//notify error while format error.
- int asyncFormat( QString driverName );
- int asyncViewDriveDetails( const QString driverName );
- int asyncViewFolderDetails( const QString folderPath );
+ int asyncFormat( const QString &driverName );
+ int asyncViewDriveDetails( const QString &driverName );
+ int asyncViewFolderDetails( const QString &folderPath );
int asyncBackup();
int asyncRestore( quint64 selection );
@@ -89,23 +89,22 @@
void on_backupRestore_notifyStart( bool cancelable, int maxSteps );
void on_backupRestore_notifyProgress( int currentStep );
void on_backupRestore_notifyFinish();
- void on_backupRestore_notifyError(int error, QString errString );
+ void on_backupRestore_notifyError(int error, const QString &errString );
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 );
- void on_operationThread_notifyStart( bool cancelable, int maxSteps );
- void on_operationThread_notifyProgress( int currentStep );
- void on_operationThread_notifyFinish();
- void on_operationThread_notifyError(int error, QString errString );
- void on_operationThread_notifyCanceled();
+ void on_operation_askForRename( const QString &srcFile, QString *destFile );
+ void on_operation_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted );
+ void on_operation_showNote( const char *noteString );
+ void on_operation_notifyWaiting( bool cancelable );
+ void on_operation_notifyPreparing( bool cancelable );
+ void on_operation_notifyStart( bool cancelable, int maxSteps );
+ void on_operation_notifyProgress( int currentStep );
+ void on_operation_notifyFinish();
+ void on_operation_notifyError(int error, QString errString );
+ void on_operation_driveSpaceChanged();
signals:
-// void askForRename( FmOperationBase* operationBase, const QString &srcFile, QString &destFile );
- void refreshModel( FmOperationBase* operationBase, const QString& filePath );
+
+ void driveSpaceChanged( FmOperationBase* operationBase );
void notifyWaiting( FmOperationBase* operationBase, bool cancelable );
void notifyPreparing( FmOperationBase* operationBase, bool cancelable ); // this step could not be used if not needed.
@@ -118,6 +117,7 @@
private:
void resetOperation();
+ void connectSignalsAndSlots( FmOperationBase *operation );
private:
FmOperationThread *mThread;
--- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -17,276 +17,59 @@
*/
#include "fmoperationthread.h"
-#include "fmoperationbase.h"
-#include "fmdrivedetailstype.h"
-#include "fmcommon.h"
-#include "fmoperationcopy.h"
-#include "fmoperationmove.h"
-#include "fmoperationremove.h"
-#include "fmoperationformat.h"
+#include "fmbackuprestorehandler.h"
#include <QDir>
#include <QStack>
-FmOperationThread::FmOperationThread( QObject *parent ) : QThread( parent ), mOperationBase( 0 )
+/*
+ * Constructs the operation thread with \a parent.
+ */
+FmOperationThread::FmOperationThread( QObject *parent ) : QThread( parent ),
+ mStop( false), mOperationBase( 0 )
{
-
-
+ setPriority( LowestPriority );
}
+/*
+ * Destructs the operation thread.
+ */
FmOperationThread::~FmOperationThread()
{
}
-int FmOperationThread::asyncCopy( FmOperationBase* operationBase )
-{
- if( isRunning() ){
- return FmErrAlreadyStarted;
+/*
+ * Prepare some conditions before starts the operation.
+ * Returns the error id.
+ * \a operationBase the operation to be prepared.
+ */
+int FmOperationThread::prepareOperationAndStart( FmOperationBase* operationBase )
+{
+ if ( isRunning() ) {
+ return FmErrAlreadyStarted;
}
-
mOperationBase = operationBase;
- mOperationBase->setObjectName( "operationElement" );
- 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;
-}
-
-int FmOperationThread::asyncMove( FmOperationBase* operationBase )
-{
- if( isRunning() ){
- return FmErrAlreadyStarted;
- }
-
- mOperationBase = operationBase;
- mOperationBase->setObjectName( "operationElement" );
- 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;
+ int ret = mOperationBase->prepare();
+ if ( ret == FmErrNone ) {
+ mStop = false;
+ start();
+ }
+ return ret;
}
-int FmOperationThread::asyncRemove( FmOperationBase* operationBase )
-{
- if( isRunning() ){
- return FmErrAlreadyStarted;
- }
-
- mOperationBase = operationBase;
- mOperationBase->setObjectName( "operationElement" );
- QMetaObject::connectSlotsByName( this );
-
- start();
- return FmErrNone;
-}
-
-int FmOperationThread::asyncFormat( FmOperationBase* operationBase )
-{
- if( isRunning() ){
- return FmErrAlreadyStarted;
- }
-
- mOperationBase = operationBase;
- mOperationBase->setObjectName( "operationElement" );
- QMetaObject::connectSlotsByName( this );
-
- start();
- return FmErrNone;
-}
-int FmOperationThread::asyncViewDriveDetails( FmOperationBase* operationBase )
-{
- if( isRunning() ){
- return FmErrAlreadyStarted;
- }
-
- mOperationBase = operationBase;
- mOperationBase->setObjectName( "operationElement" );
- QMetaObject::connectSlotsByName( this );
-
- start();
- return FmErrNone;
-}
-
-int FmOperationThread::asyncViewFolderDetails( FmOperationBase* operationBase )
-{
- if( isRunning() ){
- return FmErrAlreadyStarted;
- }
-
- mOperationBase = operationBase;
- mOperationBase->setObjectName( "operationElement" );
- QMetaObject::connectSlotsByName( this );
-
- start();
- return FmErrNone;
-}
-
-
+/* Stops the current thread.
+ * Caused by user interaction.
+ */
void FmOperationThread::stop()
{
mStop = true;
}
-void FmOperationThread::onAskForRename( const QString &srcFile, QString *destFile )
-{
- 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 );
-}
-void FmOperationThread::on_operationElement_notifyStart( bool cancelable, int maxSteps )
-{
- emit notifyStart( cancelable, maxSteps );
-}
-void FmOperationThread::on_operationElement_notifyProgress( int currentStep )
-{
- emit notifyProgress( currentStep );
+/*
+ * reimp
+ */
+void FmOperationThread::run()
+{
+ mOperationBase->start( &mStop );
}
-void FmOperationThread::run()
-{
- mStop = false;
- this->setPriority( LowestPriority );
- switch( mOperationBase->operationType() )
- {
- case FmOperationService::EOperationTypeCopy:
- {
- mErrString.clear();
- FmOperationCopy *operationCopy = static_cast<FmOperationCopy*>(mOperationBase);
-
- int ret = operationCopy->start( &mStop, &mErrString );
- switch( ret )
- {
- case FmErrCancel:
- emit notifyCanceled();
- break;
- case FmErrNone:
- emit notifyFinish();
- break;
- default:
- emit notifyError( ret, mErrString );
- break;
- }
- // refresh driveview no care if cancel, error or finished.
- emit refreshModel( QString("") );
- break;
- }
- case FmOperationService::EOperationTypeMove:
- {
- mErrString.clear();
- FmOperationMove *operationMove = static_cast<FmOperationMove*>(mOperationBase);
-
- QString refreshSrcPath = QFileInfo( operationMove->sourceList().front() ).dir().absolutePath();
-
- int ret = operationMove->start( &mStop, &mErrString );
- switch( ret )
- {
- case FmErrCancel:
- emit notifyCanceled();
- break;
- case FmErrNone:
- emit notifyFinish();
- emit refreshModel( refreshSrcPath );
- emit refreshModel( operationMove->targetPath() );
- break;
- default:
- emit notifyError( ret, mErrString );
- }
- // refresh driveview no care if cancel, error or finished.
- emit refreshModel( QString("") );
- break;
- }
- case FmOperationService::EOperationTypeRemove:
- {
- mErrString.clear();
- FmOperationRemove *operationRemove = static_cast<FmOperationRemove*>(mOperationBase);
-
- QString refreshSrcPath = QFileInfo( operationRemove->pathList().front() ).dir().absolutePath();
-
- int ret = operationRemove->start( &mStop, &mErrString );
- switch( ret )
- {
- case FmErrCancel:
- emit notifyCanceled();
- break;
- case FmErrNone:
- emit notifyFinish();
- break;
- default:
- emit notifyError( ret, mErrString );
- }
- // refresh driveview no care if cancel, error or finished.
- emit refreshModel( QString("") );
- break;
- }
- case FmOperationService::EOperationTypeFormat:
- {
-// emit notifyWaiting( false );
- FmLogger::log(QString("start format"));
- FmOperationFormat *operationFormat = static_cast<FmOperationFormat*>( mOperationBase );
- FmLogger::log(QString("get param and start format"));
-
- QString refreshSrcPath = operationFormat->driverName();
-// if ( FmErrNone != FmUtils::formatDrive( operationFormat->driverName() ) ) {
- if ( FmErrNone != operationFormat->start() ) {
- emit notifyError( FmErrTypeFormatFailed, operationFormat->driverName() );
- return;
- }
- FmLogger::log(QString("format done"));
- emit notifyFinish();
- emit refreshModel( refreshSrcPath );
- FmLogger::log(QString("format done and emit finish"));
- break;
- }
- case FmOperationService::EOperationTypeDriveDetails:
- {
- emit notifyWaiting( true );
-
- FmOperationDriveDetails *operationDriverDetails = static_cast<FmOperationDriveDetails*>( mOperationBase );
- int ret = FmDriveDetailsContent::querySizeofContent(
- operationDriverDetails->driverName(), operationDriverDetails->detailsSizeList(), &mStop );
- if( ret == FmErrNone ) {
- emit notifyFinish();
- } else if( ret == FmErrCancel ) {
- emit notifyCanceled();
- }
-
- break;
- }
- case FmOperationService::EOperationTypeFolderDetails:
- {
- emit notifyWaiting( true );
-
- FmOperationFolderDetails *operationFolderDetails = static_cast<FmOperationFolderDetails*>( mOperationBase );
- int ret = FmFolderDetails::getNumofSubfolders( operationFolderDetails->folderPath(), operationFolderDetails->numofSubFolders(),
- operationFolderDetails->numofFiles(), operationFolderDetails->sizeofFolder(),
- &mStop );
- if( ret == FmErrNone ) {
- emit notifyFinish();
- } else if( ret == FmErrCancel ) {
- emit notifyCanceled();
- }
-
- break;
-
- }
- default:
- Q_ASSERT( false );
-
- }
-}
-
--- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Tue Aug 24 10:24:14 2010 +0800
@@ -19,7 +19,7 @@
#ifndef FMOPERATIONTHREAD_H
#define FMOPERATIONTHREAD_H
-#include "fmoperationservice.h"
+#include "fmoperationbase.h"
#include "fmcommon.h"
#include <QString>
@@ -27,49 +27,14 @@
#include <QThread>
-class FmDriveDetailsSize;
-class FmOperationBase;
-
-class FmOperationCopy;
-class FmOperationMove;
-class FmOperationRemove;
-
class FmOperationThread : public QThread
{
Q_OBJECT
public:
FmOperationThread( QObject *parent );
~FmOperationThread();
-
- int asyncCopy( FmOperationBase* operationBase );
- int asyncMove( FmOperationBase *operationBase );
- int asyncRemove( FmOperationBase *operationBase );
-
- int asyncFormat( FmOperationBase *operationBase );
- int asyncViewDriveDetails( FmOperationBase *operationBase );
- int asyncViewFolderDetails( FmOperationBase *operationBase );
- void stop();
-
-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 );
- void notifyPreparing( bool cancelable ); // this step could not be used if not needed.
- void notifyStart( bool cancelable, int maxSteps );
- void notifyProgress( int currentStep );
-
- void notifyFinish();
- void notifyError(int error, QString errString );
- void notifyCanceled();
-
-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 );
+ int prepareOperationAndStart( FmOperationBase* operationBase );
+ void stop();
protected:
void run();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationviewdetails.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,143 @@
+/*
+* 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 the operation param of file manager
+*
+*/
+
+#include "fmoperationviewdetails.h"
+#include "fmdrivedetailstype.h"
+#include <QtAlgorithms>
+
+/*
+ * Constructs one view drive details operation with
+ * \a parent parent.
+ * \a driverName the drive name.
+ */
+FmOperationDriveDetails::FmOperationDriveDetails( QObject *parent, const QString &driverName ) :
+ FmOperationBase( parent, FmOperationService::EOperationTypeDriveDetails ),
+ mDriverName( driverName ), mStop( 0 )
+{
+}
+
+/*
+ * Destructs the operation.
+ */
+FmOperationDriveDetails::~FmOperationDriveDetails()
+{
+ qDeleteAll(mDetailsSizeList);
+}
+
+/*
+ * Returns the drive name.
+ */
+QString FmOperationDriveDetails::driverName()
+{
+ return mDriverName;
+}
+
+/*
+ * reimp.
+ */
+void FmOperationDriveDetails::start( volatile bool *isStopped )
+{
+ mStop = isStopped;
+ emit notifyWaiting( true );
+ //FmOperationDriveDetails *operationDriverDetails = static_cast<FmOperationDriveDetails*>( mOperationBase );
+ int ret = FmDriveDetailsContent::querySizeofContent( driverName(), detailsSizeList(), mStop );
+ if( ret == FmErrNone ) {
+ emit notifyFinish();
+ } else {
+ emit notifyError( ret, QString() );
+ }
+}
+
+/*
+ * Returns detail items size list.
+ */
+QList<FmDriveDetailsSize*> &FmOperationDriveDetails::detailsSizeList()
+{
+ return mDetailsSizeList;
+}
+
+/*
+ * Constructs one view folder details operation with
+ * \a parent parent.
+ * \a driverName the drive name.
+ */
+FmOperationFolderDetails::FmOperationFolderDetails( QObject *parent, const QString &folderPath ) :
+ FmOperationBase( parent, FmOperationService::EOperationTypeFolderDetails ),
+ mFolderPath( folderPath ),
+ mNumofSubFolders( 0 ),
+ mNumofFiles( 0 ),
+ mSizeofFolder( 0 )
+
+{
+}
+
+/*
+ * Destructs the operation.
+ */
+FmOperationFolderDetails::~FmOperationFolderDetails()
+{
+
+}
+
+/*
+ * Returns the folder path.
+ */
+QString FmOperationFolderDetails::folderPath()
+{
+ return mFolderPath;
+}
+
+/*
+ * Returns the number of sub folders.
+ */
+int &FmOperationFolderDetails::numofSubFolders()
+{
+ return mNumofSubFolders;
+}
+
+/*
+ * Returns the number of files
+ */
+int &FmOperationFolderDetails::numofFiles()
+{
+ return mNumofFiles;
+}
+
+/*
+ * Returns the size of folder.
+ */
+quint64 &FmOperationFolderDetails::sizeofFolder()
+{
+ return mSizeofFolder;
+}
+
+/*
+ * Reimp.
+ */
+void FmOperationFolderDetails::start( volatile bool *isStopped )
+{
+ mStop = isStopped;
+ emit notifyWaiting( true );
+ int ret = FmFolderDetails::getNumofSubfolders( folderPath(), numofSubFolders(),
+ numofFiles(), sizeofFolder(), mStop );
+ if( ret == FmErrNone ) {
+ emit notifyFinish();
+ } else {
+ emit notifyError( ret, QString() );
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationviewdetails.h Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,64 @@
+/*
+* 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 FMOPERATIONVIEWDETAILS_H
+#define FMOPERATIONVIEWDETAILS_H
+
+#include "fmoperationservice.h"
+#include "fmoperationbase.h"
+
+#include <QObject>
+#include <QString>
+
+class FmOperationDriveDetails : public FmOperationBase
+{
+public:
+ explicit FmOperationDriveDetails( QObject *parent, const QString &driverName );
+
+ virtual ~FmOperationDriveDetails();
+ QString driverName();
+ virtual void start( volatile bool *isStopped );
+ QList<FmDriveDetailsSize*> &detailsSizeList();
+
+private:
+ QString mDriverName;
+ QList<FmDriveDetailsSize*> mDetailsSizeList;
+ volatile bool *mStop;
+};
+
+class FmOperationFolderDetails : public FmOperationBase
+{
+public:
+ explicit FmOperationFolderDetails( QObject *parent, const QString &folderPath );
+
+ virtual ~FmOperationFolderDetails();
+ virtual void start( volatile bool *isStopped );
+
+ QString folderPath();
+ int &numofSubFolders();
+ int &numofFiles();
+ quint64 &sizeofFolder();
+
+private:
+ QString mFolderPath;
+ int mNumofSubFolders;
+ int mNumofFiles;
+ quint64 mSizeofFolder;
+ volatile bool *mStop;
+};
+#endif
--- a/filemanager/src/fmbkupengine/inc/CMMCScBkupOperationParameters.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupengine/inc/CMMCScBkupOperationParameters.h Tue Aug 24 10:24:14 2010 +0800
@@ -39,7 +39,7 @@
_LIT( KBackUpFolder, "\\Backup\\" );
_LIT( KBackUpFiles, "*.arc" );
-
+const TInt KCArrayGranularity = 10;
class TBkupDrivesAndOperation
{
@@ -86,9 +86,9 @@
}
void ConstructL()
{
- mUids = new ( ELeave ) CArrayFixFlat<unsigned int>( 10 );
- mExclude_uids = new ( ELeave ) CArrayFixFlat<unsigned int>( 10 );
- mArchive_name = HBufC::NewL(1);
+ mUids = new ( ELeave ) CArrayFixFlat<unsigned int>( KCArrayGranularity );
+ mExclude_uids = new ( ELeave ) CArrayFixFlat<unsigned int>( KCArrayGranularity );
+ mArchive_name = 0;
}
~CBkupCategory()
@@ -105,8 +105,11 @@
void setArchive_name( TDesC16& archive_name )
{
- delete mArchive_name;
- mArchive_name = HBufC::NewL( archive_name.Length() );
+ if ( mArchive_name != 0 )
+ {
+ delete mArchive_name;
+ }
+ TRAP_IGNORE( mArchive_name = HBufC::NewL( archive_name.Length() ) );
*mArchive_name = archive_name;
}
@@ -122,12 +125,12 @@
void addUids( unsigned int uid )
{
- mUids->AppendL( uid, sizeof(unsigned int));
+ TRAP_IGNORE( mUids->AppendL( uid, sizeof(unsigned int) ) );
}
void addExclude_uids( unsigned int exclude_uid )
{
- mExclude_uids->AppendL( exclude_uid, sizeof(unsigned int) );
+ TRAP_IGNORE( mExclude_uids->AppendL( exclude_uid, sizeof(unsigned int) ) );
}
unsigned int category() { return mCategory; }
--- a/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateArchiveOpPublicDataFiles.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -373,8 +373,7 @@
// progress info. See CMMCScBkupStateRequestListOfPublicFiles::PerformLastRightsL()
// for the point when the public data size is zeroed.
- // First, find the associated data owner.
- CMMCScBkupDataOwnerInfo& owner = dataOwners.OwnerL( fileInfo.SecureId() );
+
__LOG3("CMMCScBkupStateArchiveOpPublicDataFiles::AddIndexRecordL() - offset: %6d, length: %6d, file: %S", info.Offset(), info.Length(), &fileInfo.FileName());
--- a/filemanager/src/fmbkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupengine/src/CMMCScBkupStateValidateDiskSpace.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -188,18 +188,18 @@
// Calculate the total progress required for the entire backup operation
uncompressedSize = dataOwners.TotalOperationalSizeL();
__LOG1("CMMCScBkupStateValidateDiskSpace::ValidateFreeSpaceBeforeBackupL() - Total estimated uncompressed size for archive %Ld", uncompressedSize);
- const TInt ownerCount = dataOwners.Count();
+ //const TInt ownerCount = dataOwners.Count();
- for( TInt i=0; i<ownerCount; i++ )
- {
- CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( i );
+ //for( TInt i=0; i<ownerCount; i++ )
+ // {
+ // CMMCScBkupDataOwnerInfo& owner = dataOwners.Owner( i );
// Reset the size of public data to 0. We update this value
// with the compressed size during the compression stage. This
// is needed in order to create accurate restore information (since
// all of the data owner sizing info is written to disk).
// owner.ResetOperationalSize( EMMCScBkupOwnerDataTypePublicData );
- }
-
+ // }
+
// Let's check do public files fit in target drive
TInt driveNumber;
TDriveInfo driveInfo;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/fmbkupenginewrapper/bwins/fmbkupenginewrapperu.def Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,69 @@
+EXPORTS
+ ??0FmRestoreSettings@@QAE@AAVFmBkupEngine@@@Z @ 1 NONAME ; FmRestoreSettings::FmRestoreSettings(class FmBkupEngine &)
+ ?tr@FmBkupEngine@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString FmBkupEngine::tr(char const *, char const *)
+ ?getStaticMetaObject@FmBkupEngine@@SAABUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const & FmBkupEngine::getStaticMetaObject(void)
+ ?trUtf8@FmBkupEngine@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString FmBkupEngine::trUtf8(char const *, char const *, int)
+ ?error@FmBkupEngine@@QBEHXZ @ 5 NONAME ; int FmBkupEngine::error(void) const
+ ?availableTargetDrive@FmBackupSettings@@QBE?AVQString@@XZ @ 6 NONAME ; class QString FmBackupSettings::availableTargetDrive(void) const
+ ?GetSelectionL@FmRestoreSettings@@QBEXAAV?$QList@VFmRestoreInfo@@@@@Z @ 7 NONAME ; void FmRestoreSettings::GetSelectionL(class QList<class FmRestoreInfo> &) const
+ ?content@FmBackupSettings@@QBEIXZ @ 8 NONAME ; unsigned int FmBackupSettings::content(void) const
+ ?getBackupDriveList@FmBkupEngine@@QAEXAAVQStringList@@@Z @ 9 NONAME ; void FmBkupEngine::getBackupDriveList(class QStringList &)
+ ?resetAndDestoryRestoreEntry@FmRestoreSettings@@AAEXXZ @ 10 NONAME ; void FmRestoreSettings::resetAndDestoryRestoreEntry(void)
+ ?targetDriveToString@FmBackupSettings@@QAE?AVQString@@ABV2@@Z @ 11 NONAME ; class QString FmBackupSettings::targetDriveToString(class QString const &)
+ ?setScheduling@FmBackupSettings@@QAEXW4TFileManagerBackupSchedule@1@@Z @ 12 NONAME ; void FmBackupSettings::setScheduling(enum FmBackupSettings::TFileManagerBackupSchedule)
+ ?notifyFinish@FmBkupEngine@@IAEXH@Z @ 13 NONAME ; void FmBkupEngine::notifyFinish(int)
+ ?qt_metacast@FmBkupEngine@@UAEPAXPBD@Z @ 14 NONAME ; void * FmBkupEngine::qt_metacast(char const *)
+ ??0FmBackupSettings@@QAE@PAVFmBkupEngine@@@Z @ 15 NONAME ; FmBackupSettings::FmBackupSettings(class FmBkupEngine *)
+ ?SetSelection@FmRestoreSettings@@QAEXAB_K@Z @ 16 NONAME ; void FmRestoreSettings::SetSelection(unsigned long long const &)
+ ?startBackup@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@V?$QList@PAVFmBkupBackupCategory@@@@VQString@@I@Z @ 17 NONAME ; bool FmBkupEngine::startBackup(class QList<class FmBkupDrivesAndOperation *>, class QList<class FmBkupBackupCategory *>, class QString, unsigned int)
+ ?notifyMemoryLow@FmBkupEngine@@IAEXHAAH@Z @ 18 NONAME ; void FmBkupEngine::notifyMemoryLow(int, int &)
+ ?CreateEntry@FmRestoreSettings@@AAEPAVFmRestoreEntry@@ABVFmRestoreInfo@@@Z @ 19 NONAME ; class FmRestoreEntry * FmRestoreSettings::CreateEntry(class FmRestoreInfo const &)
+ ?startRestore@FmBkupEngine@@QAE_NV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 20 NONAME ; bool FmBkupEngine::startRestore(class QList<class FmBkupDrivesAndOperation *>)
+ ?resetAndDestoryBackupEntry@FmBackupSettings@@AAEXXZ @ 21 NONAME ; void FmBackupSettings::resetAndDestoryBackupEntry(void)
+ ?weekdayToString@FmBackupSettings@@SA?AVQString@@W4TFileManagerBackupWeekday@1@@Z @ 22 NONAME ; class QString FmBackupSettings::weekdayToString(enum FmBackupSettings::TFileManagerBackupWeekday)
+ ?tr@FmBkupEngine@@SA?AVQString@@PBD0H@Z @ 23 NONAME ; class QString FmBkupEngine::tr(char const *, char const *, int)
+ ?contentToString@FmBackupSettings@@SA?AVQString@@I@Z @ 24 NONAME ; class QString FmBackupSettings::contentToString(unsigned int)
+ ?RestoreSettingsL@FmBkupEngine@@QAEPAVFmRestoreSettings@@XZ @ 25 NONAME ; class FmRestoreSettings * FmBkupEngine::RestoreSettingsL(void)
+ ?createBackupDateEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 26 NONAME ; class FmBackupEntry * FmBackupSettings::createBackupDateEntry(void)
+ ?GetRestoreInfoArray@FmBkupEngine@@QAEXAAV?$QList@PAVFmBkupDrivesAndOperation@@@@AAV?$QList@VFmRestoreInfo@@@@ABVQString@@@Z @ 27 NONAME ; void FmBkupEngine::GetRestoreInfoArray(class QList<class FmBkupDrivesAndOperation *> &, class QList<class FmRestoreInfo> &, class QString const &)
+ ?time@FmBackupSettings@@QBEABVQTime@@XZ @ 28 NONAME ; class QTime const & FmBackupSettings::time(void) const
+ ?createWeekdayEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 29 NONAME ; class FmBackupEntry * FmBackupSettings::createWeekdayEntry(void)
+ ?cancelBackup@FmBkupEngine@@QAEXXZ @ 30 NONAME ; void FmBkupEngine::cancelBackup(void)
+ ?notifyUpdate@FmBkupEngine@@IAEXH@Z @ 31 NONAME ; void FmBkupEngine::notifyUpdate(int)
+ ?save@FmBackupSettings@@QAEXXZ @ 32 NONAME ; void FmBackupSettings::save(void)
+ ??_EFmBkupEngine@@UAE@I@Z @ 33 NONAME ; FmBkupEngine::~FmBkupEngine(unsigned int)
+ ?restoreEntryList@FmRestoreSettings@@QAE?AV?$QList@PAVFmRestoreEntry@@@@XZ @ 34 NONAME ; class QList<class FmRestoreEntry *> FmRestoreSettings::restoreEntryList(void)
+ ?createTimeEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 35 NONAME ; class FmBackupEntry * FmBackupSettings::createTimeEntry(void)
+ ?weekday@FmBackupSettings@@QBE?AW4TFileManagerBackupWeekday@1@XZ @ 36 NONAME ; enum FmBackupSettings::TFileManagerBackupWeekday FmBackupSettings::weekday(void) const
+ ?deleteBackup@FmBkupEngine@@QAEHV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 37 NONAME ; int FmBkupEngine::deleteBackup(class QList<class FmBkupDrivesAndOperation *>)
+ ??1FmBackupSettings@@QAE@XZ @ 38 NONAME ; FmBackupSettings::~FmBackupSettings(void)
+ ?setTime@FmBackupSettings@@QAEXABVQTime@@@Z @ 39 NONAME ; void FmBackupSettings::setTime(class QTime const &)
+ ?backupEntryList@FmBackupSettings@@QAE?AV?$QList@PAVFmBackupEntry@@@@XZ @ 40 NONAME ; class QList<class FmBackupEntry *> FmBackupSettings::backupEntryList(void)
+ ?contentsSelected@FmBackupSettings@@ABEHXZ @ 41 NONAME ; int FmBackupSettings::contentsSelected(void) const
+ ?refreshList@FmBackupSettings@@AAEXXZ @ 42 NONAME ; void FmBackupSettings::refreshList(void)
+ ?trUtf8@FmBkupEngine@@SA?AVQString@@PBD0@Z @ 43 NONAME ; class QString FmBkupEngine::trUtf8(char const *, char const *)
+ ?CreateEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@ABVQString@@0W4TSettingType@2@@Z @ 44 NONAME ; class FmBackupEntry * FmBackupSettings::CreateEntry(class QString const &, class QString const &, enum FmBackupEntry::TSettingType)
+ ?targetDrive@FmBackupSettings@@QBE?AVQString@@XZ @ 45 NONAME ; class QString FmBackupSettings::targetDrive(void) const
+ ??0FmBkupEngine@@QAE@PAVQObject@@@Z @ 46 NONAME ; FmBkupEngine::FmBkupEngine(class QObject *)
+ ?notifyPreparing@FmBkupEngine@@IAEX_N@Z @ 47 NONAME ; void FmBkupEngine::notifyPreparing(bool)
+ ?load@FmRestoreSettings@@QAEXV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 48 NONAME ; void FmRestoreSettings::load(class QList<class FmBkupDrivesAndOperation *>)
+ ?setWeekday@FmBackupSettings@@QAEXW4TFileManagerBackupWeekday@1@@Z @ 49 NONAME ; void FmBackupSettings::setWeekday(enum FmBackupSettings::TFileManagerBackupWeekday)
+ ??1FmRestoreSettings@@QAE@XZ @ 50 NONAME ; FmRestoreSettings::~FmRestoreSettings(void)
+ ?createContentsEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 51 NONAME ; class FmBackupEntry * FmBackupSettings::createContentsEntry(void)
+ ?notifyBackupFilesExist@FmBkupEngine@@IAEXAA_N@Z @ 52 NONAME ; void FmBkupEngine::notifyBackupFilesExist(bool &)
+ ?updateBackupDate@FmBackupSettings@@QAEXXZ @ 53 NONAME ; void FmBackupSettings::updateBackupDate(void)
+ ?createSchedulingEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 54 NONAME ; class FmBackupEntry * FmBackupSettings::createSchedulingEntry(void)
+ ?metaObject@FmBkupEngine@@UBEPBUQMetaObject@@XZ @ 55 NONAME ; struct QMetaObject const * FmBkupEngine::metaObject(void) const
+ ?createTargetDriveEntry@FmBackupSettings@@AAEPAVFmBackupEntry@@XZ @ 56 NONAME ; class FmBackupEntry * FmBackupSettings::createTargetDriveEntry(void)
+ ?load@FmBackupSettings@@QAEXXZ @ 57 NONAME ; void FmBackupSettings::load(void)
+ ??1FmBkupEngine@@UAE@XZ @ 58 NONAME ; FmBkupEngine::~FmBkupEngine(void)
+ ?BackupSettingsL@FmBkupEngine@@QAEPAVFmBackupSettings@@XZ @ 59 NONAME ; class FmBackupSettings * FmBkupEngine::BackupSettingsL(void)
+ ?setContent@FmBackupSettings@@QAEXI@Z @ 60 NONAME ; void FmBackupSettings::setContent(unsigned int)
+ ?schedulingToString@FmBackupSettings@@QAE?AVQString@@W4TFileManagerBackupSchedule@1@@Z @ 61 NONAME ; class QString FmBackupSettings::schedulingToString(enum FmBackupSettings::TFileManagerBackupSchedule)
+ ?setTargetDrive@FmBackupSettings@@QAEXABVQString@@@Z @ 62 NONAME ; void FmBackupSettings::setTargetDrive(class QString const &)
+ ?staticMetaObject@FmBkupEngine@@2UQMetaObject@@B @ 63 NONAME ; struct QMetaObject const FmBkupEngine::staticMetaObject
+ ?refreshList@FmRestoreSettings@@AAEXAAV?$QList@PAVFmBkupDrivesAndOperation@@@@@Z @ 64 NONAME ; void FmRestoreSettings::refreshList(class QList<class FmBkupDrivesAndOperation *> &)
+ ?notifyStart@FmBkupEngine@@IAEX_NH@Z @ 65 NONAME ; void FmBkupEngine::notifyStart(bool, int)
+ ?scheduling@FmBackupSettings@@QBE?AW4TFileManagerBackupSchedule@1@XZ @ 66 NONAME ; enum FmBackupSettings::TFileManagerBackupSchedule FmBackupSettings::scheduling(void) const
+ ?qt_metacall@FmBkupEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 67 NONAME ; int FmBkupEngine::qt_metacall(enum QMetaObject::Call, int, void * *)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/fmbkupenginewrapper/eabi/fmbkupenginewrapperu.def Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,73 @@
+EXPORTS
+ _ZN12FmBkupEngine11notifyStartEbi @ 1 NONAME
+ _ZN12FmBkupEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+ _ZN12FmBkupEngine11qt_metacastEPKc @ 3 NONAME
+ _ZN12FmBkupEngine11startBackupE5QListIP24FmBkupDrivesAndOperationES0_IP20FmBkupBackupCategoryE7QStringj @ 4 NONAME
+ _ZN12FmBkupEngine12cancelBackupEv @ 5 NONAME
+ _ZN12FmBkupEngine12deleteBackupE5QListIP24FmBkupDrivesAndOperationE @ 6 NONAME
+ _ZN12FmBkupEngine12notifyFinishEi @ 7 NONAME
+ _ZN12FmBkupEngine12notifyUpdateEi @ 8 NONAME
+ _ZN12FmBkupEngine12startRestoreE5QListIP24FmBkupDrivesAndOperationE @ 9 NONAME
+ _ZN12FmBkupEngine15BackupSettingsLEv @ 10 NONAME
+ _ZN12FmBkupEngine15notifyMemoryLowEiRi @ 11 NONAME
+ _ZN12FmBkupEngine15notifyPreparingEb @ 12 NONAME
+ _ZN12FmBkupEngine16RestoreSettingsLEv @ 13 NONAME
+ _ZN12FmBkupEngine16staticMetaObjectE @ 14 NONAME DATA 16
+ _ZN12FmBkupEngine18getBackupDriveListER11QStringList @ 15 NONAME
+ _ZN12FmBkupEngine19GetRestoreInfoArrayER5QListIP24FmBkupDrivesAndOperationERS0_I13FmRestoreInfoERK7QString @ 16 NONAME
+ _ZN12FmBkupEngine19getStaticMetaObjectEv @ 17 NONAME
+ _ZN12FmBkupEngine22notifyBackupFilesExistERb @ 18 NONAME
+ _ZN12FmBkupEngineC1EP7QObject @ 19 NONAME
+ _ZN12FmBkupEngineC2EP7QObject @ 20 NONAME
+ _ZN12FmBkupEngineD0Ev @ 21 NONAME
+ _ZN12FmBkupEngineD1Ev @ 22 NONAME
+ _ZN12FmBkupEngineD2Ev @ 23 NONAME
+ _ZN16FmBackupSettings10setContentEj @ 24 NONAME
+ _ZN16FmBackupSettings10setWeekdayENS_25TFileManagerBackupWeekdayE @ 25 NONAME
+ _ZN16FmBackupSettings11CreateEntryERK7QStringS2_N13FmBackupEntry12TSettingTypeE @ 26 NONAME
+ _ZN16FmBackupSettings11refreshListEv @ 27 NONAME
+ _ZN16FmBackupSettings13setSchedulingENS_26TFileManagerBackupScheduleE @ 28 NONAME
+ _ZN16FmBackupSettings14setTargetDriveERK7QString @ 29 NONAME
+ _ZN16FmBackupSettings15backupEntryListEv @ 30 NONAME
+ _ZN16FmBackupSettings15contentToStringEj @ 31 NONAME
+ _ZN16FmBackupSettings15createTimeEntryEv @ 32 NONAME
+ _ZN16FmBackupSettings15weekdayToStringENS_25TFileManagerBackupWeekdayE @ 33 NONAME
+ _ZN16FmBackupSettings16updateBackupDateEv @ 34 NONAME
+ _ZN16FmBackupSettings18createWeekdayEntryEv @ 35 NONAME
+ _ZN16FmBackupSettings18schedulingToStringENS_26TFileManagerBackupScheduleE @ 36 NONAME
+ _ZN16FmBackupSettings19createContentsEntryEv @ 37 NONAME
+ _ZN16FmBackupSettings19targetDriveToStringERK7QString @ 38 NONAME
+ _ZN16FmBackupSettings21createBackupDateEntryEv @ 39 NONAME
+ _ZN16FmBackupSettings21createSchedulingEntryEv @ 40 NONAME
+ _ZN16FmBackupSettings22createTargetDriveEntryEv @ 41 NONAME
+ _ZN16FmBackupSettings26resetAndDestoryBackupEntryEv @ 42 NONAME
+ _ZN16FmBackupSettings4loadEv @ 43 NONAME
+ _ZN16FmBackupSettings4saveEv @ 44 NONAME
+ _ZN16FmBackupSettings7setTimeERK5QTime @ 45 NONAME
+ _ZN16FmBackupSettingsC1EP12FmBkupEngine @ 46 NONAME
+ _ZN16FmBackupSettingsC2EP12FmBkupEngine @ 47 NONAME
+ _ZN16FmBackupSettingsD1Ev @ 48 NONAME
+ _ZN16FmBackupSettingsD2Ev @ 49 NONAME
+ _ZN17FmRestoreSettings11CreateEntryERK13FmRestoreInfo @ 50 NONAME
+ _ZN17FmRestoreSettings11refreshListER5QListIP24FmBkupDrivesAndOperationE @ 51 NONAME
+ _ZN17FmRestoreSettings12SetSelectionERKy @ 52 NONAME
+ _ZN17FmRestoreSettings16restoreEntryListEv @ 53 NONAME
+ _ZN17FmRestoreSettings27resetAndDestoryRestoreEntryEv @ 54 NONAME
+ _ZN17FmRestoreSettings4loadE5QListIP24FmBkupDrivesAndOperationE @ 55 NONAME
+ _ZN17FmRestoreSettingsC1ER12FmBkupEngine @ 56 NONAME
+ _ZN17FmRestoreSettingsC2ER12FmBkupEngine @ 57 NONAME
+ _ZN17FmRestoreSettingsD1Ev @ 58 NONAME
+ _ZN17FmRestoreSettingsD2Ev @ 59 NONAME
+ _ZNK12FmBkupEngine10metaObjectEv @ 60 NONAME
+ _ZNK12FmBkupEngine5errorEv @ 61 NONAME
+ _ZNK16FmBackupSettings10schedulingEv @ 62 NONAME
+ _ZNK16FmBackupSettings11targetDriveEv @ 63 NONAME
+ _ZNK16FmBackupSettings16contentsSelectedEv @ 64 NONAME
+ _ZNK16FmBackupSettings20availableTargetDriveEv @ 65 NONAME
+ _ZNK16FmBackupSettings4timeEv @ 66 NONAME
+ _ZNK16FmBackupSettings7contentEv @ 67 NONAME
+ _ZNK16FmBackupSettings7weekdayEv @ 68 NONAME
+ _ZNK17FmRestoreSettings13GetSelectionLER5QListI13FmRestoreInfoE @ 69 NONAME
+ _ZTI12FmBkupEngine @ 70 NONAME
+ _ZTV12FmBkupEngine @ 71 NONAME
+
--- a/filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pro Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/fmbkupenginewrapper.pro Tue Aug 24 10:24:14 2010 +0800
@@ -14,6 +14,7 @@
# Description: The project file of FmBkupEngineWrapper
#
+CONFIG += hb
TARGET =
TEMPLATE = lib
QT = core
@@ -27,7 +28,7 @@
TARGET.UID3 = 0x2002BCC1
TARGET.EPOCALLOWDLLDATA = 1
TARGET.CAPABILITY = CAP_GENERAL_DLL DiskAdmin AllFiles PowerMgmt
- TARGET.VENDORID = VID_DEFAULT
+ TARGET.VID = VID_DEFAULT
LIBS += -lfmbkupengine
LIBS += -lefsrv
LIBS += -lavkon
--- a/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Tue Aug 24 10:24:14 2010 +0800
@@ -24,31 +24,7 @@
#include <QString>
#include <QList>
-const QString constFileManagerBackupWeekdayMonday = "Monday";
-const QString constFileManagerBackupWeekdayTuesday = "Tuesday";
-const QString constFileManagerBackupWeekdayWednesday = "Wednesday";
-const QString constFileManagerBackupWeekdayThursday = "Thursday";
-const QString constFileManagerBackupWeekdayFirday = "Friday";
-const QString constFileManagerBackupWeekdaySaturday = "Saturday";
-const QString constFileManagerBackupWeekdaySunday = "Sunday";
-
-const QString constFileManagerBackupScheduleNever = "Never";
-const QString constFileManagerBackupScheduleDaily = "Daily";
-const QString constFileManagerBackupScheduleWeekly = "Weekly";
-
-const QString constFileManagerBackupSettingsTitleContents = "Backup Contents";
-const QString constFileManagerBackupSettingsTitleScheduling = "Backup scheduling";
-const QString constFileManagerBackupSettingsTitleWeekday = "Weekday";
-const QString constFileManagerBackupSettingsTitleTime = "Time";
-const QString constFileManagerBackupSettingsTitleTargetDrive = "Backup destination";
-
-const QString constFileManagerBackupSettingsContentAll = "All";
-const QString constFileManagerBackupSettingsContentSettings = "Settings";
-const QString constFileManagerBackupSettingsContentMessages = "Messages";
-const QString constFileManagerBackupSettingsContentContacts = "Contacts";
-const QString constFileManagerBackupSettingsContentCalendar = "Calendar entries";
-const QString constFileManagerBackupSettingsContentBookmarks = "Bookmarks";
-const QString constFileManagerBackupSettingsContentUserFiles = "Files";
+#include <hbglobal.h>
class FmBkupEngine;
@@ -69,7 +45,8 @@
EScheduling,
EWeekday,
ETime,
- ETarget
+ ETarget,
+ EBackupdate
};
public:
@@ -241,6 +218,14 @@
QString targetDrive() const;
/**
+ * Gets available backup target drive
+ * if targetDrive exist, return targetDrive
+ * otherwise return other first available backup drive
+ * @return Available backup target drive, empty QString for null
+ */
+ QString availableTargetDrive() const;
+
+ /**
* Loads saved backup settings
*/
void load();
@@ -284,6 +269,10 @@
*/
QString targetDriveToString( const QString& targetDrive );
+ /**
+ * Updates the backup date
+ */
+ void updateBackupDate();
private:
/**
* Gets the count of contents selected
@@ -318,6 +307,11 @@
*/
FmBackupEntry* createTargetDriveEntry();
+ /**
+ * Creates backup date entry
+ */
+ FmBackupEntry* createBackupDateEntry();
+
void refreshList();
void resetAndDestoryBackupEntry();
private:
@@ -348,10 +342,16 @@
QString mTargetDrive;
/**
+ * Backup date
+ */
+ QDate mDate;
+
+ /**
* Backup setting list items
*/
QList< FmBackupEntry* > mBackupEntryList;
+
FmBkupEngine *mBkupEngine;
};
--- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -98,18 +98,28 @@
QList<FmBkupBackupCategory*> backupCategoryList,
QString drive, quint32 content)
{
+ FM_LOG( "FmBkupEnginePrivate::startBackup_with drive: " + drive +
+ "_number:" + QString::number(DriverNameToNumber( drive )));
if( drive.isEmpty() ) {
iError = KErrPathNotFound;
+ FM_LOG( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is empty" );
+ return false;
+ }
+ QStringList backupableDriveList;
+ getBackupDriveList( backupableDriveList );
+ if( !backupableDriveList.contains( drive, Qt::CaseInsensitive ) ) {
+ iError = KErrPathNotFound;
+ FM_LOG( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is not available" );
return false;
}
QString logString;
logString = "startBackup";
- FmLogger::log( logString );
+ FM_LOG( logString );
iDrvAndOpList->Reset();
iBkupCategoryList->ResetAndDestroy();
logString = "startBackup_driveroperation count:" + QString::number(drivesAndOperationList.count());
- FmLogger::log( logString );
+ FM_LOG( logString );
for( QList<FmBkupDrivesAndOperation* >::iterator it = drivesAndOperationList.begin();
it != drivesAndOperationList.end(); ++it ) {
@@ -121,7 +131,7 @@
}
logString = "startBackup_backupCategoryList count:" + QString::number(backupCategoryList.count());
- FmLogger::log( logString );
+ FM_LOG( logString );
for( QList<FmBkupBackupCategory* >::iterator it = backupCategoryList.begin();
@@ -160,7 +170,7 @@
//TUint32 bkupContent = 63;
logString = "startBackup_new param";
- FmLogger::log( logString );
+ FM_LOG( logString );
CMMCScBkupOpParamsBackupFull* params =
CMMCScBkupOpParamsBackupFull::NewL(
@@ -173,20 +183,19 @@
logString = "startBackup_param ok";
- FmLogger::log( logString );
+ FM_LOG( logString );
CCoeEnv* coeEnv = CCoeEnv::Static();
CEikonEnv* eikonEnv = (STATIC_CAST(CEikonEnv*,coeEnv));
eikonEnv->SetSystem(ETrue);
logString = "startBackup_StartOperationL";
- FmLogger::log( logString );
+ FM_LOG( logString );
QList< FmRestoreInfo > restoreInfoList;
- TInt driveNumber = DriverNameToNumber( drive );
- GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, driveNumber );
+ GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, drive );
- for ( TInt i( 0 ); i < restoreInfoList.count(); i++ )
+ for ( TInt i( 0 ); i < restoreInfoList.count(); ++i )
{
bool toContinue = false;
FmRestoreInfo &info = restoreInfoList[ i ];
@@ -211,14 +220,14 @@
EMMCScBkupOperationTypeFullBackup, *this, params ) );
logString = "startBackup_end with error:" + QString::number(err) ;
- FmLogger::log( logString );
+ FM_LOG( logString );
return (err == KErrNone);
}
void FmBkupEnginePrivate::cancelBackup()
{
QString logString = "cancelBackup";
- FmLogger::log(logString);
+ FM_LOG(logString);
switch( mProcess )
{
case FmBkupEngine::ProcessBackup: // FALLTHROUGH
@@ -399,12 +408,13 @@
break;
}
}
- FmLogger::log( logString );
+ FM_LOG( logString );
return ret;
}
int FmBkupEnginePrivate::error()
{
+ FM_LOG( "FmBkupEnginePrivate::error:" + QString::number( iError ) );
switch (iError)
{
case KErrNone:
@@ -419,6 +429,14 @@
return FmErrCancel;
case KErrPathNotFound:
return FmErrPathNotFound;
+ case KErrLocked:
+ return FmErrLocked;
+ case KErrCorrupt:
+ return FmErrCorrupt;
+ case KErrNotReady:
+ return FmErrNotReady;
+ case KErrDisMounted:
+ return FmErrDisMounted;
default:
return FmErrUnKnown;
}
@@ -536,8 +554,6 @@
iDrvAndOpList->AppendL( drvAndOp );
}
////////
-
- FmBackupSettings& bkupSettings( *( q->BackupSettingsL() ) );
// Create restore params - ownership is transferred to
// secure backup engine
@@ -616,6 +632,7 @@
CMMCScBkupOpParamsRestoreFull::NewL( driveReader, EBUCatAllInOne );
CleanupStack::PopAndDestroy(); // driveReader
+ FmBackupSettings& bkupSettings( *( q->BackupSettingsL() ) );
// Get list of all archives
RPointerArray< CMMCScBkupArchiveInfo > archives;
TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives );
@@ -650,9 +667,9 @@
void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
- const TInt aDrive )
+ const QString& aDrive )
{
- FmBackupSettings& settings( *( q->BackupSettingsL() ) );
+ int targetDrive = DriverNameToNumber( aDrive );
restoreInfoList.clear();
@@ -684,7 +701,7 @@
archives,
params,
AllowedDriveAttMatchMask(),
- aDrive );
+ targetDrive );
// Fill restore info
TInt count( archives.Count() );
@@ -705,7 +722,7 @@
int s = iDateTime.Second();
int year = iDateTime.Year();
int month = iDateTime.Month() + 1;
- int day = iDateTime.Day();
+ int day = iDateTime.Day()+1;
QTime time( h, m, s);
QDate date( year, month, day );
@@ -750,6 +767,9 @@
TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName )
{
+ if( driverName.isEmpty() ) {
+ return KErrNotFound;
+ }
TInt drive = 0;
drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
return drive;
@@ -784,7 +804,6 @@
}
}
}
-
fs.Close();
}
--- a/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h Tue Aug 24 10:24:14 2010 +0800
@@ -56,19 +56,25 @@
bool StartRestoreL( QList<FmBkupDrivesAndOperation* > drivesAndOperationList );
void GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
- const int aDrive = 0 );
+ const QString& aDrive );
+ void getBackupDriveList( QStringList &driveList );
private:
int DriverNameToNumber( QString driverName );
QString NumberToDriverName( int driver );
- TBool HasMultipleBackupTargets();
+// TBool HasMultipleBackupTargets();
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 notifyStart( bool cancelable, int totalCount );
+ void notifyUpdate( int count );
+ void notifyFinish( int err );
+ void notifyMemoryLow( int memoryValue, int &userError );
+
+ // win32 source code is used to simulator backup action.
+ // add this signal in win32 to avoid warning when run test case
+ // though it is not used in win32 source code currently
+ void notifyBackupFilesExist( bool &isContinue );
public slots:
void onNotifyPreparing( bool cancelable );
--- a/filemanager/src/fmbkupenginewrapper/src/fmbackupsettings.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/src/fmbackupsettings.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -25,6 +25,8 @@
#include <QTime>
#include <QSettings>
+#include <hbglobal.h>
+
FmBackupSettings::FmBackupSettings( FmBkupEngine *aFmBkupEngine ) : mBkupEngine( aFmBkupEngine )
{
@@ -90,6 +92,21 @@
return mTargetDrive;
}
+QString FmBackupSettings::availableTargetDrive() const
+{
+ QString targetDrive;
+ QStringList driveList;
+ mBkupEngine->getBackupDriveList( driveList );
+ if( !driveList.isEmpty() ) {
+ if( driveList.contains( mTargetDrive ) ) {
+ targetDrive = mTargetDrive;
+ } else {
+ targetDrive = driveList.first();
+ }
+ }
+ return targetDrive;
+}
+
int FmBackupSettings::contentsSelected() const
{
int ret( 0 );
@@ -115,7 +132,7 @@
QString title;
QString tips;
- title = constFileManagerBackupSettingsTitleContents;
+ title = hbTrId( "Backup Contents" );
int selected( contentsSelected() );
if ( !( mContent & EFileManagerBackupContentAll ) && selected > 1 ){
@@ -136,7 +153,7 @@
QString title;
QString tips;
- title = constFileManagerBackupSettingsTitleScheduling;
+ title = hbTrId( "Backup scheduling" );
tips = schedulingToString( mScheduling );
return CreateEntry( title, tips, FmBackupEntry::EScheduling );
@@ -147,7 +164,7 @@
QString title;
QString tips;
- title = constFileManagerBackupSettingsTitleWeekday;
+ title = hbTrId( "Weekday" );
tips = weekdayToString( mWeekday );
return CreateEntry( title, tips, FmBackupEntry::EWeekday );
@@ -158,7 +175,7 @@
QString title;
QString tips;
- title = constFileManagerBackupSettingsTitleTime;
+ title = hbTrId( "Time" );
tips = mTime.toString( "hh:mm" );
return CreateEntry( title, tips, FmBackupEntry::ETime );
@@ -169,36 +186,49 @@
QString title;
QString tips;
- title = constFileManagerBackupSettingsTitleTargetDrive;
+ title = hbTrId( "Backup destination" );
tips = targetDriveToString( mTargetDrive );
return CreateEntry( title, tips, FmBackupEntry::ETarget );
}
+FmBackupEntry* FmBackupSettings::createBackupDateEntry()
+{
+ QString tips;
+ if( mDate.isNull() )
+ {
+ tips = hbTrId( "No previous backups created");
+ }
+ else
+ {
+ tips = hbTrId( "Backup Created " ) + mDate.toString( "dd.MM.yyyy" );
+ }
+ return CreateEntry( QString(""), tips, FmBackupEntry::EBackupdate);
+}
QString FmBackupSettings::contentToString( const quint32 content )
{
- QString ret( constFileManagerBackupSettingsContentAll );
+ QString ret( hbTrId( "All" ) );
if ( content & EFileManagerBackupContentAll ){
- ret = constFileManagerBackupSettingsContentAll;
+ ret = hbTrId( "All" );
}
else if ( content & EFileManagerBackupContentSettings ){
- ret = constFileManagerBackupSettingsContentSettings;
+ ret = hbTrId( "Settings" );
}
else if ( content & EFileManagerBackupContentMessages ){
- ret = constFileManagerBackupSettingsContentMessages;
+ ret = hbTrId( "Messages" );
}
else if ( content & EFileManagerBackupContentContacts ){
- ret = constFileManagerBackupSettingsContentContacts;
+ ret = hbTrId( "Contacts" );
}
else if ( content & EFileManagerBackupContentCalendar ){
- ret = constFileManagerBackupSettingsContentCalendar;
+ ret = hbTrId( "Calendar" );
}
else if ( content & EFileManagerBackupContentBookmarks ){
- ret = constFileManagerBackupSettingsContentBookmarks;
+ ret = hbTrId( "Bookmarks" );
}
else if ( content & EFileManagerBackupContentUserFiles ){
- ret = constFileManagerBackupSettingsContentUserFiles;
+ ret = hbTrId( "Files" );
}
return ret;
}
@@ -209,25 +239,25 @@
switch (weekday)
{
case EFileManagerBackupWeekdayMonday:
- ret = constFileManagerBackupWeekdayMonday;
+ ret = hbTrId( "Monday" );
break;
case EFileManagerBackupWeekdayTuesday:
- ret = constFileManagerBackupWeekdayTuesday;
+ ret = hbTrId( "Tuesday" );
break;
case EFileManagerBackupWeekdayWednesday:
- ret = constFileManagerBackupWeekdayWednesday;
+ ret = hbTrId( "Wednesday" );
break;
case EFileManagerBackupWeekdayThursday:
- ret = constFileManagerBackupWeekdayThursday;
+ ret = hbTrId( "Thursday" );
break;
case EFileManagerBackupWeekdayFriday:
- ret = constFileManagerBackupWeekdayFirday;
+ ret = hbTrId( "Friday" );
break;
case EFileManagerBackupWeekdaySaturday:
- ret = constFileManagerBackupWeekdaySaturday;
+ ret = hbTrId( "Saturday" );
break;
case EFileManagerBackupWeekdaySunday:
- ret = constFileManagerBackupWeekdaySunday;
+ ret = hbTrId( "Sunday" );
break;
}
return ret;
@@ -240,13 +270,13 @@
switch (scheduling)
{
case EFileManagerBackupScheduleNever:
- ret = constFileManagerBackupScheduleNever;
+ ret = hbTrId( "Never" );
break;
case EFileManagerBackupScheduleDaily:
- ret = constFileManagerBackupScheduleDaily;
+ ret = hbTrId ("Daily" );
break;
case EFileManagerBackupScheduleWeekly:
- ret = constFileManagerBackupScheduleWeekly;
+ ret = hbTrId( "Weekly" );
break;
}
return ret;
@@ -294,6 +324,9 @@
entry = createTargetDriveEntry();
mBackupEntryList.push_back( entry );
}
+
+ entry = createBackupDateEntry();
+ mBackupEntryList.push_back( entry );
}
void FmBackupSettings::resetAndDestoryBackupEntry()
@@ -316,7 +349,7 @@
mBkupEngine->getBackupDriveList( driveList );
QString defaultDrive( driveList.first() );
-
+ QDate date;
QSettings settings("Nokia", "FileManager");
settings.beginGroup("BackupConfigure");
@@ -326,7 +359,7 @@
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", defaultDrive ) ).toString(); // C for default
-
+ mDate = (settings.value("backupDate", date)).toDate();
settings.endGroup();
refreshList();
}
@@ -343,8 +376,14 @@
settings.setValue( "weekday", mWeekday );
settings.setValue( "time", mTime.toString() );
settings.setValue( "targetDrive", mTargetDrive );
-
+ settings.setValue( "backupDate", mDate.toString( Qt::ISODate ) );
settings.endGroup();
refreshList();
}
+
+void FmBackupSettings::updateBackupDate()
+{
+ mDate.setDate( QDate::currentDate().year(), QDate::currentDate().month(), QDate::currentDate().day() );
+ save();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/fmfiledialog/bwins/fmfiledialogu.def Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,25 @@
+EXPORTS
+ ??_EFmFileDialog@@UAE@I@Z @ 1 NONAME ; FmFileDialog::~FmFileDialog(unsigned int)
+ ?qt_metacall@FmFileDialog@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2 NONAME ; int FmFileDialog::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ??1FmFileDialog@@EAE@XZ @ 3 NONAME ; FmFileDialog::~FmFileDialog(void)
+ ?tr@FmFileDialog@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString FmFileDialog::tr(char const *, char const *, int)
+ ?getOpenFileName@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 5 NONAME ; class QString FmFileDialog::getOpenFileName(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags<enum FmFileDialog::Option>)
+ ??0FmFileDialog@@AAE@PAVQGraphicsItem@@@Z @ 6 NONAME ; FmFileDialog::FmFileDialog(class QGraphicsItem *)
+ ?tr@FmFileDialog@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString FmFileDialog::tr(char const *, char const *)
+ ?getStaticMetaObject@FmFileDialog@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & FmFileDialog::getStaticMetaObject(void)
+ ?d_func@FmFileDialog@@ABEPBVFmFileDialogPrivate@@XZ @ 9 NONAME ; class FmFileDialogPrivate const * FmFileDialog::d_func(void) const
+ ?exec@FmFileDialog@@AAE_NXZ @ 10 NONAME ; bool FmFileDialog::exec(void)
+ ?trUtf8@FmFileDialog@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString FmFileDialog::trUtf8(char const *, char const *)
+ ?trUtf8@FmFileDialog@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString FmFileDialog::trUtf8(char const *, char const *, int)
+ ?metaObject@FmFileDialog@@UBEPBUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const * FmFileDialog::metaObject(void) const
+ ?staticMetaObject@FmFileDialog@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const FmFileDialog::staticMetaObject
+ ?getSaveFileName@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 15 NONAME ; class QString FmFileDialog::getSaveFileName(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags<enum FmFileDialog::Option>)
+ ?d_func@FmFileDialog@@AAEPAVFmFileDialogPrivate@@XZ @ 16 NONAME ; class FmFileDialogPrivate * FmFileDialog::d_func(void)
+ ?getExistingDirectory@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 17 NONAME ; class QString FmFileDialog::getExistingDirectory(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags<enum FmFileDialog::Option>)
+ ?qt_metacast@FmFileDialog@@UAEPAXPBD@Z @ 18 NONAME ; void * FmFileDialog::qt_metacast(char const *)
+ ?dialogClosed@FmFileDialog@@AAEXPAVHbAction@@@Z @ 19 NONAME ; void FmFileDialog::dialogClosed(class HbAction *)
+ ?setSecondaryAction@FmFileDialog@@AAEXPAVHbAction@@@Z @ 20 NONAME ; void FmFileDialog::setSecondaryAction(class HbAction *)
+ ?secondaryAction@FmFileDialog@@ABEPAVHbAction@@XZ @ 21 NONAME ; class HbAction * FmFileDialog::secondaryAction(void) const
+ ?setPrimaryAction@FmFileDialog@@AAEXPAVHbAction@@@Z @ 22 NONAME ; void FmFileDialog::setPrimaryAction(class HbAction *)
+ ?primaryAction@FmFileDialog@@ABEPAVHbAction@@XZ @ 23 NONAME ; class HbAction * FmFileDialog::primaryAction(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/fmfiledialog/eabi/fmfiledialogu.def Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,27 @@
+EXPORTS
+ _ZN12FmFileDialog11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
+ _ZN12FmFileDialog11qt_metacastEPKc @ 2 NONAME
+ _ZN12FmFileDialog15getOpenFileNameEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 3 NONAME
+ _ZN12FmFileDialog15getSaveFileNameEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 4 NONAME
+ _ZN12FmFileDialog16staticMetaObjectE @ 5 NONAME DATA 16
+ _ZN12FmFileDialog19getStaticMetaObjectEv @ 6 NONAME
+ _ZN12FmFileDialog20getExistingDirectoryEP8HbWidgetRK7QStringS4_RK11QStringList6QFlagsINS_6OptionEE @ 7 NONAME
+ _ZN12FmFileDialog4execEv @ 8 NONAME
+ _ZN12FmFileDialogC1EP13QGraphicsItem @ 9 NONAME
+ _ZN12FmFileDialogC2EP13QGraphicsItem @ 10 NONAME
+ _ZN12FmFileDialogD0Ev @ 11 NONAME
+ _ZN12FmFileDialogD1Ev @ 12 NONAME
+ _ZN12FmFileDialogD2Ev @ 13 NONAME
+ _ZNK12FmFileDialog10metaObjectEv @ 14 NONAME
+ _ZTI12FmFileDialog @ 15 NONAME
+ _ZTV12FmFileDialog @ 16 NONAME
+ _ZThn16_N12FmFileDialogD0Ev @ 17 NONAME
+ _ZThn16_N12FmFileDialogD1Ev @ 18 NONAME
+ _ZThn8_N12FmFileDialogD0Ev @ 19 NONAME
+ _ZThn8_N12FmFileDialogD1Ev @ 20 NONAME
+ _ZN12FmFileDialog12dialogClosedEP8HbAction @ 21 NONAME
+ _ZN12FmFileDialog16setPrimaryActionEP8HbAction @ 22 NONAME
+ _ZN12FmFileDialog18setSecondaryActionEP8HbAction @ 23 NONAME
+ _ZNK12FmFileDialog13primaryActionEv @ 24 NONAME
+ _ZNK12FmFileDialog15secondaryActionEv @ 25 NONAME
+
--- a/filemanager/src/fmfiledialog/fmfiledialog.pro Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/fmfiledialog.pro Tue Aug 24 10:24:14 2010 +0800
@@ -28,16 +28,16 @@
-lshareui \
-lefsrv \
-lapgrfx \
- -lcone \
- -ldirectorylocalizer
+ -lcone \
+ -lsysutil
- TARGET.UID3 = 0x2002BCC2
+ TARGET.UID3 = 0x2002BCC3
# export headers to app
-# EXPORT_PLATFORM_HEADERS += \
-# ../../filemanager_plat/inc/fmglobal.h \
-# ../../filemanager_plat/inc/fmfiledialog.h
-#
-# headers.sources = $$EXPORT_PLATFORM_HEADERS
-# for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$APP_LAYER_PLATFORM_EXPORT_PATH($$basename(header))"
+ EXPORT_PLATFORM_HEADERS += \
+ ../../filemanager_plat/inc/fmglobal.h \
+ ../../filemanager_plat/inc/fmfiledialog.h
+
+ headers.sources = $$EXPORT_PLATFORM_HEADERS
+ for(header, headers.sources):BLD_INF_RULES.prj_exports += "./$$header $$APP_LAYER_PLATFORM_EXPORT_PATH($$basename(header))"
}
--- a/filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -90,11 +90,13 @@
{
// Create action for ok button and assign it to the primary action of popup
mOkAction = new HbAction( primaryActionText, mFileDialog );
+ mOkAction->setObjectName( "okAction" );
Q_ASSERT( mOkAction );
mFileDialog->setPrimaryAction( mOkAction );
// Create action for cancel button and assign it to the secondary action of popup
mCancelAction = new HbAction( secondaryActionText, mFileDialog );
+ mCancelAction->setObjectName( "cancelAction" );
Q_ASSERT( mCancelAction );
mFileDialog->setSecondaryAction( mCancelAction );
}
@@ -144,6 +146,7 @@
void FmFileDialogPrivate::createHeadingWidget()
{
mHeadingWidget = new HbWidget( mFileDialog );
+ mHeadingWidget->setObjectName( "headingWidget" );
QGraphicsLinearLayout *headingLayout = new QGraphicsLinearLayout;
headingLayout->setOrientation(Qt::Horizontal);
@@ -154,6 +157,7 @@
titleLayout->setOrientation(Qt::Vertical);
mTitleLabel = new HbLabel();
+ mTitleLabel->setObjectName( "titleLabel" );
if( mArgs.mTitle.isEmpty() ){
mTitleLabel->setPlainText( QString( FmPlaceholderString ) );
} else {
@@ -161,9 +165,11 @@
}
mCurrentPathLabel = new HbLabel( QString( FmPlaceholderString ) );
+ mCurrentPathLabel->setObjectName( "currentPathLabel" );
mCurrentPathLabel->setElideMode(Qt::ElideRight);
mUpButton = new HbPushButton;
+ mUpButton->setObjectName( "upButton" );
mUpButton->setIcon(HbIcon(backButtonIcon));
titleLayout->addItem( mTitleLabel );
@@ -187,6 +193,7 @@
void FmFileDialogPrivate::createContentWidget()
{
mContentWidget = new HbWidget( mFileDialog );
+ mContentWidget->setObjectName( "contentWidget" );
mContentLayout = new QGraphicsLinearLayout;
mContentLayout->setOrientation(Qt::Vertical);
@@ -194,6 +201,7 @@
mContentWidget->setLayout( mContentLayout );
mFileWidget = new FmFileWidget( mContentWidget );
+ mFileWidget->setObjectName( "fileWidget" );
mContentLayout->addItem( mFileWidget );
mFileDialog->setContentWidget( mContentWidget );
@@ -210,15 +218,18 @@
return;
}
HbWidget *bottomWidget = new HbWidget( mContentWidget );
+ bottomWidget->setObjectName( "bottomWidget" );
mContentLayout->addItem( bottomWidget );
QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout;
bottomLayout->setOrientation( Qt::Horizontal );
mFileNameTitleLabel = new HbLabel( mFileDialog->tr( "file name:" ), bottomWidget );
+ mFileNameTitleLabel->setObjectName( "fileNameTitleLabel" );
bottomLayout->addItem( mFileNameTitleLabel );
mFileNameLineEdit = new HbLineEdit( bottomWidget );
+ mFileNameLineEdit->setObjectName( "fileNameLineEdit" );
bottomLayout->addItem( mFileNameLineEdit );
bottomWidget->setLayout( bottomLayout );
@@ -256,10 +267,12 @@
}
break;
case SaveFileMode:
- if( mFileWidget->currentPath().absoluteFilePath().isEmpty() ) {
- mFileNameLineEdit->setReadOnly( true );
- } else {
- mFileNameLineEdit->setReadOnly( false );
+ if( mFileNameLineEdit ){
+ if( mFileWidget->currentPath().absoluteFilePath().isEmpty() ) {
+ mFileNameLineEdit->setReadOnly( true );
+ } else {
+ mFileNameLineEdit->setReadOnly( false );
+ }
}
break;
}
@@ -357,4 +370,19 @@
return false;
}
+void FmFileDialogPrivate::setRetAction( HbAction *action )
+{
+ mRetAction = action;
+}
+
+HbAction *FmFileDialogPrivate::retAction()
+{
+ return mRetAction;
+}
+
+QEventLoop &FmFileDialogPrivate::eventLoop()
+{
+ return mEventLoop;
+}
+
#include "moc_fmfiledialog.cpp"
--- a/filemanager/src/fmfiledialog/src/fmfilewidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfilewidget.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -20,6 +20,8 @@
#include "fmutils.h"
#include "fmdrivemodel.h"
#include "fmdrivewatcher.h"
+#include "fmcommon.h"
+#include "fmfileiconprovider.h"
#include "hbstyle.h"
#include "hbabstractitemview.h"
@@ -27,7 +29,7 @@
#include <QModelIndex>
#include <QGraphicsLinearLayout>
-#include <QDirModel>
+#include <QFileSystemModel>
#include <QTime>
#include <QFileInfo>
@@ -42,7 +44,8 @@
FmFileWidget::~FmFileWidget()
{
setModel( 0 );
- delete mDirModel;
+ delete mFileSystemModel;
+ delete mFileIconProvider;
delete mDriveModel;
mDriveWatcher->cancelWatch();
@@ -56,8 +59,8 @@
if( !index.isValid() ) {
return QFileInfo();
}
- if( mCurrentModel == mDirModel ) {
- return mDirModel->fileInfo( index );
+ if( mCurrentModel == mFileSystemModel ) {
+ return mFileSystemModel->fileInfo( index );
} else {
return QFileInfo();
}
@@ -65,65 +68,92 @@
void FmFileWidget::setRootPath( const QString &pathName )
{
- if( pathName.isEmpty() || !FmUtils::isPathAccessabel( pathName ) ) {
+ FM_LOG( "FmFileWidget::setRootPath start" );
+ // If path is empty or can not access, set model as DriveModel
+ // Otherwise set model as FileSystemModel, means it will return to drive view if error occur.
+ if( ( pathName.isEmpty() ) || ( FmErrNone != FmUtils::isPathAccessabel( pathName ) ) ) {
+ FM_LOG( "FmFileWidget::setRootPath set drive model" );
setModel( mDriveModel );
+ FM_LOG( "FmFileWidget::setRootPath set drive model end" );
emit pathChanged( QString() );
} else {
- setModel( mDirModel );
- mListView->setRootIndex( mDirModel->index( pathName ) );
+ FM_LOG( "FmFileWidget::setRootPath set dir model end" );
+ setModel( mFileSystemModel );
+ FM_LOG( "FmFileWidget::setRootPath set dir model end" );
+ mListView->setRootIndex( mFileSystemModel->setRootPath( pathName ) );
+ FM_LOG( "FmFileWidget::setRootPath set rootIndex" );
emit pathChanged( pathName );
}
+ FM_LOG( "FmFileWidget::setRootPath end" );
}
-
-
void FmFileWidget::on_list_activated( const QModelIndex &index )
+ {
+ mActivatedModelIndex = index;
+ emit listActivated();
+ }
+
+void FmFileWidget::on_listActivated()
{
+ FM_LOG("FmFileWidget::on_list_activated start" );
if( mCurrentModel == mDriveModel ) {
- QString driveName = mDriveModel->driveName( index );
+ //If current model is DriveModel, open drive and set path
+ QString driveName = mDriveModel->driveName( mActivatedModelIndex );
QString checkedPath = FmUtils::checkDriveToFolderFilter( driveName );
if( checkedPath.isEmpty() ) {
+ FM_LOG("FmFileWidget::on_list_activated end becaise checkedpath empty" );
return;
}
- setModel( mDirModel );
- mListView->setRootIndex( mDirModel->index( checkedPath ) );
+ FM_LOG("FmFileWidget::on_list_activated setModel dir start" );
+ setModel( mFileSystemModel );
+ FM_LOG("FmFileWidget::on_list_activated setModel dir end" );
+ setRootPath( checkedPath );
+ FM_LOG("FmFileWidget::on_list_activated setRootIndex" );
emit pathChanged( checkedPath );
+ FM_LOG("FmFileWidget::on_list_activated finish emit pathChanged" );
}
- else if( mCurrentModel == mDirModel ) {
- if ( mDirModel->isDir(index) ) {
- changeRootIndex( index );
+ else if( mCurrentModel == mFileSystemModel ) {
+ //If current model is FileSystemModel, open path or emit file activate signal.
+ if ( mFileSystemModel->isDir( mActivatedModelIndex ) ) {
+ FM_LOG("FmFileWidget::on_list_activated start changeRootIndex" );
+ changeRootIndex( mActivatedModelIndex );
+ FM_LOG("FmFileWidget::on_list_activated finish changeRootIndex" );
} else {
- QFileInfo fileInfo( mDirModel->filePath( index ) );
+ QFileInfo fileInfo( mFileSystemModel->filePath( mActivatedModelIndex ) );
if( fileInfo.isFile() ) {
emit fileActivated( fileInfo.fileName() );
+ FM_LOG("FmFileWidget::on_list_activated finish emit fileActivated" );
}
}
} else {
Q_ASSERT( false );
}
+ FM_LOG("FmFileWidget::on_list_activated end" );
}
void FmFileWidget::setModelFilter( QDir::Filters filters )
{
- mDirModel->setFilter( filters );
+ mFileSystemModel->setFilter( filters );
}
void FmFileWidget::setNameFilters( const QStringList &nameFilters )
{
- mDirModel->setNameFilters( nameFilters );
+ mFileSystemModel->setNameFilters( nameFilters );
}
void FmFileWidget::changeRootIndex( const QModelIndex &index )
{
- if( mCurrentModel != mDirModel ) {
+ FM_LOG("FmFileWidget::changeRootIndex start" );
+ if( mCurrentModel != mFileSystemModel ) {
+ FM_LOG("FmFileWidget::changeRootIndex end because model not equal mFileSystemModel" );
return;
}
- mDirModel->fetchMore(index);
- mListView->setRootIndex( index );
- QFileInfo fileInfo = mDirModel->fileInfo( mListView->rootIndex() );
- QString string = fileInfo.absoluteFilePath();
- emit pathChanged( string );
+ mFileSystemModel->fetchMore(index);
+ QString filePath = mFileSystemModel->fileInfo( index ).absoluteFilePath();
+ // pathChanged signal will be emitted in setRootPath
+ setRootPath( filePath );
+ FM_LOG("FmFileWidget::changeRootIndex end" );
}
void FmFileWidget::init()
@@ -138,10 +168,13 @@
mDriveModel = new FmDriveModel( this,
FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume | FmDriveModel::HideUnAvailableDrive );
- qDebug("constructed dirveModel");
+
qDebug( QTime::currentTime().toString().toUtf8().data() );
- mDirModel = new QDirModel( this );
- qDebug("constructed dirModel");
+ mFileSystemModel = new QFileSystemModel( this );
+ mFileIconProvider = new FmFileIconProvider();
+ mFileSystemModel->setIconProvider( mFileIconProvider );
+ qDebug("constructed mFileSystemModel");
+
qDebug( QTime::currentTime().toString().toUtf8().data() );
setModel( mDriveModel );
qDebug("setmodel");
@@ -154,7 +187,9 @@
// QMetaObject::connectSlotsByName( this );
connect( mListView, SIGNAL( activated( QModelIndex ) ),
this, SLOT( on_list_activated( QModelIndex ) ) );
-
+ connect( this, SIGNAL( listActivated() ),
+ this, SLOT( on_listActivated() ), Qt::QueuedConnection );
+
connect( mDriveWatcher, SIGNAL( driveAddedOrChanged() ),
this, SLOT( on_driveWatcher_driveAddedOrChanged() ) );
@@ -172,7 +207,7 @@
ViewType viewType = DriveView;
if( mCurrentModel == mDriveModel ) {
viewType = DriveView;
- } else if( mCurrentModel == mDirModel ) {
+ } else if( mCurrentModel == mFileSystemModel ) {
viewType = DirView;
} else {
Q_ASSERT( false );
@@ -186,6 +221,8 @@
QString path( FmUtils::checkFolderToDriveFilter( currentPath().absoluteFilePath() ) );
QFileInfo fileInfo( path );
QString cdUpPath;
+ // path length>3 means current path is a sub folder, then get up level path and navigate to it
+ // Otherwise means current path is a top level drive path, Should navigate to drive view. So setRootPath with empty path string.
if( path.length() > 3 ) {
cdUpPath = fileInfo.dir().absolutePath();
}
@@ -195,20 +232,20 @@
void FmFileWidget::on_driveWatcher_driveAddedOrChanged()
{
- FmLogger::log( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged start" ) );
+ FM_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() ) ) {
+ if( FmErrNone != FmUtils::isPathAccessabel( currentPath().absoluteFilePath() ) ) {
// path not available, set model to drive
- FmLogger::log( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged path not availeable, set drivemodel:"
+ FM_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" ) );
+ FM_LOG( QString( "FmFileDialog_FmFileWidget::on_driveWatcher_driveAddedOrChanged end" ) );
}
--- a/filemanager/src/fmfiledialog/src/fmfilewidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfilewidget.h Tue Aug 24 10:24:14 2010 +0800
@@ -24,12 +24,14 @@
#include <QDir>
#include <QString>
-class QDirModel;
+class QFileSystemModel;
class FmDriveModel;
class FmDriveWatcher;
class HbListView;
class QGraphicsLinearLayout;
+class FmFileIconProvider;
+
class FmFileWidget : public HbWidget
{
Q_OBJECT
@@ -53,9 +55,11 @@
signals:
void pathChanged( const QString &path );
void fileActivated( const QString &path );
+ void listActivated();
private slots:
void on_list_activated( const QModelIndex &index );
+ void on_listActivated();
void on_driveWatcher_driveAddedOrChanged();
private:
@@ -66,11 +70,15 @@
private:
HbListView *mListView;
QGraphicsLinearLayout *mLayout;
- QDirModel *mDirModel;
- FmDriveModel *mDriveModel;
+ QFileSystemModel *mFileSystemModel;
+ FmDriveModel *mDriveModel;
QAbstractItemModel *mCurrentModel;
FmDriveWatcher *mDriveWatcher;
+
+ QModelIndex mActivatedModelIndex;
+
+ FmFileIconProvider *mFileIconProvider;
};
--- a/filemanager/src/inc/commoninc.pri Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/commoninc.pri Tue Aug 24 10:24:14 2010 +0800
@@ -16,6 +16,7 @@
INTERNAL_HEADERS += $$PWD/fmcommon.h \
$$PWD/fmlogger.h \
- $$PWD/fmdefine.h \
+ $$PWD/fmdefine.h
-HEADERS += $$INTERNAL_HEADERS
\ No newline at end of file
+HEADERS += $$INTERNAL_HEADERS
+
--- a/filemanager/src/inc/commonutils.pri Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/commonutils.pri Tue Aug 24 10:24:14 2010 +0800
@@ -17,11 +17,14 @@
INTERNAL_HEADERS += $$PWD/fmutils.h \
$$PWD/fmdrivemodel.h \
$$PWD/fmfileiconprovider.h \
- $$PWD/fmdrivewatcher/fmdrivewatcher.h
+ $$PWD/fmdrivewatcher/fmdrivewatcher.h \
+ $$PWD/fmfiletyperecognizer.h
INTERNAL_SOURCES += $$PWD/fmdrivemodel.cpp \
$$PWD/fmfileiconprovider.cpp \
- $$PWD/fmdrivewatcher/fmdrivewatcher.cpp
+ $$PWD/fmdrivewatcher/fmdrivewatcher.cpp \
+ $$PWD/fmfiletyperecognizer.cpp \
+ $$PWD/fmutils.cpp
symbian {
INTERNAL_HEADERS += $$PWD/fms60utils.h \
@@ -34,6 +37,9 @@
$$PWD/fmdrivewatcher/private/symbian/fmdriveevent.cpp
}
win32 {
+ INCLUDEPATH += $$PWD/fmdrivewatcher/
+ INCLUDEPATH += $$PWD/fmdrivewatcher/private/win32/
+
INTERNAL_HEADERS += $$PWD/fmdrivewatcher/private/win32/fmdrivewatcherprivate.h
INTERNAL_SOURCES += $$PWD/fmutils_win.cpp \
--- a/filemanager/src/inc/fmcommon.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmcommon.h Tue Aug 24 10:24:14 2010 +0800
@@ -22,24 +22,11 @@
// MACRO for enable actions for change orientation
// #define FM_CHANGE_ORIENT_ENABLE
-// MACRO for launch find view quickly from driver view and search "b" in "c:\ruby"
-//#define _DEBUG_SPEED_FINDVIEW_
-
-//#define _DEBUG_ENABLE_FORMATMENU_
-
-
-// MARCO for hide d, z, folder except C:\data in windows for debug
-//#define _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
-
-//#define _DEBUG_LOG_ENABLE_
-
-//used to test drive hide which drive could be listed but not available
-//#define _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
+// MACRO for enable debug log
+// #define _DEBUG_LOG_ENABLE_
#include "fmlogger.h"
#include "fmdefine.h"
-
-
#endif
--- a/filemanager/src/inc/fmdefine.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdefine.h Tue Aug 24 10:24:14 2010 +0800
@@ -18,46 +18,75 @@
#define FMDEFINE_H
// define for filemanager error
-#define FmErrNone 0
-#define FmErrNotFound -1
-#define FmErrGeneral -2
-#define FmErrAlreadyExists -3
-#define FmErrAccessDenied -4
-#define FmErrCannotRemove -5
-#define FmErrCannotCopy -6
-#define FmErrDiskFull -7
-#define FmErrFileUsed -8
-#define FmErrFolderUsed -9
-#define FmErrTypeFormatFailed -10
-#define FmErrTypeFormatFailedUsed -11
-#define FmErrAlreadyStarted -12
-#define FmErrCancel -13
-#define FmErrWrongParam -14
-#define FmErrUnKnown -15
-#define FmErrIsNotFileOrFolder -16
-#define FmErrCannotMakeDir -17
-#define FmErrSrcPathDoNotExist -18
-#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 FmErrNone 0 // No Error
+#define FmErrNotFound -1 // General error for things requested is not found
+#define FmErrGeneral -2 // General error
+#define FmErrAlreadyExists -3 // General for already existed. for example if unlock a drive but it has already been unlocked
+#define FmErrAccessDenied -4 // General for Access is denied, for example, format a drive but access is denied.
+#define FmErrCannotRemove -5 // General error for can not performance remove
+#define FmErrCannotCopy -6 // General error for can not performance copy
+#define FmErrDiskFull -7 // Error for disk is full
+#define FmErrFileUsed -8 // Error for file is in use
+#define FmErrFolderUsed -9 // Error for folder is in use
+#define FmErrTypeFormatFailed -10 // Error reported when format failed
+#define FmErrTypeFormatFailedUsed -11 // Error reported when user try to format a drive but it is in use
+#define FmErrAlreadyStarted -12 // General error for operation is already started
+#define FmErrCancel -13 // General error for operation canceled
+#define FmErrWrongParam -14 // General error for wrong parameter
+#define FmErrUnKnown -15 // Unknown error
+#define FmErrIsNotFileOrFolder -16 // Error for a path which is not a fild or folder.
+#define FmErrCannotMakeDir -17 // Error for can not create directory.
+#define FmErrSrcPathDoNotExist -18 // Error for source path is not exist.
+#define FmErrDestPathDoNotExist -19 // Error for destination path is not exist.
+#define FmErrCopyDestToSubFolderInSrc -20 // If user try to copy a folder to its sub folder, error will occur
+#define FmErrMoveDestToSubFolderInSrc -21 // If user try to move a folder to its sub folder, error will occur
+#define FmErrNotSupported -22 // feature not supported, for example, lock an drive which can not be locked
+#define FmErrNotReady -23 // Error when drive is not ready( means drive is not present )
+#define FmErrInUse -24 // Error for drive is in use.
+#define FmErrPermissionDenied -25 // Permission Denied
+#define FmErrBadName -26 // Bad Drive or file/folder name, currently used when rename drive
+#define FmErrPathNotFound -27 // Error for path is not found
+#define FmErrRemoveDefaultFolder -28 // Error when user try to remove default folder, such as C:/data/images...
+#define FmErrLocked -29 // Disk is locked
+#define FmErrCorrupt -30 // Disk is corrupt
+#define FmErrDisMounted -31 // e.g. If disk dis mounted while backuping.
+#define FmErrDriveNotAvailable -32 // e.g. if user want to access MMC but it is not available
+#define FmErrPathDenied -33 // if user want to access path but it is denied, e.g c:/private
+#define FmErrDriveDenied -34 // if user want to access drive but it is denied, e.g D:/
+#define FmErrPathNotExist -35 // path not existed.
#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
#define FmPlaceholderString " " // Placeholder for HbLabel because layout will be wrong when HbLabel is empty
-#define Drive_C "C:/"
-#define Drive_D "D:/"
-#define Drive_Z "Z:/"
-#define Folder_C_Data "C:/Data"
+#define Drive_C ( QString( "C:" ) + QDir::separator() )
+#define Drive_D ( QString( "D:" ) + QDir::separator() )
+#define Drive_Z ( QString( "Z:" ) + QDir::separator() )
+#define Folder_C_Data ( QString( "C:" ) + QDir::separator() + QString( "Data" ) + QDir::separator() )
+
+// define contact data path for view details.
+#define FmViewDetail_Contacts ( "\\private\\10003a73\\SQLite__Contacts.cdb" )
#define FmMaxLengthofDriveName 11
+#define FmMaxLengthofDrivePassword 8
+
+// used to match un-zeroLength string, empty character such as space is acceptable
+#define Regex_ValidUnZeroLength QString( "^.+$" )
+
+// used to match un-empty string, and is not totally empty characters.
+#define Regex_ValidUnEmpty QString( "^.*[^\\s].*$" )
+
+// this is regexp for valid file/folder name: no \/:*?"<>| and is not totally empty characters.
+// file name can not end with "." , but it is not include in this RegExp. It should be checked in Regex_ValidNotEndWithDot
+// this expression is composed by two expressions:
+// ^.*[^\\s].*$ used to match un-empty string and is not totally empty characters.
+// [^\\\\/:*?\"<>|] used to math valid file/folder name
+// merge the two regex together:
+// valid file/folder name and is not totally empty.
+#define Regex_ValidFileFolderName QString( "^[^\\\\/:*?\"<>|]*[^\\\\/:*?\"<>|\\s][^\\\\/:*?\"<>|]*$" )
+
+// is not end with dot( trim blank characters in the end first )
+#define Regex_ValidNotEndWithDot QString( "^.*[^\\.\\s][\\s]*$" )
#endif
--- a/filemanager/src/inc/fmdrivemodel.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdrivemodel.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -22,8 +22,11 @@
#include <QDir>
#include <QFileInfo>
-FmDriveModel::FmDriveModel( QObject *parent, Options options ) :
- QAbstractListModel( parent ), mOptions( options )
+#include <hbglobal.h>
+
+FmDriveModel::FmDriveModel( QObject *parent, Options options,
+ FmDriveListProvider *driveListProvider ) :
+ QAbstractListModel( parent ), mOptions( options ), mDriveListProvider( driveListProvider )
{
mIconProvider = new FmFileIconProvider();
refresh();
@@ -36,17 +39,27 @@
void FmDriveModel::refresh()
{
- QFileInfoList infoList = QDir::drives();
-
+ emit layoutAboutToBeChanged();
mDriveList.clear();
- if( mOptions & HideUnAvailableDrive ) {
- FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_true" ) );
- FmUtils::getDriveList( mDriveList, true );
+
+ // if mDriveListProvider existed, use it to fetch drive list
+ // otherwise use FmUtils::getDriveList to fetch drive list.
+ if( mDriveListProvider ) {
+ mDriveListProvider->getDriveList( mDriveList );
} else {
- FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_false" ) );
- FmUtils::getDriveList( mDriveList, false );
+ if( mOptions & HideUnAvailableDrive ) {
+ FM_LOG( QString( "FmDriveModel::refresh HideUnAvailableDrive_true" ) );
+ FmUtils::getDriveList( mDriveList, true );
+ } else {
+ FM_LOG( QString( "FmDriveModel::refresh HideUnAvailableDrive_false" ) );
+ FmUtils::getDriveList( mDriveList, false );
+ }
}
- emit layoutChanged();
+
+ emit layoutChanged();
+ for( int i=0; i<mDriveList.count(); i++ ) {
+ emit dataChanged(index( i, 0 ), index( i, 0 ));
+ }
}
@@ -71,10 +84,7 @@
if (role == Qt::DisplayRole ) {
return displayString( index );
- } else if (role == Qt::UserRole ) {
- return driveName( index );
- }
-
+ }
if (index.column() == 0) {
if (role == Qt::DecorationRole ) {
QString path = driveName( index );
@@ -97,10 +107,10 @@
return QVariant();
switch (section) {
- case 0: return tr("Name");
- case 1: return tr("Size");
- case 2: return tr("Type");
- case 3: return tr("Date Modified");
+ case 0: return hbTrId("Name");
+ case 1: return hbTrId("Size");
+ case 2: return hbTrId("Type");
+ case 3: return hbTrId("Date Modified");
default: return QVariant();
}
}
@@ -126,17 +136,39 @@
return data;
}
-QString FmDriveModel::displayString( const QModelIndex &index ) const
+QVariant FmDriveModel::displayString( const QModelIndex &index ) const
{
- QString data;
+ QStringList data;
if (index.row() >= 0 && index.row() < mDriveList.size()) {
int row = index.row();
QString diskName = mDriveList[ row ];
if( mOptions & FillWithVolume ) {
- data = FmUtils::fillDriveVolume( diskName, mOptions & FillWithDefaultVolume );
+ data << FmUtils::fillDriveVolume( diskName, mOptions & FillWithDefaultVolume );
} else {
- data = FmUtils::removePathSplash( diskName );
+ data << FmUtils::removePathSplash( diskName );
+ }
+ diskName = FmUtils::fillPathWithSplash( diskName );
+ FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
+ if ( mOptions & FillWithTotalSize ) {
+ if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) {
+ data << QString( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) );
+ } else if( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) {
+ data << QString( hbTrId ( "Locked" ) );
+ } else if( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) {
+ data << QString( hbTrId ( "Corrupted" ) );
+ } else if( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent ) {
+ data << QString( hbTrId ( "Not Ready" ) );
+ }
+ }
+ if ( mOptions & FillWithFreeSize ) {
+ if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) {
+ data << QString( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) );
+ } else if( ( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) ||
+ ( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) ||
+ ( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent )) {
+ data << QString( QString(" ") );
+ }
}
}
return data;
--- a/filemanager/src/inc/fmdrivemodel.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdrivemodel.h Tue Aug 24 10:24:14 2010 +0800
@@ -20,22 +20,47 @@
#include <QAbstractItemModel>
#include <QStringList>
-#include <QFileIconProvider>
#include <QModelIndex>
+class FmFileIconProvider;
+
+/*!
+ \class FmDriveListProvider
+ \brief The class FmDriveListProvider provide drive list which is used in FmDriveModel
+ */
+class FmDriveListProvider
+{
+public:
+ FmDriveListProvider()
+ {
+ }
+
+ virtual ~FmDriveListProvider()
+ {
+ }
+
+ /*!
+ implement this function to provide drive list.
+ */
+ virtual void getDriveList( QStringList &driveList ) = 0;
+};
+
class FmDriveModel : public QAbstractListModel
{
Q_OBJECT
public:
enum Option
{
- FillWithVolume = 0x00000001, // add volume behind disname
- FillWithDefaultVolume = 0x00000002, // add default diskname while enable FillWithVolume and volume is empty
- HideUnAvailableDrive = 0x00000004 // for example: drive F when no MMC card inserted.
+ FillWithVolume = 0x00000001, // add volume behind disname
+ FillWithDefaultVolume = 0x00000002, // add default diskname while enable FillWithVolume and volume is empty
+ HideUnAvailableDrive = 0x00000004, // for example: drive F when no MMC card inserted.
+ FillWithTotalSize = 0x00000008, // show the drive's total size.
+ FillWithFreeSize = 0x00000010 //show the drive's free size.
};
Q_DECLARE_FLAGS(Options, Option)
- explicit FmDriveModel( QObject *parent = 0, Options options = 0 );
+ explicit FmDriveModel( QObject *parent = 0, Options options = 0,
+ FmDriveListProvider *driveListProvider = 0 );
virtual ~FmDriveModel();
void refresh();
@@ -45,13 +70,17 @@
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
bool indexValid( const QModelIndex &index ) const;
QString driveName( const QModelIndex &index ) const;
- QString displayString( const QModelIndex &index ) const;
+ QVariant displayString( const QModelIndex &index ) const;
private:
QStringList mFindResult;
- QFileIconProvider *mIconProvider;
+ FmFileIconProvider *mIconProvider;
QStringList mDriveList;
Options mOptions;
+
+ // DriveListProvider will ignore HideUnAvailableDrive option.
+ // DriveListProvide can be set by others to provide special drive list
+ FmDriveListProvider *mDriveListProvider;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(FmDriveModel::Options)
--- a/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -18,8 +18,8 @@
// INCLUDE FILES
+#include "fmdriveevent.h"
#include <e32std.h>
-#include "fmdriveevent.h"
#include "fmcommon.h"
#include <aknnotewrappers.h>
@@ -112,7 +112,7 @@
//
void CFmDriveEvent::Setup()
{
- FmLogger::log( QString( "CFmDriveEvent::Setup start" ) );
+ FM_LOG( QString( "CFmDriveEvent::Setup start" ) );
if( IsActive() )
{
return;
@@ -120,7 +120,7 @@
iFs.NotifyChange( ENotifyDisk, iStatus );
SetActive();
- FmLogger::log( QString( "CFmDriveEvent::Setup end" ) );
+ FM_LOG( QString( "CFmDriveEvent::Setup end" ) );
}
// -----------------------------------------------------------------------------
--- a/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdrivewatcherprivate.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -47,7 +47,7 @@
void FmDriveWatcherPrivate::OnDriveAddedOrChangedL()
{
- FmLogger::log( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL start" ) );
+ FM_LOG( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL start" ) );
emit driveAddedOrChanged();
- FmLogger::log( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL end" ) );
+ FM_LOG( QString( "FmDriveWatcherPrivate::OnDriveAddedOrChangedL end" ) );
}
--- a/filemanager/src/inc/fmfileiconprovider.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmfileiconprovider.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -16,56 +16,159 @@
*/
#include "fmfileiconprovider.h"
+#include "fmfiletyperecognizer.h"
#include "fmutils.h"
#include <QDir>
#include <QFileInfo>
-#define mmcIcon ":image/qgn_prop_mmc_memc.svg"
-#define mmcNoneIcon ":image/qgn_prop_fmgr_mmc_no_sub.svg"
+#include "hbicon.h"
+
+//#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"
+
+#define phoneMemoryIcon "qtg_large_mobile"
+#define massMemoryIcon "qtg_large_mass_storage"
+#define mmcIcon "qtg_large_mmc"
+#define mmcNoneIcon "qtg_large_mmc_removed"
+#define usbMemoryIcon "qtg_large_usb_memory"
+
+//TODO: UI_Update: mmcl locked icon have not provided in icon spec
+// Just use original custom-defined icon
#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"
+
+
+#define folderIcon "qtg_large_folder"
+
+#define imageIcon "qtg_large_photos"
+#define videoIcon "qtg_large_video"
+#define toneIcon "qtg_large_tone"
+#define playlistIcon "qtg_large_playlist"
+#define textIcon "qtg_large_text"
+#define sisxIcon "qtg_large_sisx"
+#define javaIcon "qtg_large_java"
+#define flashIcon "qtg_large_flash"
+#define widgetIcon "qtg_large_widget"
+#define weblinkIcon "qtg_large_web_link"
+#define queryIcon "qtg_large_query"
FmFileIconProvider::FmFileIconProvider()
{
-
+ mFileTypeRecognizer = new FmFileTypeRecognizer();
}
FmFileIconProvider::~FmFileIconProvider()
{
+ delete mFileTypeRecognizer;
}
-
+
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 );
+ QIcon retIcon;
+
+ QString filePath( info.absoluteFilePath() );
+ FmFileTypeRecognizer::FileType fileType = mFileTypeRecognizer->getType( filePath );
+ switch( fileType )
+ {
+ case FmFileTypeRecognizer::FileTypeDrive:
+ {
+ FmDriverInfo driveInfo = FmUtils::queryDriverInfo( filePath );
+ switch ( driveInfo.driveType() )
+ {
+ case FmDriverInfo::EDriveTypeMassStorage:
+ retIcon = HbIcon( massMemoryIcon ).qicon();
+ break;
+ case FmDriverInfo::EDriveTypeUsbMemory:
+ retIcon = HbIcon( usbMemoryIcon ).qicon();
+ break;
+ case FmDriverInfo::EDriveTypeMemoryCard:
+ if( !( driveInfo.driveState() & FmDriverInfo::EDriveNotPresent ) ) {
+ retIcon = HbIcon( mmcIcon ).qicon();
+ } else {
+ retIcon = HbIcon( mmcNoneIcon ).qicon();
+ }
+ break;
+ case FmDriverInfo::EDriveTypePhoneMemory:
+ retIcon = HbIcon( phoneMemoryIcon ).qicon();
+ break;
+ case FmDriverInfo::EDriveTypeNotExist: // drive not exist, let QFileIconProvider to judge icon
+ default: // filemanger do not provide icon for other drive types, let QFileIconProvider to judge icon
+ break;
+ }
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeFolder:
+ {
+ retIcon = HbIcon( folderIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeImage:
+ {
+ retIcon = HbIcon( imageIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeVideo:
+ {
+ retIcon = HbIcon( videoIcon ).qicon();
+ break;
}
- } 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 );
+ case FmFileTypeRecognizer::FileTypeTone:
+ {
+ retIcon = HbIcon( toneIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypePlaylist:
+ {
+ retIcon = HbIcon( playlistIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeText:
+ {
+ retIcon = HbIcon( textIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeSisx:
+ {
+ retIcon = HbIcon( sisxIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeJava:
+ {
+ retIcon = HbIcon( javaIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeFlash:
+ {
+ retIcon = HbIcon( flashIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeWidget:
+ {
+ retIcon = HbIcon( widgetIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeWebLink:
+ {
+ retIcon = HbIcon( weblinkIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeUnKnown:
+ {
+ // currently filemanger icon doc is not unified with icon name.
+ // for example, qtg_small_unknown qtg_large_query both means for unknown type
+ // but the two icon name is not the same.
+ retIcon = HbIcon( queryIcon ).qicon();
+ break;
+ }
}
- } else {
- return QFileIconProvider::icon( info );
+
+ // if cannot get icon, return icon from QFileIconProvider
+ if( retIcon.isNull() ) {
+ retIcon = QFileIconProvider::icon( info );
}
+ return retIcon;
}
--- a/filemanager/src/inc/fmfileiconprovider.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmfileiconprovider.h Tue Aug 24 10:24:14 2010 +0800
@@ -20,16 +20,21 @@
#include <QFileIconProvider>
+class FmFileTypeRecognizer;
+
class FmFileIconProvider : public QFileIconProvider
{
public:
FmFileIconProvider();
virtual ~FmFileIconProvider();
+ // from QFileIconProvider
virtual QIcon icon(const QFileInfo &info) const;
private:
+ FmFileTypeRecognizer *mFileTypeRecognizer;
+
};
#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/inc/fmfiletyperecognizer.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,109 @@
+/*
+ * 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 the file type recognizer
+ */
+
+#include "fmfiletyperecognizer.h"
+#include "fmutils.h"
+#include <QFileInfo>
+#include <QStringList>
+
+FmFileTypeRecognizer::FmFileTypeRecognizer()
+{
+ mFileExtensionMap.insert( QString( "bmp" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "gif" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "jpe" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "jpeg" ),FileTypeImage );
+ mFileExtensionMap.insert( QString( "jpg" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "ota" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "png" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "tif" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "tiff" ),FileTypeImage );
+ mFileExtensionMap.insert( QString( "wbmp" ),FileTypeImage );
+ mFileExtensionMap.insert( QString( "wmf" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "jp2" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "jpg2" ),FileTypeImage );
+ mFileExtensionMap.insert( QString( "jp3" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "ico" ), FileTypeImage );
+ mFileExtensionMap.insert( QString( "vcf" ), FileTypeImage );
+
+ mFileExtensionMap.insert( QString( "3gp" ), FileTypeVideo );
+ mFileExtensionMap.insert( QString( "mp4" ), FileTypeVideo );
+ mFileExtensionMap.insert( QString( "nim" ), FileTypeVideo );
+ mFileExtensionMap.insert( QString( "rm" ), FileTypeVideo );
+ mFileExtensionMap.insert( QString( "rv" ), FileTypeVideo );
+ mFileExtensionMap.insert( QString( "wmv" ), FileTypeVideo );
+ mFileExtensionMap.insert( QString( "3g2" ), FileTypeVideo );
+ mFileExtensionMap.insert( QString( "rmvb" ),FileTypeVideo );
+ mFileExtensionMap.insert( QString( "mkv" ), FileTypeVideo );
+
+
+ mFileExtensionMap.insert( QString( "aac" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "amr" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "au" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "awb" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "mid" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "mp3" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "ra" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "rmf" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "rng" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "snd" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "wav" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "wve" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "wma" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "m4a" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "ott" ), FileTypeTone );
+ mFileExtensionMap.insert( QString( "mxmf" ),FileTypeTone );
+
+ mFileExtensionMap.insert( QString( "doc" ), FileTypeText );
+ mFileExtensionMap.insert( QString( "pdf" ), FileTypeText );
+ mFileExtensionMap.insert( QString( "pps" ), FileTypeText );
+ mFileExtensionMap.insert( QString( "ppt" ), FileTypeText );
+ mFileExtensionMap.insert( QString( "txt" ), FileTypeText );
+ mFileExtensionMap.insert( QString( "xls" ), FileTypeText );
+
+ mFileExtensionMap.insert( QString( "sis" ), FileTypeSisx );
+ mFileExtensionMap.insert( QString( "sisx" ),FileTypeSisx );
+
+ mFileExtensionMap.insert( QString( "jad" ), FileTypeJava );
+ mFileExtensionMap.insert( QString( "jar" ), FileTypeJava );
+
+ mFileExtensionMap.insert( QString( "swf" ), FileTypeFlash );
+
+ // have not handle FileTypePlaylist
+ // have not handle FileTypeWidget
+ // have not handle FileTypeWebLink
+}
+
+FmFileTypeRecognizer::~FmFileTypeRecognizer()
+{
+
+}
+
+FmFileTypeRecognizer::FileType FmFileTypeRecognizer::getType( const QString& path ) const
+{
+ if( FmUtils::isDrive( path ) ) {
+ return FileTypeDrive;
+ }
+
+ QFileInfo fileInfo(path);
+ if( fileInfo.isDir() ) {
+ return FileTypeFolder;
+ }
+
+ //if can not find key, return default value: FileTypeUnKnown
+ return mFileExtensionMap.value( fileInfo.suffix().toLower(), FileTypeUnKnown );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/inc/fmfiletyperecognizer.h Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,67 @@
+/*
+ * 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 file type recognizer
+ */
+
+#ifndef FMFILETYPERECOGNIZER_H
+#define FMFILETYPERECOGNIZER_H
+
+#include "fmcommon.h"
+#include <QString>
+#include <QList>
+#include <QStringList>
+#include <QMap>
+
+/*!
+ \class FmFileTypeRecognizer
+ \brief The class FmFileTypeRecognizer used to recognize file type by path.
+ */
+class FmFileTypeRecognizer
+{
+public:
+ enum FileType{
+ FileTypeDrive,
+ FileTypeFolder,
+ FileTypeImage,
+ FileTypeVideo,
+ FileTypeTone,
+ FileTypePlaylist,
+ FileTypeText,
+ FileTypeSisx,
+ FileTypeJava,
+ FileTypeFlash,
+ FileTypeWidget,
+ FileTypeWebLink,
+ FileTypeUnKnown
+ };
+
+
+public:
+ FmFileTypeRecognizer();
+ virtual ~FmFileTypeRecognizer();
+
+ /*!
+ Recognize file type, currently only judge file by its extension name.
+ */
+ FmFileTypeRecognizer::FileType getType( const QString& path ) const ;
+
+private:
+ // used to store single extension name, FileType pare.
+ QMap<QString, FileType> mFileExtensionMap;
+};
+
+#endif /* FMFILETYPERECOGNIZER_H */
+
--- a/filemanager/src/inc/fmlogger.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmlogger.h Tue Aug 24 10:24:14 2010 +0800
@@ -20,10 +20,16 @@
#define FMLOG_PATH QString( "C:\\data\\fileman.txt" )
-
#include <QString>
#include <QFile>
#include <QTextStream>
+#include <QDateTime>
+
+#ifdef _DEBUG_LOG_ENABLE_
+ #define FM_LOG(str) FmLogger::log( str );
+#else
+ #define FM_LOG(str)
+#endif
class FmLogger
{
@@ -32,14 +38,14 @@
static bool log( const QString &log )
{
#ifdef _DEBUG_LOG_ENABLE_
+ QString logStr( QDateTime::currentDateTime().toString("hh:mm:ss:zzz") + " " + log + "\r\n" );
QFile file( FMLOG_PATH );
if ( !file.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
return false;
}
QTextStream out( &file );
- out << log;
- out << "\r\n";
+ out << logStr;
#else
Q_UNUSED( log );
#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/inc/fmutils.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,412 @@
+/*
+* 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:
+* Zhiqiang Yang <zhiqiang.yang@nokia.com>
+*
+* Description:
+* The source file of the file manager utilities
+*/
+
+#include "fmutils.h"
+
+#include <QDir>
+#include <QFileInfo>
+
+#include <hbglobal.h>
+
+/*!
+ Used to get drive type for convenience.
+*/
+FmDriverInfo::DriveType FmDriverInfo::driveType()
+{
+ FmDriverInfo::DriveType driveType;
+ if( mDriveState & FmDriverInfo::EDriveRemovable ) {
+ // if drive is removable, it may be mass, usb, or remote drive
+ if( mDriveState & FmDriverInfo::EDriveMassStorage ) {
+ driveType = FmDriverInfo::EDriveTypeMassStorage;
+ } else if( mDriveState & FmDriverInfo::EDriveUsbMemory ) {
+ driveType = FmDriverInfo::EDriveTypeUsbMemory;
+ } else if( mDriveState & FmDriverInfo::EDriveRemote ){
+ driveType = FmDriverInfo::EDriveTypeRemote;
+ } else {
+ driveType = FmDriverInfo::EDriveTypeMemoryCard;
+ }
+ } else if( mDriveState & FmDriverInfo::EDriveRom ) {
+ driveType = FmDriverInfo::EDriveTypeRom;
+ } else if( mDriveState & FmDriverInfo::EDriveRam ) {
+ driveType = FmDriverInfo::EDriveTypeRam;
+ } else {
+ // if drive type is not recognized in previous condition,
+ // it should be an un-existed drive or phone memory
+ if( mDriveState & EDriveNotPresent ){
+ // if come here, means 2 conditions:
+ // 1 this drive is not exist( FmUtils::queryDriverInfo will give EDriveNotPresent to mDriveState )
+ // 2 un-mounted removable drive
+ // removable drive filted in previous condifiton. So, give EDriveTypeNotExist
+ driveType = FmDriverInfo::EDriveTypeNotExist;
+ } else {
+ // drive is existed, only remain the type of EDriveTypePhoneMemory
+ driveType = FmDriverInfo::EDriveTypePhoneMemory;
+ }
+ }
+
+ return driveType;
+}
+
+/*!
+ return drive name for \a path
+*/
+QString FmUtils::getDriveNameFromPath( const QString &path )
+{
+ // fillPathWithSplash make sure path length will be at least 3 if it is not empty.
+ QString checkedPath( fillPathWithSplash( path ) );
+ if( checkedPath.length() < 3 ) {
+ return QString();
+ }
+ return checkedPath.left( 3 );
+}
+
+/*!
+ return drive letter for \a path
+*/
+QString FmUtils::getDriveLetterFromPath( const QString &path )
+{
+ if( path.length() <2 ) {
+ return QString();
+ }
+ return path.left( 1 );
+}
+
+/*!
+ return formatted string for size.
+*/
+QString FmUtils::formatStorageSize( quint64 size )
+{
+ if ( size < 1000 ) {
+ return QString::number( size ) + " B";
+ } else if ( size < 1000 * 1000 ) {
+ return QString::number( size / 1024.0, 'f', 2 ) + " KB";
+ } else if ( size < 1000 * 1000 * 1000 ) {
+ return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB";
+ } else {
+ return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB";
+ }
+}
+
+/*!
+ Judge if a path is drive path, not a folder or a file.
+ For example, true for C:\ while false for C:\data
+*/
+bool FmUtils::isDrive( const QString &path )
+{
+ bool ret( false );
+ if( path.length() <= 3 && path.length() >=2 ) {
+ ret = true;
+ }
+
+ return ret;
+}
+
+/*!
+ All "/" and "\" in \a path will be changed to QDir::separator
+ \sa fillPathWithSplash, fillPathWithSplash will append QDir::separator in the end
+*/
+QString FmUtils::formatPath( const QString &path )
+{
+ QString formatPath;
+ if( path.isEmpty() ) {
+ return formatPath;
+ }
+
+ foreach( const QChar &ch, path ) {
+ if( ch == QChar('\\') || ch == QChar('/') ) {
+ formatPath.append( QDir::separator() );
+ } else {
+ formatPath.append( ch );
+ }
+ }
+
+ return formatPath;
+}
+
+/*!
+ Fill splash in the end of \a filePath. And all "/" and "\" will be changed to QDir::separator
+ Please do not call this function if path is a file.
+ Use \a formatPath instead, \a formatPath will not append QDir::separator in the end.
+ \sa formatPath only changed "/" and "\" to QDir::separator
+*/
+QString FmUtils::fillPathWithSplash( const QString &filePath )
+{
+ QString newFilePath;
+ if( filePath.isEmpty() ) {
+ return newFilePath;
+ }
+
+ newFilePath = formatPath( filePath );
+
+ if( newFilePath.right( 1 )!= QDir::separator() ){
+ newFilePath.append( QDir::separator() );
+ }
+ return newFilePath;
+}
+
+/*!
+ Remove splash in the end of \a filePath.
+*/
+QString FmUtils::removePathSplash( const QString &filePath )
+{
+ QString newFilePath( filePath );
+ if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) {
+ newFilePath = filePath.left( filePath.length() - 1 );
+ }
+ return newFilePath;
+}
+
+/*!
+ fill \a driveList of drives can be shown in driveListView
+*/
+void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive )
+{
+ if( isHideUnAvailableDrive ) {
+ FM_LOG( QString( "getDriveList HideUnAvailableDrive_true" ) );
+ } else {
+ FM_LOG( QString( "getDriveList HideUnAvailableDrive_false" ) );
+ }
+ QFileInfoList infoList = QDir::drives();
+
+ foreach( const QFileInfo &fileInfo, infoList ) {
+ QString driveName = fileInfo.absolutePath();
+ if( checkDriveAccessFilter( driveName ) ) {
+ if( !isHideUnAvailableDrive ) {
+ driveList.append( driveName );
+ }
+ else if ( isDriveAvailable( driveName ) ) {
+ driveList.append( driveName );
+ }
+ }
+ }
+ return;
+}
+
+/*!
+ return the combined string of drive name and volume( e.g. C: Phone memory for C drive)
+ \a driveName the drive name.
+ If set \a isFillWithDefaultVolume true, fill result with default volume if drive volume is empty.
+*/
+QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume )
+{
+ QString ret;
+ if( driveName.isEmpty() ) {
+ return ret;
+ }
+ QString tempDriveName = fillPathWithSplash( driveName );
+
+ QString checkedDriveName( removePathSplash( driveName ) );
+
+ FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName );
+ QString volumeName = driverInfo.volumeName();
+
+ if( volumeName.isEmpty() && isFillWithDefaultVolume ){
+ switch ( driverInfo.driveType() )
+ {
+ case FmDriverInfo::EDriveTypeMassStorage:
+ ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName );
+ break;
+ case FmDriverInfo::EDriveTypeUsbMemory:
+ ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName );
+ break;
+ case FmDriverInfo::EDriveTypeMemoryCard:
+ ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName );
+ break;
+ case FmDriverInfo::EDriveTypePhoneMemory:
+ ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName );
+ break;
+ case FmDriverInfo::EDriveTypeNotExist:// no such drive
+ default:// do not need get volume for other drive types, e.g. Ram, Rom
+ break;
+ }
+ }
+
+ if( ret.isEmpty() ) {
+ // ret is not got. fill ret as default method
+ // txt_fmgr_dblist_1_2 is not correct, can not use.
+ ret = hbTrId( "%1 %2" ).arg( checkedDriveName ).arg( volumeName );
+ }
+ return ret;
+}
+
+/*!
+ return the default volume for drive
+ \a driveName the drive.
+ \sa getVolumeNameWithDefaultNameIfNull
+*/
+QString FmUtils::getDefaultVolumeName( const QString &driveName )
+{
+ QString defaultVolumeName;
+ FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName );
+
+ switch ( driverInfo.driveType() )
+ {
+ case FmDriverInfo::EDriveTypeMassStorage:
+ defaultVolumeName = hbTrId("Mass storage");
+ break;
+ case FmDriverInfo::EDriveTypeUsbMemory:
+ defaultVolumeName = hbTrId("USB memory");
+ break;
+ case FmDriverInfo::EDriveTypeMemoryCard:
+ defaultVolumeName = hbTrId("Memory card");
+ break;
+ case FmDriverInfo::EDriveTypePhoneMemory:
+ defaultVolumeName = hbTrId("Device memory");
+ break;
+ case FmDriverInfo::EDriveTypeNotExist:// no such drive, break and return empty string
+ default:// do not have default volume for other drive types, e.g. Ram, Rom
+ break;
+ }
+ return defaultVolumeName;
+}
+
+/*!
+ get the volume name of the drive, if it is null, then return the default name.
+ \a driveName the drive letter.
+ \a defaultName whether it is the default name.
+ return the volume name.
+*/
+QString FmUtils::getVolumeNameWithDefaultNameIfNull( const QString &driveName, bool &defaultName )
+{
+ // do not re-use FmUtils::getDefaultVolumeName to save one time for call FmUtils::queryDriverInfo
+ FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName );
+
+ QString volumeName = driverInfo.volumeName();
+ //save the volume status, whether it is default name
+ defaultName = false;
+ //volume name may be null if not set, it will be set at least for one time in the following while cycling.
+ if ( volumeName.isEmpty() ) {
+ switch ( driverInfo.driveType() )
+ {
+ case FmDriverInfo::EDriveTypeMassStorage:
+ volumeName = hbTrId("Mass storage");
+ break;
+ case FmDriverInfo::EDriveTypeUsbMemory:
+ volumeName = hbTrId("USB memory");
+ break;
+ case FmDriverInfo::EDriveTypeMemoryCard:
+ volumeName = hbTrId("Memory card");
+ break;
+ case FmDriverInfo::EDriveTypePhoneMemory:
+ volumeName = hbTrId("Device memory");
+ break;
+ case FmDriverInfo::EDriveTypeNotExist:// no such drive
+ default:// do not need get volume for other drive types, e.g. Ram, Rom
+ break;
+ }
+ if( !volumeName.isEmpty() ) {
+ defaultName = true;
+ }
+ }
+ return volumeName;
+}
+
+/*!
+ Check if two path are the same.
+*/
+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;
+}
+
+/*!
+ Check if a name is illegal for folder/file naming rule.
+*/
+bool FmUtils::checkFolderFileName( const QString& name )
+{
+ // trim space firest, because there may be some spaces after "." , it is also not valid
+ QString trimmedName( name.trimmed() );
+ if( trimmedName.isEmpty() ) {
+ return false;
+ }
+ if( trimmedName.endsWith( QChar('.'), Qt::CaseInsensitive ) ) {
+ return false;
+ }
+ if( trimmedName.contains( QChar('\\'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar('/'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar(':'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar('*'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar('?'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar('\"'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar('<'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar('>'), Qt::CaseInsensitive ) ||
+ trimmedName.contains( QChar('|'), Qt::CaseInsensitive ) ){
+ return false;
+ }
+ // use original name to exam max size of file name
+ if( name.length() > getMaxFileNameLength() ) {
+ return false;
+ }
+ return true;
+}
+
+/*!
+ check file or folder path is illegal or not.
+ \a fileName file/folder name, used to check illegal characters
+ \a path file/folder path, used to check if path is available to use.
+ \a errString if return false, errString will be set for error note.
+ return true for not illegal and false for illegal path.
+*/
+bool FmUtils::checkNewFolderOrFile( const QString &fileName, const QString &path, QString &errString )
+{
+ // first check if fileName is valid, then check if path length is valid, and check if file/foler is existed at last
+ QFileInfo fileInfo( path );
+ bool ret( true );
+ if (!FmUtils::checkFolderFileName( fileName ) ) {
+ errString = hbTrId( "Invalid file or folder name!" );
+ ret = false;
+ } else if( !FmUtils::checkMaxPathLength( path ) ) {
+ errString = hbTrId( "the path you specified is too long!" );
+ ret = false;
+ } else if (fileInfo.exists()) {
+ errString = hbTrId( "%1 already exist!" ).arg( fileInfo.fileName() );
+ ret = false;
+ }
+ return ret;
+}
+
+/*!
+ Check if \a dest is sub level path of \a src
+ Used to check True/False when copy a folder to itself or its subfolder
+ For example, c:\data\test is sub path of c:\data.
+ But c:\data123\test is not sub path of c:\data.
+ So after got right part of path, the first char must be \ or /
+*/
+bool FmUtils::isSubLevelPath( const QString &src, const QString &dest )
+{
+ FM_LOG("FmUtils::isSubFolder: src=" + src + " dest=" + dest);
+ QString checkedSrc( FmUtils::fillPathWithSplash( src ) );
+ QString checkedDest( FmUtils::fillPathWithSplash( dest ) );
+
+ if( checkedDest.contains( checkedSrc, Qt::CaseInsensitive) &&
+ checkedDest.length() > checkedSrc.length() ) {
+ // for example c:\data\ vs c:\data\123\
+ FM_LOG("FmUtils::isSubFolder: true");
+ return true;
+ }
+ // for example c:\data\ vs c:\data\
+ // for example c:\data\ vs c:\data123\
+
+ FM_LOG("FmUtils::isSubFolder: false");
+ return false;
+}
--- a/filemanager/src/inc/fmutils.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmutils.h Tue Aug 24 10:24:14 2010 +0800
@@ -23,29 +23,55 @@
#include <QString>
+/*!
+ \class FmDriverInfo
+ \brief The class FmDriverInfo provide drive info data
+ */
class FmDriverInfo
{
public:
+ /*!
+ Used to get drive status for convenience.
+ /sa DriveType is used to get drive type.
+ */
enum driveState
{
- EDriveNotPresent = 0x1,
- EDriveLocked = 0x2,
- EDriveCorrupted = 0x4,
- EDriveWriteProtected = 0x8,
- EDriveRemovable = 0x10,
- EDriveRom = 0x20,
- EDriveFormattable = 0x40,
- EDriveFormatted = 0x80,
- EDriveLockable = 0x100,
- EDrivePasswordProtected = 0x200,
- EDriveBackupped = 0x400,
- EDriveConnected = 0x800,
- EDriveEjectable = 0x1000,
- EDriveInUse = 0x2000,
- EDriveMassStorage = 0x4000,
- EDriveRam = 0x8000,
- EDriveAvailable = 0x10000
+ EDriveNotPresent = 0x1, // true when Drive have not inserted, for example, MMC Card
+ EDriveAvailable = 0x2, // false when drive is locked or corrupted, for example MMC Card
+ EDriveLocked = 0x4,
+ EDriveCorrupted = 0x8,
+ EDriveWriteProtected = 0x10,
+ EDriveRemovable = 0x20,
+ EDriveRom = 0x40,
+ EDriveFormattable = 0x80,
+ EDriveFormatted = 0x100,
+ EDriveLockable = 0x200,
+ EDrivePasswordProtected = 0x400,
+ EDriveBackupped = 0x800,
+ EDriveConnected = 0x1000,
+ EDriveEjectable = 0x2000,
+ EDriveInUse = 0x4000,
+ EDriveMassStorage = 0x8000,
+ EDriveRam = 0x10000,
+ EDriveUsbMemory = 0x20000,
+ EDriveRemote = 0x40000,
};
+
+ /*!
+ Used to get drive type for convenience.
+ */
+ enum DriveType
+ {
+ EDriveTypeNotExist = -1, // specified drive is not existed in device
+ EDriveTypeRom,
+ EDriveTypeRam,
+ EDriveTypePhoneMemory,
+ EDriveTypeMassStorage,
+ EDriveTypeMemoryCard,
+ EDriveTypeUsbMemory,
+ EDriveTypeRemote,
+ };
+
Q_DECLARE_FLAGS( DriveState, driveState )
FmDriverInfo( quint64 s, quint64 f, const QString &n, const QString &vN, const quint32 driveState ) :
@@ -64,62 +90,121 @@
this->mDriveState = rhs.mDriveState;
return *this;
}
-
+
+ /*!
+ Total size for drive
+ */
quint64 size() const { return mSize; }
+
+ /*!
+ Free size for drive
+ */
quint64 freeSize() const { return mFreeSize; }
+
+ /*!
+ path for drive
+ */
QString name() const { return mName; }
+
+ /*!
+ volume for drive
+ */
QString volumeName() const { return mVolumeName; }
+
+ /*!
+ status for drive
+ */
DriveState driveState() const { return mDriveState; }
+ /*!
+ drive type
+ */
+ DriveType driveType();
+
private:
quint64 mSize;
quint64 mFreeSize;
QString mName;
QString mVolumeName;
DriveState mDriveState;
+ DriveType mDriveType;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( FmDriverInfo::DriveState )
+/*!
+ \class FmUtils
+ \brief The class FmUtils provide util functions
+ This class is implemented by three parts:
+ fmutils.cpp for Qt Based functions
+ fmutils_s60.cpp is symbian implement version for platform based functions
+ fmutils_win.cpp is win32 implement version for platform based functions( a simple wrapper )
+ */
class FmUtils
{
public:
- static QString getDriveNameFromPath( const QString &path );
- static QString getDriveLetterFromPath( const QString &path );
+ //////////////////////////////////////////////////////////////////
+ // <QtBasedFunctions>
+ static QString getDriveNameFromPath( const QString &path );
+ static QString getDriveLetterFromPath( const QString &path );
+ static QString formatStorageSize( quint64 size );
+ static bool isDrive( const QString &path );
+ static QString formatPath( const QString &path );
+ static QString fillPathWithSplash( const QString &filePath );
+ static QString removePathSplash( const QString &filePath );
+ static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive );
+ static QString fillDriveVolume( QString driveName, bool isFillWithDefaultVolume );
+ static QString getDefaultVolumeName( const QString &driveName );
+ static QString getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName );
+ static bool isPathEqual( const QString &pathFst, const QString &pathLast );
+ static bool checkFolderFileName( const QString& name );
+ static bool checkNewFolderOrFile( const QString& fileName, const QString &path, QString &errString );
+ static bool isSubLevelPath( const QString &src, const QString &dest );
+ // </QtBasedFunctions>
+ //////////////////////////////////////////////////////////////////
+
+
+ //////////////////////////////////////////////////////////////////
+ // <platformBasedFunctions>
static FmDriverInfo queryDriverInfo( const QString &driverName );
- static QString formatStorageSize( quint64 size );
- //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 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( QStringList &filePathList );
- static QString getBurConfigPath( QString appPath );
- static bool isDefaultFolder( const QString &folderPath );
- static QString Localize( const QString &path );
-
+
+ // password related functions
+ 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 );
+
+ // external drive related functions
+ static int renameDrive( const QString &driverName, const QString &newVolumeName);
+ static int ejectDrive( const QString &driverName );
+
+ // drive security related functions
+ static bool checkDriveAccessFilter( const QString &driveName );
+ static QString checkDriveToFolderFilter( const QString &path );
+ static QString checkFolderToDriveFilter( const QString &path );
+ static int isPathAccessabel( const QString &path );
+ static bool isDriveAvailable( const QString &path );
+
+ // system default folder related functions
+ static bool isDefaultFolder( const QString &folderPath );
+ static void createDefaultFolders( const QString &driverName );
+ static QString localize( const QString &path );
+
+ // copy move related functions
+ static int setFileAttributes( const QString &srcFile, const QString &desFile );
+ static bool hasEnoughSpace( const QString &targetDrive, qint64 size );
+ static int moveInsideDrive( const QString &source, const QString &target );
+
+ // other fucntions
+ static int launchFile( const QString &filePath );
+ static void sendFiles( QStringList &filePathList );
+ static QString getBurConfigPath( QString appPath );
+ static QString getFileType( const QString &filePath );
+ static bool isDriveC( const QString &driverName );
+ static int getMaxFileNameLength();
+ static bool checkMaxPathLength( const QString& path );
+ // </platformBasedFunctions>
+ //////////////////////////////////////////////////////////////////
};
#endif
--- a/filemanager/src/inc/fmutils_s60.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmutils_s60.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -13,82 +13,96 @@
* Zhiqiang Yang <zhiqiang.yang@nokia.com>
*
* Description:
-* The source file of the file manager utilities
+* The source file of the file manager utilities on Symbian
*/
#include "fmutils.h"
+#include "fmcommon.h"
#include "fms60utils.h"
-#include "fmcommon.h"
-#include <QRegExp>
-
+#include <apgcli.h>
+#include <sysutil.h>
+#include <f32file.h>
#include <coemain.h>
+#include <pathinfo.h>
#include <driveinfo.h>
#include <e32property.h>
#include <coreapplicationuisdomainpskeys.h>
-#include <f32file.h>
-#include <apgcli.h>
-#include <pathinfo.h>
-#include <CDirectoryLocalizer.h>
-#include <XQConversions>
+
+#include <QDir>
+#include <QFile>
+#include <QRegExp>
#include <QStringList>
#include <QFileInfoList>
-#include <QDir>
-#include <QFile>
+#include <xqappmgr.h>
+#include <XQConversions>
#include <xqaiwrequest.h>
-#include <xqappmgr.h>
-#include <shareuidialog.h>
+#include <shareui.h>
+#include <hbglobal.h>
+#include <hbdirectorynamelocalizer.h>
#define BURCONFIGFILE "z:/private/2002BCC0/burconfig.xml"
-QString FmUtils::getDriveNameFromPath( const QString &path )
+/*!
+ query drive info and status for \a driveName
+ return \a FmDriverInfo
+*/
+FmDriverInfo FmUtils::queryDriverInfo( const QString &driveName )
{
- if( path.length() <3 ) {
- return QString();
+ if( driveName.isEmpty() ) {
+ return FmDriverInfo( 0, 0, driveName, QString(), FmDriverInfo::EDriveNotPresent );
}
- 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();
TVolumeInfo volumeInfo;
TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
quint32 state( 0 );
- int err = fs.Volume( volumeInfo, drive );
+
+ int volumeInfoErr( KErrNone );
+ int driveInfoErr( KErrNone );
+ int errorCode( KErrNone );
+ volumeInfoErr = fs.Volume( volumeInfo, drive );
+ errorCode = volumeInfoErr;
QString volumeName( (QChar*)( volumeInfo.iName.Des().Ptr() ), volumeInfo.iName.Length() );
-
- if( err == KErrNone ) {
- TDriveInfo driveInfo = volumeInfo.iDrive;
+
+ TDriveInfo driveInfo;
+ if( volumeInfoErr == KErrNone ) {
+ driveInfo = volumeInfo.iDrive;
+ } else {
+ driveInfoErr = fs.Drive( driveInfo, drive );
+ if( driveInfoErr != KErrNone ) {
+ errorCode = driveInfoErr;
+ }
+ }
+
+ if( volumeInfoErr == KErrNone || driveInfoErr == KErrNone ) {
+ //TDriveInfo driveInfo = volumeInfo.iDrive;
quint32 drvStatus( 0 );
- err = DriveInfo::GetDriveStatus( fs, drive, drvStatus );
+ int 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::EDriveUsbMemory )
+ {
+ state |= FmDriverInfo::EDriveUsbMemory;
+ }
+
+ if ( drvStatus & DriveInfo::EDriveRemote )
+ {
+ state |= FmDriverInfo::EDriveRemote;
+ }
if ( drvStatus & DriveInfo::EDriveRom ){
state |= FmDriverInfo::EDriveRom;
@@ -123,12 +137,36 @@
state |= FmDriverInfo::EDriveNotPresent;
}
}
+ // If memory card is not ready but type is present,
+ // then check if it is reserved.
+ if( err == KErrNone && volumeInfoErr == KErrNotReady &&
+ driveInfo.iType != EMediaNotPresent )
+ {
+ // Check USB file transfer state
+ TInt prop( ECoreAppUIsUSBFileTransferUninitialized );
+ RProperty::Get(
+ KPSUidCoreApplicationUIs,
+ KCoreAppUIsUSBFileTransfer, prop );
+ if ( prop == ECoreAppUIsUSBFileTransferActive )
+ {
+ errorCode = KErrInUse; // Reserved for file transfer
+ }
+ }
+ if( err!= KErrNone )
+ {
+ errorCode = err;
+ }
}
- //handle error code
- switch( err )
+
+ // handle error code
+ // volumeInfoErr will occur while drive is lock,corrupted...
+ // driveInfoErr can not be promoted for locked, corrupted drive.
+ // so we can not use driveInfoErr to justify EDriveAvailable
+ switch( errorCode )
{
case KErrNone:
- state |= FmDriverInfo::EDriveAvailable;
+ // this drive could be used as it is not be locked, or corrupt.
+ state |= FmDriverInfo::EDriveAvailable;
break;
case KErrLocked:
state |= FmDriverInfo::EDriveLocked;
@@ -136,114 +174,42 @@
case KErrCorrupt:
state |= FmDriverInfo::EDriveCorrupted;
break;
+ case KErrInUse:
+ state |= FmDriverInfo::EDriveInUse;
+ break;
default: // other errors
state |= FmDriverInfo::EDriveNotPresent;
break;
}
- return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driverName, volumeName, state );
+ QString logString ( "FmUtils::queryDriverInfo_" + driveName +
+ "_volumeInfoErr:" + QString::number( volumeInfoErr ) +
+ "_driveInfoErr:" + QString::number( driveInfoErr ) +
+ "_errorCode:" + QString::number( errorCode ) +
+ "_driveSatus:" + QString::number( state ) );
+ FM_LOG( logString );
+ return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driveName, volumeName, state );
}
-QString FmUtils::formatStorageSize( quint64 size )
+/*!
+ remove drive password for \a driveName
+ \a Pwd is original password.
+*/
+int FmUtils::removeDrivePwd( const QString &driveName, const QString &Pwd )
{
- if ( size < 1000 ) {
- return QString::number( size ) + " B";
- } else if ( size < 1000 * 1000 ) {
- return QString::number( size / 1024.0, 'f', 2 ) + " KB";
- } else if ( size < 1000 * 1000 * 1000 ) {
- return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB";
- } else {
- return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB";
- }
-}
-/*
-quint32 FmUtils::getDriverState( const QString &driverName )
-{
- 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() );
-
- //handle error code
- if( err != KErrNone ) {
- state |= FmDriverInfo::EDriveNotPresent;
- }
- if ( err == KErrLocked ) {
- state |= FmDriverInfo::EDriveLocked;
- }
-
- TDriveInfo driveInfo = volumeInfo.iDrive;
-
- quint32 drvStatus( 0 );
- DriveInfo::GetDriveStatus( fs, drive, drvStatus );
-
- 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( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) {
+ return FmErrWrongParam;
}
-
-
- 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;
- }
-
- return state;
-
-}
-*/
-
-int FmUtils::removeDrivePwd( const QString &driverName, const QString &Pwd )
-{
- QString logString = "Drive name:" + driverName;
- FmLogger::log( logString );
+ QString logString = "Drive name:" + driveName;
+ FM_LOG( logString );
logString = "Password:" + Pwd;
- FmLogger::log( logString );
+ FM_LOG( logString );
CCoeEnv *env = CCoeEnv::Static();
RFs& fs = env->FsSession();
TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
HBufC* password16 = XQConversions::qStringToS60Desc( Pwd );
TMediaPassword password;
@@ -253,10 +219,12 @@
int err( fs.ClearPassword( drive, password ) );
logString = "Drive:" + QString::number( drive );
- FmLogger::log( logString );
+ FM_LOG( logString );
logString = "Clear password error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
+
+ delete password16;
if( err == KErrNone ){
return FmErrNone;
@@ -269,18 +237,24 @@
}
}
-int FmUtils::unlockDrive( const QString &driverName, const QString &Pwd )
+/*!
+ Unlock drive \a driveName with provided password \a Pwd
+*/
+int FmUtils::unlockDrive( const QString &driveName, const QString &Pwd )
{
- QString logString = "Drive name:" + driverName;
- FmLogger::log( logString );
+ if( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) {
+ return FmErrWrongParam;
+ }
+ QString logString = "Drive name:" + driveName;
+ FM_LOG( logString );
logString = "Password:" + Pwd;
- FmLogger::log( logString );
+ FM_LOG( logString );
CCoeEnv *env = CCoeEnv::Static();
RFs& fs = env->FsSession();
TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
HBufC* password16 = XQConversions::qStringToS60Desc( Pwd );
TMediaPassword password;
@@ -290,9 +264,11 @@
int err( fs.UnlockDrive( drive, password, ETrue) );
logString = "Drive:" + QString::number( drive );
- FmLogger::log( logString );
+ FM_LOG( logString );
logString = "Unlock drive error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
+
+ delete password16;
if( err == KErrNone ){
return FmErrNone;
@@ -311,27 +287,40 @@
}
}
-int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd )
+/*!
+ Check if \a pwd is the right password for drive \a driveName
+*/
+int FmUtils::checkDrivePwd( const QString &driveName, const QString &pwd )
{
- QString logString = "checkDrivePwd Drive name:" + driverName;
+ if( driveName.isEmpty() || pwd.length() > FmMaxLengthofDrivePassword ) {
+ return FmErrWrongParam;
+ }
+ QString logString = "checkDrivePwd Drive name:" + driveName;
logString += " password:" + pwd;
- FmLogger::log( logString );
+ FM_LOG( logString );
- return setDrivePwd( driverName, pwd, pwd );
+ return setDrivePwd( driveName, pwd, pwd );
}
-int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd)
+/*!
+ Set new password \a newPwd for drive \a driveName. \a oldPwd is old password
+*/
+int FmUtils::setDrivePwd( const QString &driveName, const QString &oldPwd, const QString &newPwd)
{
- QString logString = "setDrivePwd Drive name:" + driverName ;
+ if( driveName.isEmpty() ||
+ oldPwd.length() > FmMaxLengthofDrivePassword || newPwd.length() > FmMaxLengthofDrivePassword ) {
+ return FmErrWrongParam;
+ }
+ QString logString = "setDrivePwd Drive name:" + driveName ;
logString += " Old password:" + oldPwd;
logString += " New password:" + newPwd;
- FmLogger::log( logString );
+ FM_LOG( logString );
CCoeEnv *env = CCoeEnv::Static();
RFs& fs = env->FsSession();
TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
HBufC* newPassword16 = XQConversions::qStringToS60Desc( newPwd);
HBufC* oldPassword16 = XQConversions::qStringToS60Desc( oldPwd );
@@ -348,10 +337,12 @@
int err( fs.LockDrive( drive, oldPassword, newPassword, ETrue ) );
logString = "Drive:" + QString::number( drive );
- FmLogger::log( logString );
+ FM_LOG( logString );
logString = "Password set error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
+ delete newPassword16;
+ delete oldPassword16;
if( err == KErrNone ){
return FmErrNone;
}
@@ -363,17 +354,26 @@
}
}
+/*!
+ Set \a pwd as empty password
+*/
void FmUtils::emptyPwd( QString &pwd )
{
- TPtr des ( ( XQConversions::qStringToS60Desc( pwd ) )->Des() );
- des.FillZ( des.MaxLength() );
- des.Zero();
- pwd = XQConversions::s60DescToQString( des );
+ TBuf< FmMaxLengthofDrivePassword > nullPwd;
+ nullPwd.FillZ( nullPwd.MaxLength() );
+ nullPwd.Zero();
+ pwd = XQConversions::s60DescToQString( nullPwd );
}
-int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName)
+/*!
+ Set drive volume for drive \a driveName
+*/
+int FmUtils::renameDrive( const QString &driveName, const QString &newVolumeName)
{
- foreach( QChar ch, newVolumeName )
+ if( driveName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
+ foreach( const QChar &ch, newVolumeName )
{
bool a = ch.isSpace();
bool b = ch.isLetterOrNumber();
@@ -388,14 +388,14 @@
RFs& fs = env->FsSession();
TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
TPtr newName ( ( XQConversions::qStringToS60Desc( newVolumeName ) )->Des() );
int err( fs.SetVolumeLabel( newName, drive ));
QString logString = "Rename error:" + QString::number( err );
- FmLogger::log( logString );
+ FM_LOG( logString );
if( err == KErrNone ){
return FmErrNone;
@@ -408,13 +408,19 @@
}
}
-void FmUtils::ejectDrive( const QString &driverName )
+/*!
+ Eject drive \a driveName
+*/
+int FmUtils::ejectDrive( const QString &driveName )
{
+ if( driveName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
QString logString = "FmUtils::ejectDrive start";
- FmLogger::log( logString );
+ FM_LOG( logString );
TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
const int KDriveShift = 16;
@@ -424,115 +430,169 @@
KCoreAppUIsMmcRemovedWithoutEject,
ECoreAppUIsEjectCommandUsedToDrive | ( drive << KDriveShift )
);
+ return FmErrNone;
+}
+
+/*!
+ Check if drive \a driveName is accessable for user
+*/
+bool FmUtils::checkDriveAccessFilter( const QString &driveName )
+{
+ if( driveName.isEmpty() ) {
+ return false;
+ }
+ FmDriverInfo driveInfo = queryDriverInfo( driveName );
+ if( ( driveInfo.driveState()& FmDriverInfo::EDriveRam ) ||
+ ( driveInfo.driveState()& FmDriverInfo::EDriveRom ) ) {
+ return false;
+ }
+ return true;
}
-QString FmUtils::getFileType( const QString &filePath )
+/*!
+ This function should be called to adjust path if user goto a drive.
+ data folder will be append to C:\ becuase user could only view C:\data instead C:\
+*/
+QString FmUtils::checkDriveToFolderFilter( const QString &path )
{
- RApaLsSession apaSession;
- TDataType dataType;
- TUid appUid;
-
- TBuf<128> mimeTypeBuf;
-
- int err = apaSession.Connect();
+ QString checkedPath = fillPathWithSplash( path );
+ if( checkedPath.compare( Drive_C, Qt::CaseInsensitive ) == 0 ) {
+ checkedPath += QString( "data" ) + QDir::separator();
+ return checkedPath;
+ }
+ return path;
+
+}
+
+/*!
+ This function should be called to adjust path if user back to up level path.
+ If user is at C:\data then path level should be returned as C:\
+ Becuase C:\data is root path for C drive
+*/
+QString FmUtils::checkFolderToDriveFilter( const QString &path )
+{
+ QString logString;
+ logString = QString( "checkFolderToDriveFilter: " ) + path;
+ FM_LOG( logString );
+ QString checkedPath = fillPathWithSplash( path );
+
+ logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath;
+ FM_LOG( logString );
- if ( err == KErrNone ){
- err = apaSession.AppForDocument( XQConversions::qStringToS60Desc( filePath )->Des(),
- appUid, dataType );
-
- if( err == KErrNone ){
- mimeTypeBuf.Copy(dataType.Des8());
- }
+ if( checkedPath.compare( Folder_C_Data, Qt::CaseInsensitive ) == 0 ) {
+ FM_LOG( QString( " change from c:/data/ to C:/" ) );
+ return Drive_C;
}
-
- apaSession.Close();
- return XQConversions::s60DescToQString( mimeTypeBuf );
+ return path;
+
}
-quint64 FmUtils::getDriveDetailsResult( const QString &folderPath, const QString &extension )
+/*!
+ Check if \a path is accessable for user
+*/
+int FmUtils::isPathAccessabel( const QString &path )
{
- int err;
-
- RFs fs;
- err = fs.Connect();
-
- QString string( formatPath( folderPath ) );
+ // Used to check if path is accessable, very important feature
+ // and will return filemanager error.
+ FM_LOG( QString( "isPathAccessabel:" ) + path );
+ if( path.isEmpty() ) {
+ return FmErrPathNotExist;
+ }
- TPtrC desFolderPath( XQConversions::qStringToS60Desc( string )->Des() );
- TPtrC ptrExtension( XQConversions::qStringToS60Desc( extension )->Des() );
-
- CDir* results = 0;
- TParse parse;
-
- quint64 size = 0;
-
- const TInt pathlength = ptrExtension.Length() + desFolderPath.Length();
-
- if ( pathlength > KMaxFileName ){
- err = KErrNotFound;
+ // used to filter locked/ejected/corrupted drive
+ // check if drive is available, no matter if it is a drive, a folder, or a file.
+ if( !isDriveAvailable( path ) ) {
+ FM_LOG( QString( "isPathAccessabel false: path is drive and not available" ) );
+ return FmErrDriveNotAvailable;
}
- else{
- err = fs.Parse( ptrExtension, desFolderPath, parse );
- err = fs.GetDir( parse.FullName(), KEntryAttMaskSupported|KEntryAttAllowUid,
- ESortNone, results );
-
- TDesC des = parse.FullName();
-
- if (err == KErrNotFound)
- {
- return 0;
- }
- }
-
- if ( results ){
- CleanupStack::PushL(results);
+
+ QFileInfo fileInfo( path );
- // Go through all files in the list and tell subclass
- TFileName file;
- const TInt count = results->Count();
- for( TInt i=0; i<count; ++i ){
- const TEntry& entry = (*results)[i];
- file = desFolderPath;
- file += entry.iName;
- size += entry.iSize;
- }
- CleanupStack::PopAndDestroy(results);
+ if( fileInfo.absoluteFilePath().contains( Drive_C, Qt::CaseInsensitive ) &&
+ !fileInfo.absoluteFilePath().contains( Folder_C_Data, Qt::CaseInsensitive ) ) {
+ FM_LOG( QString( "isPathAccessabel false: path contain C and not in data folder" ) );
+ return FmErrPathDenied;
}
-
- fs.Close();
-
- return size;
+ if( !checkDriveAccessFilter( FmUtils::getDriveNameFromPath( fileInfo.absoluteFilePath() ) ) ){
+ return FmErrDriveDenied;
+ }
+ if( !fileInfo.exists() ) {
+ FM_LOG( QString( "isPathAccessabel false: path not exist" ) );
+ return FmErrPathNotExist;
+ }
+ FM_LOG( QString( "isPathAccessabel FmErrNone" ) );
+ return FmErrNone;
}
-bool FmUtils::isDriveC( const QString &driverName )
+/*!
+ Check if drive related to \a path is available.
+ This function should not check if path is available. Only responsible for checking drive
+ When MMC is not inserted, also return false
+*/
+bool FmUtils::isDriveAvailable( const QString &path )
{
- TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
- if( drive == EDriveC ){
+ FM_LOG( QString( "isDriveAvailable:" ) + path );
+ if( path.isEmpty() ) {
+ return false;
+ }
+ FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState();
+ if( ( driveState & FmDriverInfo::EDriveAvailable ) ) {
+ FM_LOG( QString( "isDriveAvailable true" ) );
return true;
}
- else{
- return false;
- }
-
+ FM_LOG( QString( "isDriveAvailable false" ) );
+ return false;
}
-bool FmUtils::isDrive( const QString &path )
+/*!
+ Check if \a folderPath is default folder for system
+*/
+bool FmUtils::isDefaultFolder( const QString &folderPath )
{
- bool ret( false );
- if( path.length() <= 3 && path.length() >=2 ) {
- ret = true;
- }
-
- return ret;
+ HBufC *path = XQConversions::qStringToS60Desc( folderPath );
+ TPtrC desFolderPath( path->Des() );
+
+ bool ret( true );
+ TInt pathType( PathInfo::PathType( desFolderPath ) );
+ switch( pathType ){
+ case PathInfo::ENotSystemPath:{
+ QString locString( localize( folderPath ) );
+ if ( locString.isEmpty() ){
+ ret = false;
+ break;
+ }
+ ret = true;
+ break;
+ }
+ case PathInfo::EPhoneMemoryRootPath: // FALL THROUGH
+ case PathInfo::EMemoryCardRootPath: // FALL THROUGH
+ case PathInfo::ERomRootPath:{
+ ret = false;
+ break;
+ }
+ // Accept other folders
+ default:{
+ ret = true;
+ break;
+ }
+ }
+ delete path;
+ return ret;
}
-void FmUtils::createDefaultFolders( const QString &driverName )
+/*!
+ Create system default folders for drive \a driveName.
+ Default folders should be created after format a drive.
+*/
+void FmUtils::createDefaultFolders( const QString &driveName )
{
+ if( driveName.isEmpty() ) {
+ return;
+ }
int err;
TInt drive = 0;
- drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
RFs fs;
err = fs.Connect();
@@ -595,171 +655,98 @@
CleanupStack::PopAndDestroy( array );
}
-QString FmUtils::fillPathWithSplash( const QString &filePath )
-{
- QString newFilePath( filePath );
- if( filePath.isEmpty() ) {
- return newFilePath;
- }
-
- if( filePath.at( filePath.length()-1 ) != QChar( '/' ) ){
- newFilePath.append( QChar( '/' ) );
- }
- return newFilePath;
-}
-
-QString FmUtils::removePathSplash( const QString &filePath )
+/*!
+ In Symbian system, default folders will be localized.
+ So localize is used to check if a path is a default folder
+ \sa isDefaultFolder
+*/
+QString FmUtils::localize( const QString &path )
{
- QString newFilePath( filePath );
- if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) {
- newFilePath = filePath.left( filePath.length() - 1 );
- }
- return newFilePath;
-}
-
-// used to filter drive which need be hide.
-bool FmUtils::checkDriveFilter( const QString &driveName )
-{
- if( driveName.contains( "D:" ) || driveName.contains( "Z:" ) ) {
- return false;
- }
- return true;
+ // HbDirectoryNameLocalizer can not recognize path with \ in the end
+ QString locPath( removePathSplash( path ) );
+
+ HbDirectoryNameLocalizer localizer;
+ return localizer.translate( locPath );
}
-QString FmUtils::checkDriveToFolderFilter( const QString &path )
+/*!
+ set the \a desFile attributes as the same with \a srcFile
+*/
+int FmUtils::setFileAttributes( const QString &srcFile, const QString &desFile )
{
- /*
- QFileInfo fileInfo( path );
- if( !fileInfo.exists() ) {
- return QString();
- }
- */
- QString checkedPath = fillPathWithSplash( path );
- if( checkedPath.compare( QString( "C:/"), Qt::CaseInsensitive ) == 0 ) {
- checkedPath += QString( "data/" );
- return checkedPath;
+ RFs fsSession;
+ User::LeaveIfError( fsSession.Connect() );
+ CleanupClosePushL( fsSession );
+ RFile64 src;
+ RFile64 des;
+ HBufC *buf1 = XQConversions::qStringToS60Desc( removePathSplash( formatPath( srcFile ) ) );
+ HBufC *buf2 = XQConversions::qStringToS60Desc( removePathSplash( formatPath( desFile ) ) );
+ User::LeaveIfError( src.Open( fsSession, *buf1, EFileRead | EFileShareReadersOnly ) );
+ User::LeaveIfError( des.Open( fsSession, *buf2, EFileWrite | EFileShareExclusive ) );
+ TTime mod;
+ int err = src.Modified( mod );;
+ if ( err == FmErrNone ) {
+ err = des.SetModified( mod );
}
- return path;
-
+ TUint att( 0 );
+ if ( err == FmErrNone ) {
+ err = src.Att( att );
+ }
+ if ( err == FmErrNone ) {
+ des.SetAtt( att, ( ~att ) & KEntryAttMaskSupported );
+ }
+ src.Close();
+ des.Close();
+ fsSession.Close();
+ CleanupStack::PopAndDestroy(); // fsSession
+ return err;
}
-QString FmUtils::checkFolderToDriveFilter( const QString &path )
+/*!
+ judge whether there is enough space on \a targetDrive for \a size.
+ return true if has, false if not.
+*/
+bool FmUtils::hasEnoughSpace( const QString &targetDrive, qint64 size )
{
- QString logString;
- logString = QString( "checkFolderToDriveFilter: " ) + path;
- FmLogger::log( logString );
- QString checkedPath = fillPathWithSplash( path );
-
- logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath;
- FmLogger::log( logString );
+ RFs fsSession;
+ QT_TRAP_THROWING( fsSession.Connect() );
+ CleanupClosePushL( fsSession );
+ TInt dstDrv(0);
+ HBufC* hbuf = XQConversions::qStringToS60Desc( targetDrive );
+ QT_TRAP_THROWING( RFs::CharToDrive( hbuf->operator [](0), dstDrv ) );
+ bool ret = !SysUtil::DiskSpaceBelowCriticalLevelL( &fsSession, size , dstDrv );
+ CleanupStack::PopAndDestroy(); // fsSession
+ return ret;
- if( checkedPath.compare( QString( "C:/data/"), Qt::CaseInsensitive ) == 0 ) {
- FmLogger::log( QString( " change from c:/data/ to C:/" ) );
- return QString( "C:/" );
- }
- return path;
-
}
-bool FmUtils::isPathAccessabel( const QString &path )
+/*!
+ move one file insice the same drive, from \a source to \a target.
+ return KErrNone if successful, otherwise one of the other system-wide error codes.
+*/
+int FmUtils::moveInsideDrive( const QString &source, const QString &target )
{
- 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" ) );
+ RFs fsSession;
+ QT_TRAP_THROWING( fsSession.Connect() );
+ CleanupClosePushL( fsSession );
+ HBufC* oldName = XQConversions::qStringToS60Desc( source );
+ HBufC* newName = XQConversions::qStringToS60Desc( target );
+ int ret = fsSession.Rename( *oldName, *newName );
+ CleanupStack::PopAndDestroy(); // fsSession
+ return ret;
+}
+
+/*!
+ Launch a file with associated application.
+*/
+int FmUtils::launchFile( const QString &filePath )
+
+{
+ QFile file( filePath );
+ if( !file.exists() ) {
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 )
-{
- FmLogger::log( QString( "isDriveAvailable:" ) + path );
- FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState();
- if( ( driveState & FmDriverInfo::EDriveAvailable ) ) {
- FmLogger::log( QString( "isDriveAvailable 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 ) {
- QString driveName = fileInfo.absolutePath();
- if( checkDriveFilter( driveName ) ) {
- if( !isHideUnAvailableDrive ) {
- driveList.append( driveName );
- }
- else if ( isDriveAvailable( driveName ) ) {
- driveList.append( driveName );
- }
- }
- }
- return;
-}
-
-QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume )
-{
- QString ret;
- QString tempDriveName = fillPathWithSplash( driveName );
-
- ret = removePathSplash( driveName );
-
- FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName );
- QString volumeName = driverInfo.volumeName();
-
- if( volumeName.isEmpty() && isFillWithDefaultVolume ){
- FmDriverInfo::DriveState driveState = queryDriverInfo( tempDriveName ).driveState();
- if( driveState & FmDriverInfo::EDriveAvailable ){
- if( driveState & FmDriverInfo::EDriveRemovable ) {
- if( driveState & FmDriverInfo::EDriveMassStorage ) {
- volumeName.append( QObject::tr( "Mass Storage" ) );
- }
- else{
- volumeName.append( QObject::tr( "Memory Card" ) );
- }
- }
- else{
- volumeName.append( QObject::tr( "Phone Memory" ) );
- }
- }
- }
-
- ret += QString( " " ) + volumeName;
- return ret;
-}
-
-int FmUtils::launchFile( const QString &filePath )
-{
- QFile file( filePath );
+
XQApplicationManager mAiwMgr;
XQAiwRequest *request = mAiwMgr.create(file);
if ( request == 0 ) {
@@ -787,12 +774,19 @@
return FmErrNone;
}
+/*!
+ Send files( \a filePathList ) with share ui.
+*/
void FmUtils::sendFiles( QStringList &filePathList )
{
ShareUi shareui;
shareui.send( filePathList, false );
}
+/*!
+ return path for backup restore config file.
+ Currently \a appPath is not used.
+*/
QString FmUtils::getBurConfigPath( QString appPath )
{
Q_UNUSED( appPath );
@@ -800,64 +794,66 @@
return path;
}
-bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast )
+/*!
+ return MetaData string for \a filePath
+*/
+QString FmUtils::getFileType( const QString &filePath )
{
- QString fst( fillPathWithSplash( pathFst ) );
- QString last( fillPathWithSplash( pathLast ) );
- if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) {
- return true;
+ RApaLsSession apaSession;
+ TDataType dataType;
+ TUid appUid;
+
+ TBuf<128> mimeTypeBuf;
+
+ int err = apaSession.Connect();
+
+ if ( err == KErrNone ){
+ err = apaSession.AppForDocument( XQConversions::qStringToS60Desc( filePath )->Des(),
+ appUid, dataType );
+
+ if( err == KErrNone ){
+ mimeTypeBuf.Copy(dataType.Des8());
+ }
}
- return false;
+
+ apaSession.Close();
+ return XQConversions::s60DescToQString( mimeTypeBuf );
}
-bool FmUtils::isDefaultFolder( const QString &folderPath )
+/*!
+ Check if drive \a driveName is drive C
+*/
+bool FmUtils::isDriveC( const QString &driveName )
{
- 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;
- }
+ if( driveName.isEmpty() ) {
+ return false;
}
+ TInt drive = 0;
+ drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
+ if( drive == EDriveC ){
+ return true;
+ }
+ else{
+ return false;
+ }
+
}
-QString FmUtils::Localize( const QString &path )
+/*!
+ return max file name length
+*/
+int FmUtils::getMaxFileNameLength()
{
- 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();
+ return KMaxFileName;
}
-QString FmUtils::formatPath( const QString &path )
+/*!
+ Check if length of \a path is exceed max path length.
+*/
+bool FmUtils::checkMaxPathLength( const QString& path )
{
- QString formatPath = path;
- QRegExp regExp( "/" );
- formatPath.replace( regExp, "\\" );
-
- if( path.right( 1 )!= "\\"){
- formatPath.append( "\\" );
+ if( path.length() > KMaxPath ) {
+ return false;
}
- return formatPath;
+ return true;
}
--- a/filemanager/src/inc/fmutils_win.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmutils_win.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -16,50 +16,39 @@
* The source file of the file manager utilities on windows
*/
+#include "fmutils.h"
+
#include <windows.h>
-#include "fmutils.h"
#include <QDir>
+#include <QUrl>
+#include <QVariant>
#include <QFileInfo>
#include <QDesktopServices>
-#include <QUrl>
-#include <QVariant>
+
+#include <hbglobal.h>
#define BURCONFIGFILE "burconfig.xml"
-
-QString FmUtils::getDriveNameFromPath( const QString &path )
-{
- if( path.length() <3 ) {
- return QString();
- }
- return path.left( 3 );
-}
+const int KMaxFileName=0x100;
+const int KMaxPath=0x100;
-QString FmUtils::getDriveLetterFromPath( const QString &path )
-{
- if( path.length() <3 ) {
- return QString();
- }
- return path.left( 1 );
-}
-
-FmDriverInfo FmUtils::queryDriverInfo( const QString &driverName )
+FmDriverInfo FmUtils::queryDriverInfo( const QString &driveName )
{
quint64 size = 0;
quint64 freeSize = 0;
- QString driver = driverName;
+ QString drive = driveName;
- driver.replace( '/', "\\" );
- if ( driver.right(1) != "\\" ) {
- driver.append( "\\" );
+ drive.replace( '/', "\\" );
+ if ( drive.right(1) != "\\" ) {
+ drive.append( "\\" );
}
- GetDiskFreeSpaceEx( (LPCWSTR)driver.constData(),
+ GetDiskFreeSpaceEx( (LPCWSTR)drive.constData(),
(PULARGE_INTEGER)&freeSize,
(PULARGE_INTEGER)&size,
0 );
TCHAR volumeName[MAX_PATH + 1] = { 0 };
- GetVolumeInformation( (LPCWSTR)driver.constData(),
+ GetVolumeInformation( (LPCWSTR)drive.constData(),
&volumeName[0],
MAX_PATH + 1,
0,
@@ -69,71 +58,42 @@
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 )
-{
- if ( size < 1000 ) {
- return QString::number( size ) + " B";
- } else if ( size < 1000 * 1000 ) {
- return QString::number( size / 1024.0, 'f', 2 ) + " KB";
- } else if ( size < 1000 * 1000 * 1000 ) {
- return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB";
- } else {
- return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB";
- }
-}
-/*
-quint32 FmUtils::getDriverState( const QString &driverName )
-{
- quint32 state( 0 );
-
- QString driver = driverName;
-
- driver.replace( '/', "\\" );
- if ( driver.right(1) != "\\" ) {
- driver.append( "\\" );
- }
-
- quint32 drvStatus = GetDriveType( (LPCWSTR)driver.constData() );
-
+ quint32 drvStatus = GetDriveType( (LPCWSTR)drive.constData() );
if ( drvStatus == DRIVE_REMOVABLE ) {
state |= FmDriverInfo::EDriveRemovable;
}
- return state;
-
+ if( !(state&FmDriverInfo::EDriveNotPresent) && !(state&FmDriverInfo::EDriveLocked) &&
+ !(state&FmDriverInfo::EDriveCorrupted) ) {
+ state |= FmDriverInfo::EDriveAvailable;
+ }
+ return FmDriverInfo( size, freeSize, driveName, QString::fromWCharArray( &volumeName[0] ), state );
}
-*/
-int FmUtils::removeDrivePwd( const QString &driverName, const QString &Pwd )
+
+int FmUtils::removeDrivePwd( const QString &driveName, const QString &Pwd )
{
- Q_UNUSED( driverName );
+ Q_UNUSED( driveName );
Q_UNUSED( Pwd );
return 0;
}
-int FmUtils::unlockDrive( const QString &driverName, const QString &Pwd )
+int FmUtils::unlockDrive( const QString &driveName, const QString &Pwd )
{
- Q_UNUSED( driverName );
+ Q_UNUSED( driveName );
Q_UNUSED( Pwd );
return 0;
}
-int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd)
+int FmUtils::checkDrivePwd( const QString &driveName, const QString &pwd)
{
- Q_UNUSED( driverName );
+ Q_UNUSED( driveName );
Q_UNUSED( pwd );
return 0;
}
-int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd)
+int FmUtils::setDrivePwd( const QString &driveName, const QString &oldPwd, const QString &newPwd)
{
- Q_UNUSED( driverName );
+ Q_UNUSED( driveName );
Q_UNUSED( oldPwd );
Q_UNUSED( newPwd );
return 0;
@@ -144,10 +104,10 @@
Q_UNUSED( pwd );
}
-int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName)
+int FmUtils::renameDrive( const QString &driveName, const QString &newVolumeName)
{
- Q_UNUSED( driverName );
- foreach( QChar ch, newVolumeName )
+ Q_UNUSED( driveName );
+ foreach( const QChar &ch, newVolumeName )
{
// If not alphadigit or space, return error
if( !ch.isLetterOrNumber() && !ch.isSpace() )
@@ -158,201 +118,85 @@
return 0;
}
-void FmUtils::ejectDrive( const QString &driverName )
-{
- Q_UNUSED( driverName );
-}
-
-QString FmUtils::getFileType( const QString &filePath )
-{
- Q_UNUSED( filePath );
- return QString( "" );
-}
-
-quint64 FmUtils::getDriveDetailsResult( const QString &folderPath, const QString &extension )
+int FmUtils::ejectDrive( const QString &driveName )
{
- Q_UNUSED( folderPath );
- Q_UNUSED( extension );
- return 0;
-}
-
-bool FmUtils::isDriveC( const QString &driverName )
-{
- Q_UNUSED( driverName );
- return false;
-}
-
-bool FmUtils::isDrive( const QString &path )
-{
- bool ret( false );
- if( path.length() <= 3 && path.length() >=2 ) {
- ret = true;
- }
-
- return ret;
+ Q_UNUSED( driveName );
+ return FmErrNone;
}
-void FmUtils::createDefaultFolders( const QString &driverName )
-{
- Q_UNUSED( driverName );
-}
-
-QString FmUtils::fillPathWithSplash( const QString &filePath )
+bool FmUtils::checkDriveAccessFilter( const QString &driveName )
{
- QString newFilePath( filePath );
- if( filePath.isEmpty() ) {
- return newFilePath;
- }
-
- if( filePath.at( filePath.length()-1 ) != QChar( '/' ) ){
- newFilePath.append( QChar( '/' ) );
- }
- return newFilePath;
-}
-
-QString FmUtils::removePathSplash( const QString &filePath )
-{
- QString newFilePath( filePath );
- if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) {
- newFilePath = filePath.left( filePath.length() - 1 );
- }
- return newFilePath;
-}
-
-bool FmUtils::checkDriveFilter( const QString &driveName )
-{
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
- if( driveName.contains( "D:" ) || driveName.contains( "Z:" ) ) {
- return false;
- }
-#endif
+ Q_UNUSED( driveName );
return true;
}
QString FmUtils::checkDriveToFolderFilter( const QString &path )
{
- QFileInfo fileInfo( path );
- if( !fileInfo.exists() ) {
- return QString();
- }
-
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
- QString checkedPath = fillPathWithSplash( path );
- if( checkedPath.compare( QString( "C:/"), Qt::CaseInsensitive ) == 0 ) {
- checkedPath += QString( "data/" );
- QFileInfo fileInfo( checkedPath );
- if( !fileInfo.exists() ) {
- return QString();
- }
- return checkedPath;
- }
-#endif
+ Q_UNUSED( path );
return path;
}
QString FmUtils::checkFolderToDriveFilter( const QString &path )
{
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
- QString logString;
- logString = QString( "checkFolderToDriveFilter: " ) + path;
- FmLogger::log( logString );
- QString checkedPath = fillPathWithSplash( path );
-
- logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath;
- FmLogger::log( logString );
-
- if( checkedPath.compare( QString( "C:/data/"), Qt::CaseInsensitive ) == 0 ) {
- FmLogger::log( QString( " change from c:/data/ to C:/" ) );
- return QString( "C:/" );
- }
-#endif
+ Q_UNUSED( path );
return path;
}
-bool FmUtils::isPathAccessabel( const QString &path )
+int FmUtils::isPathAccessabel( const QString &path )
{
-#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
- if(path.contains("D:"))
- return false;
-#endif
- QFileInfo fileInfo( path );
-
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
- if( fileInfo.absoluteFilePath().contains( QString( Drive_C ), Qt::CaseInsensitive ) &&
- !fileInfo.absoluteFilePath().contains( QString( Folder_C_Data ), Qt::CaseInsensitive ) ) {
- return false;
- }
- if( fileInfo.absoluteFilePath().contains( QString( Drive_D ), Qt::CaseInsensitive ) ) {
- return false;
- }
- if( fileInfo.absoluteFilePath().contains( QString( Drive_Z ), Qt::CaseInsensitive ) ) {
- return false;
- }
-#endif
- if( !fileInfo.exists() ) {
- return false;
- }
- return true;
+ Q_UNUSED( path );
+ return FmErrNone;
}
bool FmUtils::isDriveAvailable( const QString &path )
{
- QFileInfo fileInfo( path );
- if( !fileInfo.exists() ) {
- return false;
- }
+ Q_UNUSED( path );
+ return true;
+}
+
+bool FmUtils::isDefaultFolder( const QString &folderPath )
+{
+ Q_UNUSED( folderPath );
+ return false;
+}
+
+void FmUtils::createDefaultFolders( const QString &driveName )
+{
+ Q_UNUSED( driveName );
+}
+
+/*!
+ set the \a desFile attributes as the same with \a srcFile
+*/
+int FmUtils::setFileAttributes( const QString &srcFile, const QString &desFile )
+{
+ Q_UNUSED( srcFile );
+ Q_UNUSED( desFile );
+ return FmErrNone;
+}
+
+/*!
+ judge whether there is enough space on \a targetDrive for \a size.
+ return true if has, false if not.
+*/
+bool FmUtils::hasEnoughSpace( const QString &targetDrive, qint64 size )
+{
+ Q_UNUSED( targetDrive );
+ Q_UNUSED( size );
return true;
}
-void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive )
-{
- QFileInfoList infoList = QDir::drives();
-
- foreach( QFileInfo fileInfo, infoList ) {
- QString driveName = fileInfo.absolutePath();
- if( checkDriveFilter( driveName ) ) {
- if( !isHideUnAvailableDrive ) {
- driveList.append( driveName );
- }
- else if ( isDriveAvailable( driveName ) ) {
- driveList.append( driveName );
- }
- }
- }
- return;
-}
-
-QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume )
+/*!
+ move one file insice the same drive, from \a source to \a target.
+ return KErrNone if successful, otherwise one of the other system-wide error codes.
+*/
+int FmUtils::moveInsideDrive( const QString &source, const QString &target )
{
- QString ret;
- QString tempDriveName = fillPathWithSplash( driveName );
-
- ret = removePathSplash( driveName );
-
- FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName );
- QString volumeName = driverInfo.volumeName();
-
- if( volumeName.isEmpty() && isFillWithDefaultVolume ){
- FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( tempDriveName ).FmDriverInfo::driveState();
- if( !( driveState & FmDriverInfo::EDriveNotPresent ) ){
- if( driveState & FmDriverInfo::EDriveRemovable ) {
- if( driveState & FmDriverInfo::EDriveMassStorage ) {
- volumeName.append( QObject::tr( "Mass Storage" ) );
- }
- else{
- volumeName.append( QObject::tr( "Memory Card" ) );
- }
- }
- else{
- volumeName.append( QObject::tr( "Phone Memory" ) );
- }
- }
- }
-
- ret += QString( " " ) + volumeName;
- return ret;
+ Q_UNUSED( source );
+ Q_UNUSED( target );
+ return FmErrNone;
}
int FmUtils::launchFile( const QString &filePath )
@@ -366,7 +210,7 @@
void FmUtils::sendFiles( QStringList &filePathList )
{
-
+ Q_UNUSED( filePathList );
}
QString FmUtils::getBurConfigPath( QString appPath )
@@ -379,24 +223,31 @@
return path;
}
-bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast )
+QString FmUtils::getFileType( const QString &filePath )
{
- QString fst( fillPathWithSplash( pathFst ) );
- QString last( fillPathWithSplash( pathLast ) );
- if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) {
- return true;
- }
- return false;
+ Q_UNUSED( filePath );
+ return QString( "" );
}
-bool FmUtils::isDefaultFolder( const QString &folderPath )
+bool FmUtils::isDriveC( const QString &driveName )
{
- Q_UNUSED( folderPath );
- return false;
+ if( driveName.contains(Drive_C,Qt::CaseInsensitive) ){
+ return true;
+ }
+ else{
+ return false;
+ }
}
-QString FmUtils::formatPath( const QString &path )
+int FmUtils::getMaxFileNameLength()
{
- Q_UNUSED( path );
- return false;
+ return KMaxFileName;
}
+
+bool FmUtils::checkMaxPathLength( const QString& path )
+{
+ if( path.length() > KMaxPath ) {
+ return false;
+ }
+ return true;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/tsrc/unit/unit_backuprestoresettings/src/unit_backuprestoresettings.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,358 @@
+/*
+* 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: This class is test case for backupsettings and restoresettings
+*
+*/
+
+#include <QtTest/QtTest>
+
+#include "fmbackupsettings.h"
+#include "fmrestoresettings.h"
+#include "fmbkupengine.h"
+#include <QStringList>
+
+#include <hbglobal.h>
+#include <QTranslator>
+#include <QLocale>
+
+class TestSettings: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ // init test strings those are used to verify string fetch feature of FmBackupSettings.
+ void initTestCase();
+
+ void testTestSettingsContentAll();
+ void testTestSettingsContentOne();
+ void testTestSettingsContentTwo();
+
+ void testContentToString();
+ void testContentToString_data();
+
+ void testSchedulingToString();
+ void testSchedulingToString_data();
+
+ void testWeekdayToString();
+ void testWeekdayToString_data();
+
+ void testFmBackupEntry();
+
+ void testFmRestoreInfo();
+ void testFmRestoreEntry();
+
+ void cleanupTestCase(); // Finalize test data
+
+private:
+ FmBackupSettings *settings;
+ QString mFileManagerBackupWeekdayMonday;
+ QString mFileManagerBackupWeekdayTuesday;
+ QString mFileManagerBackupWeekdayWednesday;
+ QString mFileManagerBackupWeekdayThursday;
+ QString mFileManagerBackupWeekdayFirday;
+ QString mFileManagerBackupWeekdaySaturday;
+ QString mFileManagerBackupWeekdaySunday;
+
+ QString mFileManagerBackupScheduleNever;
+ QString mFileManagerBackupScheduleDaily;
+ QString mFileManagerBackupScheduleWeekly;
+
+ QString mFileManagerBackupSettingsTitleContents;
+ QString mFileManagerBackupSettingsTitleScheduling;
+ QString mFileManagerBackupSettingsTitleWeekday;
+ QString mFileManagerBackupSettingsTitleTime;
+ QString mFileManagerBackupSettingsTitleTargetDrive;
+
+ QString mFileManagerBackupSettingsContentAll;
+ QString mFileManagerBackupSettingsContentSettings;
+ QString mFileManagerBackupSettingsContentMessages;
+ QString mFileManagerBackupSettingsContentContacts;
+ QString mFileManagerBackupSettingsContentCalendar;
+ QString mFileManagerBackupSettingsContentBookmarks;
+ QString mFileManagerBackupSettingsContentUserFiles;
+};
+
+void TestSettings::initTestCase()
+{
+ // install translator
+ QTranslator translator;
+ QString lang = QLocale::system().name();
+ QString path = "z:/resource/qt/translations/";
+ translator.load( path + "filemanager_" + lang );
+ QCoreApplication::installTranslator(&translator);
+
+ // init localized string
+ mFileManagerBackupWeekdayMonday = hbTrId( "Monday" );
+ mFileManagerBackupWeekdayTuesday = hbTrId( "Tuesday" );
+ mFileManagerBackupWeekdayWednesday = hbTrId( "Wednesday" );
+ mFileManagerBackupWeekdayThursday = hbTrId( "Thursday" );
+ mFileManagerBackupWeekdayFirday = hbTrId( "Friday" );
+ mFileManagerBackupWeekdaySaturday = hbTrId( "Saturday" );
+ mFileManagerBackupWeekdaySunday = hbTrId( "Sunday" );
+
+ mFileManagerBackupScheduleNever = hbTrId( "Never" );
+ mFileManagerBackupScheduleDaily = hbTrId( "Daily" );
+ mFileManagerBackupScheduleWeekly = hbTrId( "Weekly" );
+
+ mFileManagerBackupSettingsTitleContents = hbTrId( "Backup Contents" );
+ mFileManagerBackupSettingsTitleScheduling = hbTrId( "Backup scheduling" );
+ mFileManagerBackupSettingsTitleWeekday = hbTrId( "Weekday" );
+ mFileManagerBackupSettingsTitleTime = hbTrId( "Time" );
+ mFileManagerBackupSettingsTitleTargetDrive = hbTrId( "Backup destination" );
+
+ mFileManagerBackupSettingsContentAll = hbTrId( "All" );
+ mFileManagerBackupSettingsContentSettings = hbTrId( "Settings" );
+ mFileManagerBackupSettingsContentMessages = hbTrId( "Messages" );
+ mFileManagerBackupSettingsContentContacts = hbTrId( "Contacts" );
+ mFileManagerBackupSettingsContentCalendar = hbTrId( "Calendar" );
+ mFileManagerBackupSettingsContentBookmarks = hbTrId( "Bookmarks" );
+ mFileManagerBackupSettingsContentUserFiles = hbTrId( "Files" );
+}
+
+void TestSettings::cleanupTestCase()
+{
+ QCoreApplication::processEvents();
+}
+
+void TestSettings::testTestSettingsContentAll()
+{
+ FmBkupEngine *backupEngine = new FmBkupEngine( this );
+ settings = new FmBackupSettings( backupEngine );
+ QTime time = QTime::currentTime();
+ settings->setContent(FmBackupSettings::EFileManagerBackupContentAll);
+ settings->setScheduling(FmBackupSettings::EFileManagerBackupScheduleWeekly);
+ settings->setWeekday(FmBackupSettings::EFileManagerBackupWeekdayMonday);
+ settings->setTime(time);
+ settings->setTargetDrive("C:");
+
+ settings->save();
+ delete settings;
+
+
+ settings = new FmBackupSettings( backupEngine );
+ settings->load();
+
+ QVERIFY(settings->content() == FmBackupSettings::EFileManagerBackupContentAll);
+ QVERIFY(settings->scheduling() == FmBackupSettings::EFileManagerBackupScheduleWeekly);
+ QVERIFY(settings->weekday() == FmBackupSettings::EFileManagerBackupWeekdayMonday);
+ QVERIFY( settings->time().toString() == time.toString() );
+ QVERIFY(settings->targetDrive() == "C:");
+
+ QList< FmBackupEntry* > backupEntryList = settings->backupEntryList();
+
+ for( int i = 0; i< backupEntryList.count(); i++ )
+ {
+ FmBackupEntry* entry = backupEntryList[i];
+ switch( entry->type() )
+ {
+ case FmBackupEntry::EContents:
+ {
+ QVERIFY( entry->title() == mFileManagerBackupSettingsTitleContents );
+ break;
+ }
+ case FmBackupEntry::EScheduling:
+ {
+ QVERIFY( entry->title() == mFileManagerBackupSettingsTitleScheduling );
+ break;
+ }
+ case FmBackupEntry::EWeekday:
+ {
+ QVERIFY( entry->title() == mFileManagerBackupSettingsTitleWeekday );
+ break;
+ }
+ case FmBackupEntry::ETime:
+ {
+ QVERIFY( entry->title() == mFileManagerBackupSettingsTitleTime );
+ break;
+ }
+ case FmBackupEntry::ETarget:
+ {
+ QVERIFY( entry->title() == mFileManagerBackupSettingsTitleTargetDrive );
+ break;
+ }
+
+ }
+ qDebug( entry->title().toUtf8().data() );
+ qDebug( entry->tips().toUtf8().data() );
+ }
+ delete backupEngine;
+}
+
+
+void TestSettings::testTestSettingsContentOne()
+{
+ FmBkupEngine *backupEngine = new FmBkupEngine( this );
+ settings = new FmBackupSettings( backupEngine );
+ QTime time = QTime::currentTime();
+ settings->setContent(FmBackupSettings::EFileManagerBackupContentSettings |
+ FmBackupSettings::EFileManagerBackupContentMessages);
+ settings->setScheduling(FmBackupSettings::EFileManagerBackupScheduleWeekly);
+ settings->setWeekday(FmBackupSettings::EFileManagerBackupWeekdayWednesday);
+ settings->setTime(time);
+ settings->setTargetDrive("E:");
+
+ settings->save();
+ delete settings;
+
+ settings = new FmBackupSettings( backupEngine );
+ settings->load();
+
+ QVERIFY(settings->content() == quint32(FmBackupSettings::EFileManagerBackupContentSettings |
+ FmBackupSettings::EFileManagerBackupContentMessages));
+ QVERIFY(settings->scheduling() == FmBackupSettings::EFileManagerBackupScheduleWeekly);
+ QVERIFY(settings->weekday() == FmBackupSettings::EFileManagerBackupWeekdayWednesday);
+ QVERIFY( settings->time().toString() == time.toString() );
+ QVERIFY(settings->targetDrive() == "E:");
+ delete backupEngine;
+}
+
+void TestSettings::testTestSettingsContentTwo()
+{
+ FmBkupEngine *backupEngine = new FmBkupEngine( this );
+ settings = new FmBackupSettings( backupEngine );
+ QTime time = QTime::currentTime();
+ settings->setContent(FmBackupSettings::EFileManagerBackupContentSettings |
+ FmBackupSettings::EFileManagerBackupContentMessages);
+ settings->setScheduling(FmBackupSettings::EFileManagerBackupScheduleWeekly);
+ settings->setWeekday(FmBackupSettings::EFileManagerBackupWeekdayWednesday);
+ settings->setTime(time);
+ settings->setTargetDrive("E:");
+
+ settings->save();
+ delete settings;
+
+ settings = new FmBackupSettings( backupEngine );
+ settings->load();
+
+ QVERIFY(settings->content() == quint32( FmBackupSettings::EFileManagerBackupContentSettings |
+ FmBackupSettings::EFileManagerBackupContentMessages ) );
+ QVERIFY(settings->scheduling() == FmBackupSettings::EFileManagerBackupScheduleWeekly);
+ QVERIFY(settings->weekday() == FmBackupSettings::EFileManagerBackupWeekdayWednesday);
+ QVERIFY( settings->time().toString() == time.toString() );
+ QVERIFY(settings->targetDrive() == "E:");
+ delete backupEngine;
+}
+
+void TestSettings::testContentToString()
+{
+ QFETCH(quint32, param);
+ QFETCH(QString, value);
+
+ QCOMPARE(FmBackupSettings::contentToString( param ), value);
+}
+
+void TestSettings::testContentToString_data()
+{
+ QTest::addColumn<quint32>("param");
+ QTest::addColumn<QString>("value");
+
+ QTest::newRow("contentToString_0") << (quint32)FmBackupSettings::EFileManagerBackupContentAll << mFileManagerBackupSettingsContentAll;
+ QTest::newRow("contentToString_1") << (quint32)FmBackupSettings::EFileManagerBackupContentSettings << mFileManagerBackupSettingsContentSettings;
+ QTest::newRow("contentToString_2") << (quint32)FmBackupSettings::EFileManagerBackupContentMessages << mFileManagerBackupSettingsContentMessages;
+ QTest::newRow("contentToString_3") << (quint32)FmBackupSettings::EFileManagerBackupContentContacts << mFileManagerBackupSettingsContentContacts;
+ QTest::newRow("contentToString_4") << (quint32)FmBackupSettings::EFileManagerBackupContentCalendar << mFileManagerBackupSettingsContentCalendar;
+ QTest::newRow("contentToString_5") << (quint32)FmBackupSettings::EFileManagerBackupContentBookmarks << mFileManagerBackupSettingsContentBookmarks;
+ QTest::newRow("contentToString_6") << (quint32)FmBackupSettings::EFileManagerBackupContentUserFiles << mFileManagerBackupSettingsContentUserFiles;
+}
+
+void TestSettings::testSchedulingToString()
+{
+ QFETCH(int, param);
+ QFETCH(QString, value);
+ FmBkupEngine *backupEngine = new FmBkupEngine( this );
+ settings = new FmBackupSettings( backupEngine );
+ QCOMPARE(settings->schedulingToString( (FmBackupSettings::TFileManagerBackupSchedule)param ), value);
+}
+
+void TestSettings::testSchedulingToString_data()
+{
+ QTest::addColumn<int>("param");
+ QTest::addColumn<QString>("value");
+
+ QTest::newRow("schedulingToString_0") << (int)FmBackupSettings::EFileManagerBackupScheduleNever << mFileManagerBackupScheduleNever;
+ QTest::newRow("schedulingToString_1") << (int)FmBackupSettings::EFileManagerBackupScheduleDaily << mFileManagerBackupScheduleDaily;
+ QTest::newRow("schedulingToString_2") << (int)FmBackupSettings::EFileManagerBackupScheduleWeekly << mFileManagerBackupScheduleWeekly;
+}
+
+void TestSettings::testWeekdayToString()
+{
+ QFETCH(int, param);
+ QFETCH(QString, value);
+
+ QCOMPARE(FmBackupSettings::weekdayToString( (FmBackupSettings::TFileManagerBackupWeekday)param ), value);
+}
+
+void TestSettings::testWeekdayToString_data()
+{
+
+ QTest::addColumn<int>("param");
+ QTest::addColumn<QString>("value");
+
+ QTest::newRow("weekdayToString_0") << (int)FmBackupSettings::EFileManagerBackupWeekdayMonday << mFileManagerBackupWeekdayMonday;
+ QTest::newRow("weekdayToString_1") << (int)FmBackupSettings::EFileManagerBackupWeekdayTuesday << mFileManagerBackupWeekdayTuesday;
+ QTest::newRow("weekdayToString_2") << (int)FmBackupSettings::EFileManagerBackupWeekdayWednesday << mFileManagerBackupWeekdayWednesday;
+ QTest::newRow("weekdayToString_3") << (int)FmBackupSettings::EFileManagerBackupWeekdayThursday << mFileManagerBackupWeekdayThursday;
+ QTest::newRow("weekdayToString_4") << (int)FmBackupSettings::EFileManagerBackupWeekdayFriday << mFileManagerBackupWeekdayFirday;
+ QTest::newRow("weekdayToString_5") << (int)FmBackupSettings::EFileManagerBackupWeekdaySaturday << mFileManagerBackupWeekdaySaturday;
+ QTest::newRow("weekdayToString_6") << (int)FmBackupSettings::EFileManagerBackupWeekdaySunday << mFileManagerBackupWeekdaySunday;
+}
+
+
+void TestSettings::testFmBackupEntry()
+{
+ FmBackupEntry backupEntry( "title","tips", FmBackupEntry::EContents );
+ QVERIFY( backupEntry.title() == "title" );
+ QVERIFY( backupEntry.tips() == "tips" );
+ QVERIFY( backupEntry.type() == FmBackupEntry::EContents );
+
+ FmBackupEntry backupEntryCopy( backupEntry );
+ QVERIFY( backupEntryCopy.title() == "title" );
+ QVERIFY( backupEntryCopy.tips() == "tips" );
+ QVERIFY( backupEntryCopy.type() == FmBackupEntry::EContents );
+
+}
+
+void TestSettings::testFmRestoreInfo()
+{
+ QDateTime dateTime = QDateTime::currentDateTime();
+ FmRestoreInfo restoreInfo((quint32)FmBackupSettings::EFileManagerBackupContentSettings, dateTime, "E:" );
+ QVERIFY( restoreInfo.content() == (quint32)FmBackupSettings::EFileManagerBackupContentSettings );
+ QVERIFY( restoreInfo.dateTime().toString() == dateTime.toString() );
+ QVERIFY( restoreInfo.drive() == "E:" );
+
+ FmRestoreInfo restoreInfoCopy( restoreInfo );
+ QVERIFY( restoreInfoCopy.content() == restoreInfo.content() );
+ QVERIFY( restoreInfoCopy.dateTime().toString() == restoreInfo.dateTime().toString() );
+ QVERIFY( restoreInfoCopy.drive() == restoreInfo.drive() );
+
+ FmRestoreInfo restoreInfoNext = restoreInfo;
+ QVERIFY( restoreInfoNext.content() == restoreInfo.content() );
+ QVERIFY( restoreInfoNext.dateTime().toString() == restoreInfo.dateTime().toString() );
+ QVERIFY( restoreInfoNext.drive() == restoreInfo.drive() );
+}
+
+void TestSettings::testFmRestoreEntry()
+{
+ QDateTime dateTime = QDateTime::currentDateTime();
+ FmRestoreInfo restoreInfo((quint32)FmBackupSettings::EFileManagerBackupContentSettings, dateTime, "E:" );
+
+ FmRestoreEntry restoreEntry( "displayText", restoreInfo );
+ QVERIFY( restoreEntry.text() == "displayText");
+ QVERIFY( restoreEntry.restoreInfo().content() == (quint32)FmBackupSettings::EFileManagerBackupContentSettings );
+ QVERIFY( restoreEntry.restoreInfo().dateTime().toString() == dateTime.toString() );
+ QVERIFY( restoreEntry.restoreInfo().drive() == "E:" );
+}
+
+QTEST_MAIN(TestSettings)
+#include "unit_backuprestoresettings.moc"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/tsrc/unit/unit_backuprestoresettings/unit_backuprestoresettings.pro Tue Aug 24 10:24:14 2010 +0800
@@ -0,0 +1,45 @@
+#
+# 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:
+#
+
+QT += testlib
+CONFIG += qtestlib
+CONFIG += symbian_test
+CONFIG += hb
+TEMPLATE = app
+TARGET =
+include ( ../../../src/inc/commoninc.pri )
+include ( ../../../src/common.pri )
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += ../../../src/fmbkupenginewrapper/inc
+INCLUDEPATH += ../../../src/inc
+TARGET.CAPABILITY = ALL -TCB
+# Input
+SOURCES += src/unit_backuprestoresettings.cpp
+LIBS += -lfmbkupenginewrapper
+
+unix {
+ test.commands = /epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings.exe
+ autotest.commands = /epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings.exe -xml -o c:/unit_backuprestoresettings.xml
+} else:win32 {
+ test.CONFIG += recursive
+ autotest.CONFIG += recursive
+ build_pass {
+ test.commands =/epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings.exe
+ autotest.commands =/epoc32/RELEASE/WINSCW/udeb/unit_backuprestoresettings -xml -o c:/unit_backuprestoresettings.xml
+ }
+}
+QMAKE_EXTRA_TARGETS += test autotest
\ No newline at end of file