--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/examples/demo_fmfiledialog/demo_fmfiledialog.iby Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,30 @@
+/*
+* 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 __FMFILEDIALOG_IBY__
+#define __FMFILEDIALOG_IBY__
+
+#include <bldprivate.hrh>
+
+#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\demo_fmfiledialog.exe SHARED_LIB_DIR\demo_fmfiledialog.exe
+HB_UPGRADABLE_APP_REG_RSC(demo_fmfiledialog)
+S60_APP_RESOURCE(demo_fmfiledialog)
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/examples/demo_fmfiledialog/demo_fmfiledialog.pro Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,31 @@
+# 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:
+#
+#
+
+CONFIG += hb
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+symbian {
+ include(rom.pri)
+}
+
+# Input
+HEADERS += mainwindow.h
+SOURCES += main.cpp mainwindow.cpp
+
+LIBS += -lfmfiledialog
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/examples/demo_fmfiledialog/main.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+*
+* Description:
+*
+*
+*/
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+
+#include "mainwindow.h"
+int main( int argc, char *argv[] )
+{
+ HbApplication app( argc, argv );
+ app.setApplicationName( "filemanager" );
+
+ TestMainWindow *mainWindow = new TestMainWindow;
+ mainWindow->init();
+ mainWindow->show();
+
+
+ return app.exec();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/examples/demo_fmfiledialog/mainwindow.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,193 @@
+/*
+* 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 "mainwindow.h"
+#include "fmfiledialog.h"
+#include "hbmessagebox.h"
+
+#define getDir "getExistingDirectory"
+#define getFile "getOpenFileName"
+#define saveFile "getSaveFileName"
+
+#define getDir_SetDir "getExistingDirectory_setDir"
+#define getFile_SetDir "getOpenFileName_setDir"
+#define saveFile_SetDir "getSaveFileName_setDir"
+
+#define getDir_SetFilter "getExistingDirectory_setFilter"
+#define getDir_SetFilter_AllDirs "getExistingDirectory_setFilter_AllDirs"
+#define getFile_SetFilter "getOpenFileName_setFilter"
+#define saveFile_SetFilter "getSaveFileName_setFilter"
+
+TestMainWindow::TestMainWindow()
+{
+}
+TestMainWindow::~TestMainWindow()
+{
+}
+
+void TestMainWindow::init()
+{
+ HbView *mainView = new HbView;
+ addView( mainView );
+
+ HbListWidget *listWidget = new HbListWidget( mainView );
+ mainView->setWidget( listWidget );
+
+ listWidget->addItem( getDir );
+ listWidget->addItem( getFile );
+ listWidget->addItem( saveFile );
+ listWidget->addItem( " " );
+ listWidget->addItem( getDir_SetDir );
+ listWidget->addItem( getFile_SetDir );
+ listWidget->addItem( saveFile_SetDir );
+ listWidget->addItem( " " );
+ listWidget->addItem( getDir_SetFilter );
+ listWidget->addItem( getDir_SetFilter_AllDirs );
+ listWidget->addItem( getFile_SetFilter );
+ listWidget->addItem( saveFile_SetFilter );
+ listWidget->addItem( " " );
+ listWidget->addItem( "placeHolderA" );
+ listWidget->addItem( "placeHolderB" );
+ listWidget->addItem( "placeHolderC" );
+ listWidget->addItem( "placeHolderD" );
+ listWidget->addItem( "placeHolderE" );
+ listWidget->addItem( "placeHolderF" );
+ listWidget->addItem( "placeHolderG" );
+ listWidget->addItem( "placeHolderH" );
+ listWidget->addItem( "placeHolderI" );
+ listWidget->addItem( "placeHolderJ" );
+ listWidget->addItem( "placeHolderK" );
+ listWidget->addItem( "placeHolderL" );
+ listWidget->addItem( "placeHolderM" );
+ listWidget->addItem( "placeHolderN" );
+ listWidget->addItem( "placeHolderO" );
+ listWidget->addItem( "placeHolderP" );
+ listWidget->addItem( "placeHolderQ" );
+ listWidget->addItem( "placeHolderR" );
+ listWidget->addItem( "placeHolderS" );
+ listWidget->addItem( "placeHolderT" );
+ listWidget->addItem( "placeHolderU" );
+ listWidget->addItem( "placeHolderV" );
+ listWidget->addItem( "placeHolderW" );
+ listWidget->addItem( "placeHolderX" );
+ listWidget->addItem( "placeHolderY" );
+ listWidget->addItem( "placeHolderZ" );
+
+ connect(listWidget, SIGNAL(activated(HbListWidgetItem*)), this,SLOT(activatedListItem(HbListWidgetItem*)) );
+}
+
+void TestMainWindow::activatedListItem(HbListWidgetItem *item)
+{
+ if( item->text().compare( getDir ) == 0 ) {
+ getExistingDirectory();
+ } else if( item->text().compare( getFile ) == 0 ) {
+ getOpenFileName();
+ } else if( item->text().compare( saveFile ) == 0 ) {
+ getSaveFileName();
+ } else if( item->text().compare( getDir_SetDir ) == 0 ) {
+ getExistingDirectory_SetDir();
+ } else if( item->text().compare( getFile_SetDir ) == 0 ) {
+ getOpenFileName_SetDir();
+ } else if( item->text().compare( saveFile_SetDir ) == 0 ) {
+ getSaveFileName_SetDir();
+ } else if( item->text().compare( getDir_SetFilter ) == 0 ) {
+ getExistingDirectory_SetFilter();
+ } else if( item->text().compare( getDir_SetFilter_AllDirs ) == 0 ) {
+ getExistingDirectory_SetFilter_AllDirs();
+ } else if( item->text().compare( getFile_SetFilter ) == 0 ) {
+ getOpenFileName_SetFilter();
+ } else if( item->text().compare( saveFile_SetFilter ) == 0 ) {
+ getSaveFileName_SetFilter();
+ }
+}
+
+void TestMainWindow::getExistingDirectory()
+{
+ // getExistingDirectory with default parameter.
+ QString path = FmFileDialog::getExistingDirectory();
+ HbMessageBox::information( path );
+}
+void TestMainWindow::getOpenFileName()
+{
+ // getOpenFileName with default parameter.
+ QString path = FmFileDialog::getOpenFileName();
+ HbMessageBox::information( path );
+}
+void TestMainWindow::getSaveFileName()
+{
+ // getSaveFileName with default parameter.
+ QString path = FmFileDialog::getSaveFileName();
+ HbMessageBox::information( path );
+}
+
+void TestMainWindow::getExistingDirectory_SetDir()
+{
+ // getExistingDirectory and set header & default Directory
+ QString path = FmFileDialog::getExistingDirectory( 0, "Look in:", "C:/Data/Images" );
+ HbMessageBox::information( path );
+}
+void TestMainWindow::getOpenFileName_SetDir()
+{
+ // getOpenFileName and set header & default Directory
+ QString path = FmFileDialog::getOpenFileName( 0, "Look in:", "C:/Data/Images" );
+ HbMessageBox::information( path );
+}
+void TestMainWindow::getSaveFileName_SetDir()
+{
+ // getSaveFileName and set header & default Directory
+ QString path = FmFileDialog::getSaveFileName( 0, "Look in:", "C:/Data/Images" );
+ HbMessageBox::information( path );
+}
+
+void TestMainWindow::getExistingDirectory_SetFilter()
+{
+ // getExistingDirectory and set folder&file filter
+ QStringList filterList;
+ filterList<<"*data*"<<"*image*"<<"*sound*";
+ QString path = FmFileDialog::getExistingDirectory( 0, "Look in:", "", filterList );
+ HbMessageBox::information( path );
+}
+
+void TestMainWindow::getExistingDirectory_SetFilter_AllDirs()
+{
+ // getExistingDirectory and set folder&file filter
+ QStringList filterList;
+ filterList<<"*data*"<<"*image*"<<"*sound*";
+ QString path = FmFileDialog::getExistingDirectory( 0, "Look in:", "", filterList, FmFileDialog::DisplayAllDirs );
+ HbMessageBox::information( path );
+}
+
+void TestMainWindow::getOpenFileName_SetFilter()
+{
+ // getOpenFileName and set file filter
+ //Set DisplayAllDirs to display all folders, otherwise folders will also be filted.
+ QStringList filterList;
+ filterList<<"*.jpg"<<"*.gif"<<"*.png";
+ QString path = FmFileDialog::getOpenFileName( 0, "Look in:", "", filterList, FmFileDialog::DisplayAllDirs );
+ HbMessageBox::information( path );
+}
+void TestMainWindow::getSaveFileName_SetFilter()
+{
+ // getSaveFileName and set file filter
+ //Set DisplayAllDirs to display all folders, otherwise folders will also be filted.
+ QStringList filterList;
+ filterList<<"*.jpg"<<"*.gif"<<"*.png";
+ QString path = FmFileDialog::getSaveFileName( 0, "Look in:", "", filterList, FmFileDialog::DisplayAllDirs );
+ HbMessageBox::information( path );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/examples/demo_fmfiledialog/mainwindow.h Fri Jun 25 17:08:34 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:
+*
+*
+*/
+
+#include <hbdialog.h>
+#include <hblistwidget.h>
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <hbview.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hblistwidgetitem.h>
+
+#include <QGraphicsLinearLayout>
+
+
+class TestMainWindow : public HbMainWindow
+{
+ Q_OBJECT
+public:
+ TestMainWindow();
+ ~TestMainWindow();
+
+ void init();
+private slots:
+ void activatedListItem(HbListWidgetItem *item);
+
+private:
+ void getExistingDirectory();
+ void getOpenFileName();
+ void getSaveFileName();
+
+ void getExistingDirectory_SetDir();
+ void getOpenFileName_SetDir();
+ void getSaveFileName_SetDir();
+
+ void getExistingDirectory_SetFilter();
+ void getExistingDirectory_SetFilter_AllDirs();
+ void getOpenFileName_SetFilter();
+ void getSaveFileName_SetFilter();
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/examples/demo_fmfiledialog/rom.pri Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,28 @@
+# 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:
+# Rom exports for demo_fmfiledialog
+#
+
+symbian {
+ DEMO_FMFILEDIALOG_IBY_DIR = $$section(PWD, ":", 1)
+
+ exists(/epoc32/include/platform_paths.hrh) {
+ BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+ } else {
+ BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <domain\osextensions\platform_paths.hrh>"
+ }
+
+ BLD_INF_RULES.prj_exports += "$$DEMO_FMFILEDIALOG_IBY_DIR/demo_fmfiledialog.iby CORE_APP_LAYER_IBY_EXPORT_PATH(demo_fmfiledialog.iby)"
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/examples/examples.pro Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,18 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+SUBDIRS = demo_fmfiledialog
--- a/filemanager/filemanager.pro Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/filemanager.pro Fri Jun 25 17:08:34 2010 +0800
@@ -21,5 +21,4 @@
}
SUBDIRS += src/fmbkupenginewrapper
-SUBDIRS += src/fmfiledialog
SUBDIRS += src/filemanager
\ No newline at end of file
--- a/filemanager/filemanager_plat/inc/fmfiledialog.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/filemanager_plat/inc/fmfiledialog.h Fri Jun 25 17:08:34 2010 +0800
@@ -96,13 +96,21 @@
const QString &dir = QString(),
const QStringList &nameFilters = QStringList(),
Options options = 0 );
-
+
+private slots:
+ void dialogClosed(HbAction *action);
+
private:
explicit FmFileDialog( QGraphicsItem *parent );
~FmFileDialog();
bool exec();
+ HbAction *primaryAction() const;
+ void setPrimaryAction( HbAction *action );
+ HbAction *secondaryAction() const;
+ void setSecondaryAction( HbAction *action );
+
FmFileDialogPrivate *d_ptr;
Q_DISABLE_COPY( FmFileDialog)
--- a/filemanager/rom/filemngr.iby Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/rom/filemngr.iby Fri Jun 25 17:08:34 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/rom/rom.pri Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/rom/rom.pri Fri Jun 25 17:08:34 2010 +0800
@@ -18,12 +18,7 @@
symbian {
FILEMNGR_IBY_DIR = $$section(PWD, ":", 1)
- exists(/epoc32/include/platform_paths.hrh) {
- BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
- } else {
- BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <domain\osextensions\platform_paths.hrh>"
- }
-
+ BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include<platform_paths.hrh>"
BLD_INF_RULES.prj_exports += "$$FILEMNGR_IBY_DIR/filemngr.iby CORE_APP_LAYER_IBY_EXPORT_PATH(filemngr.iby)"
BLD_INF_RULES.prj_exports += "$$FILEMNGR_IBY_DIR/filemngr_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(filemngr_resources.iby)"
}
--- 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 Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 2010 +0800
@@ -52,12 +52,14 @@
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 \
@@ -92,12 +94,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 Fri Jun 25 17:08:34 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 \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/resources/qtg_large_filemgr.svg Fri Jun 25 17:08:34 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/fmbackupconfigloader.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -25,8 +25,6 @@
#include <QByteArray>
#include <QCoreApplication>
-#include <hbmessagebox.h>
-
FmBackupConfigLoader::FmBackupConfigLoader(void)
{
--- a/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Fri Jun 25 17:08:34 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,7 +72,7 @@
mCurrentProcess = ProcessBackup;
bool ret = mBkupEngine->startBackup( backupConfigLoader()->driversAndOperationList(),
backupConfigLoader()->backupCategoryList(),
- mBkupEngine->BackupSettingsL()->targetDrive(),
+ mBkupEngine->BackupSettingsL()->availableTargetDrive(),
mBkupEngine->BackupSettingsL()->content() );
if( !ret ) {
@@ -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 Fri Jun 25 17:08:34 2010 +0800
@@ -20,7 +20,7 @@
#include "fmbackupwidget.h"
#include "fmviewmanager.h"
#include "fmoperationbase.h"
-
+#include "fmdlgutils.h"
#include <QApplication>
@@ -28,12 +28,10 @@
#include <hbtoolbar.h>
#include <hbmenu.h>
#include <hbmainwindow.h>
-#include <hbmessagebox.h>
-
FmBackupView::FmBackupView() : FmViewBase( EBackupView )
{
- setTitle( tr( "Backup" ) );
+ setTitle( hbTrId( "Backup" ) );
initToolBar();
initMainWidget();
@@ -91,24 +89,25 @@
void FmBackupView::on_leftAction_triggered()
{
int ret = mOperationService->asyncBackup();
+ FmLogger::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 +138,16 @@
toolBar()->removeAction( mToolBarAction );
}
+void FmBackupView::refreshBackupDate()
+{
+ mMainWidget->updateBackupDate();
+}
+
+void FmBackupView::refreshModel( const QString& path )
+{
+ if( !path.isEmpty() ) {
+ // ignore non-empty refresh signal as it means change of folder/file, not drive.
+ return;
+ }
+ 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 Fri Jun 25 17:08:34 2010 +0800
@@ -45,6 +45,10 @@
void removeToolBarAction();
+public slots:
+ void refreshBackupDate();
+ void refreshModel( const QString& path );
+
private slots:
void on_leftAction_triggered();
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupviewitem.cpp Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +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 back up view list item of file manager
- */
-
-#include "fmbackupviewitem.h"
-
-#include <QGraphicsLinearLayout>
-
-#include <hblabel.h>
-#include <hbcheckbox.h>
-#include <hbwidget.h>
-#include <hblineedit.h>
-
-
-FmBackupViewItem::FmBackupViewItem( QGraphicsItem *parent )
- : mTitleLabel( 0 ),
- //mTipsLabel( 0 ),
- mTipsLineEdit( 0 ),
- HbListViewItem( parent )
-{
- init();
-}
-
-FmBackupViewItem::~FmBackupViewItem()
-{
-}
-
-void FmBackupViewItem::polish(HbStyleParameters& params)
-{
- Q_UNUSED(params);
-}
-
-HbAbstractViewItem *FmBackupViewItem::createItem()
-{
- return new FmBackupViewItem( parentItem() );
-}
-
-void FmBackupViewItem::updateChildItems()
-{
- QString string = modelIndex().data( Qt::DisplayRole ).toString();
-
- QStringList stringList = string.split( '\t' );
-
- if( stringList.count() == 0 ){
- return;
- }
-
- mTitleLabel->setText( stringList.first() );
-
- if( stringList.first() != stringList.last() ){
- //mTipsLabel->setText( stringList.last() );
- mTipsLineEdit->setText( stringList.last() );
- }
-}
-
-
-void FmBackupViewItem::init()
-{
- QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
- vLayout->setOrientation( Qt::Vertical );
-
- mTitleLabel = new HbLabel( "" );
- mTitleLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
- vLayout->addItem( mTitleLabel );
- vLayout->setAlignment( mTitleLabel, Qt::AlignLeft );
-
- //mTipsLabel = new HbLabel( "" );
- //mTipsLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- //mTipsLabel->setAlignment( Qt::AlignHCenter );
-
- //vLayout->addItem( mTipsLabel );
- //vLayout->setAlignment( mTipsLabel, Qt::AlignLeft );
-
- mTipsLineEdit = new HbLineEdit( "" );
- mTipsLineEdit->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- //mTipsLineEdit->setAlignment( Qt::AlignHCenter );
- mTipsLineEdit->setReadOnly( true );
-
- vLayout->addItem( mTipsLineEdit );
- vLayout->setAlignment( mTipsLineEdit, Qt::AlignLeft );
-
- setLayout( vLayout );
-}
-
-//FmRestoreViewItem
-FmRestoreViewItem::FmRestoreViewItem( QGraphicsItem *parent )
- : mRestoreContentLabel( 0 ),
- mDateTimeLabel( 0 ),
- mCheckBox( 0 ),
- HbListViewItem( parent )
-{
- init();
-}
-
-FmRestoreViewItem::~FmRestoreViewItem()
-{
-}
-
-
-HbAbstractViewItem *FmRestoreViewItem::createItem()
-{
- return new FmRestoreViewItem( parentItem() );
-}
-
-void FmRestoreViewItem::polish(HbStyleParameters& params)
-{
- Q_UNUSED(params);
-}
-
-void FmRestoreViewItem::updateChildItems()
-{
- QString string = modelIndex().data( Qt::DisplayRole ).toString();
-
- QStringList stringList = string.split( '\t' );
-
- if( stringList.count() == 0 ){
- return;
- }
-
- mRestoreContentLabel->setText( stringList.first() );
-
- if( stringList.first() != stringList.last() ){
- mDateTimeLabel->setText( stringList.last() );
- }
-
-}
-
-
-void FmRestoreViewItem::init()
-{
- QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout();
- hLayout->setOrientation( Qt::Horizontal );
-
- mCheckBox = new HbCheckBox( this );
- hLayout->addItem( mCheckBox );
- hLayout->setAlignment( mCheckBox, Qt::AlignVCenter );
-
- QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
- vLayout->setOrientation( Qt::Vertical );
-
- 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( mDateTimeLabel );
- vLayout->setAlignment( mDateTimeLabel, Qt::AlignLeft );
-
- HbWidget *textWidget = new HbWidget();
- textWidget->setLayout(vLayout);
-
- hLayout->addItem( textWidget );
- hLayout->setAlignment( textWidget, Qt::AlignVCenter );
-
- setLayout( hLayout );
-
-}
-
-void FmRestoreViewItem::setCheckBoxState()
-{
- if ( mCheckBox->checkState() == Qt::Unchecked ){
- mCheckBox->setCheckState( Qt::Checked );
- setSelected( true );
- }
- else if( mCheckBox->checkState() == Qt::Checked ){
- mCheckBox->setCheckState( Qt::Unchecked );
- setSelected( false );
- }
-}
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupviewitem.h Mon May 03 12:24:39 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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 back up view list item of file manager
- */
-
-#ifndef FMBACKUPVIEWITEM_H
-#define FMBACKUPVIEWITEM_H
-
-#include <hblistviewitem.h>
-
-class HbLabel;
-class HbCheckBox;
-class HbLineEdit;
-
-class FmBackupViewItem : public HbListViewItem
-{
- Q_OBJECT
-
-public:
- FmBackupViewItem( QGraphicsItem *parent = 0 );
- ~FmBackupViewItem();
-
-public:
- virtual HbAbstractViewItem *createItem();
- virtual void updateChildItems();
-private:
- virtual void polish(HbStyleParameters& params);
-
-private:
- void init();
-
-private:
- HbLabel *mTitleLabel;
- //HbLabel *mTipsLabel;
- HbLineEdit *mTipsLineEdit;
-};
-
-//FmRestoreViewItem
-class FmRestoreViewItem : public HbListViewItem
-{
- Q_OBJECT
-
-public:
- FmRestoreViewItem( QGraphicsItem *parent = 0 );
- ~FmRestoreViewItem();
-
-public:
- virtual HbAbstractViewItem *createItem();
- virtual void updateChildItems();
- void setCheckBoxState();
-
-private:
- virtual void polish(HbStyleParameters& params);
-
-private:
- void init();
-
-private:
- HbLabel *mRestoreContentLabel;
- HbLabel *mDateTimeLabel;
-
- HbCheckBox *mCheckBox;
-};
-
-#endif
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -35,9 +35,8 @@
#include <hbdataformviewitem.h>
-
FmBackupWidget::FmBackupWidget( QGraphicsItem *parent )
-: HbWidget( parent ), mLastPressedItem( 0 ), mScrolled( 0 )
+: HbWidget( parent ), mLastPressedItem( 0 ), mScrolled( 0 ), mListReleased( false )
{
init();
}
@@ -58,15 +57,15 @@
mScrolled = false;
if( item == mContentsItem ){
- ChangeContents();
+ 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();
}
}
@@ -93,6 +92,7 @@
mDataForm->setModel( mModel );
vLayout->addItem( mDataForm );
+
connect( mDataForm, SIGNAL( released( const QModelIndex & ) ),
this, SLOT( on_list_released( const QModelIndex & ) ) );
@@ -104,7 +104,13 @@
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();
@@ -141,7 +147,7 @@
void FmBackupWidget::initModel()
{
mContentsGroup = mModel->appendDataFormGroup(
- QString( tr( "Contents" ) ), mModel->invisibleRootItem());
+ QString( hbTrId( "Contents" ) ), mModel->invisibleRootItem());
mContentsItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup );
@@ -152,7 +158,7 @@
mTargetItem->setContentWidgetData( QString("readOnly"), QString("true") );
mSchedulingGroup = mModel->appendDataFormGroup(
- QString( tr( "Scheduling" ) ), mModel->invisibleRootItem());
+ QString( hbTrId( "Scheduling" ) ), mModel->invisibleRootItem());
mSchedulingItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
@@ -165,9 +171,15 @@
mTimeItem = mModel->appendDataFormItem(
HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
mTimeItem->setContentWidgetData( QString("readOnly"), QString("true") );
+
+ mLastBackupDateItem = mModel->appendDataFormItem(
+ HbDataFormModelItem::TextItem, QString( ( "" )), mModel->invisibleRootItem() );
+ mLastBackupDateItem->setContentWidgetData( QString("readOnly"), QString("true") );
+
}
+
void FmBackupWidget::refreshModel()
{
mDataForm->setModel( 0 );
@@ -246,6 +258,11 @@
mTimeItem->setContentWidgetData( QString("text"), tips );
break;
}
+ case FmBackupEntry::EBackupdate:
+ {
+ mLastBackupDateItem->setContentWidgetData( QString("text"), tips );
+ break;
+ }
}
}
@@ -254,12 +271,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 +292,9 @@
}
-void FmBackupWidget::ChangeScheduling()
+void FmBackupWidget::on_changeScheduling()
{
- QString title = constFileManagerBackupSettingsTitleScheduling;
+ QString title = mSchedulingItem->label();
QStringList queryStringList;
FmBackupSettings::TFileManagerBackupSchedule schedule = FmBackupSettings::EFileManagerBackupScheduleNever;
@@ -299,9 +314,9 @@
}
}
-void FmBackupWidget::ChangeWeekday()
+void FmBackupWidget::on_changeWeekday()
{
- QString title = constFileManagerBackupSettingsTitleWeekday;
+ QString title = mWeekdayItem->label();
QStringList queryStringList;
FmBackupSettings::TFileManagerBackupWeekday weekday = FmBackupSettings::EFileManagerBackupWeekdayMonday;
@@ -321,9 +336,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 +349,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 Fri Jun 25 17:08:34 2010 +0800
@@ -35,28 +35,36 @@
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_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 +78,13 @@
HbDataFormModelItem *mSchedulingItem;
HbDataFormModelItem *mWeekdayItem;
HbDataFormModelItem *mTimeItem;
-
+ HbDataFormModelItem *mLastBackupDateItem;
FmBackupSettings *mBackupSettings;
FmBackupConfigLoader *mBackupConfigLoader;
HbDataFormModelItem *mLastPressedItem;
bool mScrolled;
+ bool mListReleased;
};
#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 Fri Jun 25 17:08:34 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,8 +35,7 @@
initMainWidget();
initToolBar();
- initMenu();
- adjustActions();
+ initMenu();
mOperationService = FmViewManager::viewManager()->operationService();
QMetaObject::connectSlotsByName( this );
@@ -63,6 +60,7 @@
mDeleteAction->setObjectName( "deleteAction" );
mDeleteAction->setText( hbTrId( "Delete backups" ) );
menu()->addAction( mDeleteAction );
+ mDeleteAction->setEnabled(false);
}
void FmDeleteBackupView::initMainWidget()
@@ -70,22 +68,31 @@
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 );
}
void FmDeleteBackupView::on_leftAction_triggered()
@@ -108,7 +115,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 +127,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 +135,7 @@
toolBar()->removeAction( mLeftAction );
}
+void FmDeleteBackupView::refreshDeleteBackupView()
+{
+ mDeleteBackupWidget->refresh();
+}
--- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h Fri Jun 25 17:08:34 2010 +0800
@@ -34,10 +34,12 @@
public:
FmDeleteBackupView();
~FmDeleteBackupView();
-
+
private slots:
void on_leftAction_triggered();
void on_deleteAction_triggered();
+ void on_deleteBackupWidget_stateChanged(int state);
+ void refreshDeleteBackupView();
#ifdef FM_CHANGE_ORIENT_ENABLE
void on_rotateAction_triggered();
#endif
@@ -45,9 +47,7 @@
private:
void initMenu();
void initMainWidget();
- void initToolBar();
- void adjustActions();
-
+ void initToolBar();
void removeToolBarAction();
private:
--- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -20,7 +20,6 @@
#include "fmrestoreviewitem.h"
#include "fmoperationservice.h"
#include "fmviewmanager.h"
-
#include "fmbackupconfigloader.h"
#include "fmbkupengine.h"
#include "fmbackuprestorehandler.h"
@@ -28,7 +27,6 @@
#include <QGraphicsLinearLayout>
#include <QStringListModel>
#include <QDateTime>
-
#include <hblistview.h>
FmDeleteBackupWidget::FmDeleteBackupWidget( HbWidget *parent )
@@ -47,8 +45,16 @@
{
mListView->setModel( 0 );
loadData();
- mListView->setModel( mModel );
+ mListView->setModel( mModel );
+ 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);
}
+
QList<int> FmDeleteBackupWidget::selectionIndexes()
{
QList<int> selectionList;
@@ -84,19 +90,20 @@
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") );
- QVariant variant( string );
-
+ string.append( '\t' );
+ string.append( drive );
+ QVariant variant( string );
mModel->setData( mModel->index( index ), variant, Qt::DisplayRole );
-
++index;
}
}
void FmDeleteBackupWidget::init()
-{
+{
QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this );
vLayout->setOrientation( Qt::Vertical );
@@ -112,6 +119,7 @@
mListView->setModel( mModel );
mListView->setItemPrototype( new FmRestoreViewItem( this ) );
+
}
--- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h Fri Jun 25 17:08:34 2010 +0800
@@ -25,6 +25,7 @@
class QStringListModel;
class FmRestoreSettings;
class FmBackupConfigLoader;
+class FmRestoreViewItem;
class FmDeleteBackupWidget : public HbWidget
{
@@ -37,6 +38,8 @@
void refresh();
QList<int> selectionIndexes();
int backupDataCount();
+signals:
+ void stateChanged(int state);
private:
void loadData();
void init();
@@ -50,7 +53,7 @@
QStringListModel *mModel;
FmRestoreSettings *mRestoreSettings;
- FmBackupConfigLoader *mBackupConfigLoader;
+ FmBackupConfigLoader *mBackupConfigLoader;
};
#endif
--- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Fri Jun 25 17:08:34 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,8 +35,7 @@
initMainWidget();
initToolBar();
- initMenu();
- adjustActions();
+ initMenu();
mOperationService = FmViewManager::viewManager()->operationService();
QMetaObject::connectSlotsByName( this );
@@ -63,6 +60,7 @@
mRestoreAction->setObjectName( "restoreAction" );
mRestoreAction->setText( hbTrId( "Restore data" ) );
menu()->addAction( mRestoreAction );
+ mRestoreAction->setEnabled(false);
}
void FmRestoreView::initMainWidget()
@@ -70,6 +68,7 @@
mRestoreWigdet = new FmRestoreWigdet( this );
setWidget( mRestoreWigdet );
+ connect(mRestoreWigdet, SIGNAL(stateChanged(int)), this, SLOT(onCheckBoxStateChange()));
}
@@ -79,7 +78,7 @@
mLeftAction->setObjectName( "leftAction" );
mLeftAction->setText( hbTrId( "Restore" ) );
toolBar()->addAction( mLeftAction );
-
+ mLeftAction->setEnabled(false);
toolBar()->setOrientation( Qt::Horizontal );
}
@@ -98,13 +97,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 +125,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/fmrestoreview.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.h Fri Jun 25 17:08:34 2010 +0800
@@ -37,6 +37,8 @@
private slots:
void on_leftAction_triggered();
void on_restoreAction_triggered();
+ void onCheckBoxStateChange();
+ void refreshRestoreView();
#ifdef FM_CHANGE_ORIENT_ENABLE
void on_rotateAction_triggered();
#endif
@@ -44,9 +46,7 @@
private:
void initMenu();
void initMainWidget();
- void initToolBar();
- void adjustActions();
-
+ void initToolBar();
void removeToolBarAction();
private:
--- a/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Fri Jun 25 17:08:34 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/fmrestoreviewitem.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h Fri Jun 25 17:08:34 2010 +0800
@@ -24,7 +24,9 @@
class HbLabel;
class HbCheckBox;
class HbLineEdit;
-
+class QGraphicsLinearLayout;
+class HbWidget;
+class FmFileIconProvider;
//FmRestoreViewItem
class FmRestoreViewItem : public HbListViewItem
{
@@ -32,13 +34,16 @@
public:
FmRestoreViewItem( QGraphicsItem *parent = 0 );
- ~FmRestoreViewItem();
+ ~FmRestoreViewItem();
public:
virtual HbAbstractViewItem *createItem();
virtual void updateChildItems();
void setCheckBoxState();
bool getCheckBoxState();
+signals:
+ void stateChanged(int);
+
private:
virtual void polish(HbStyleParameters& params);
@@ -48,9 +53,13 @@
private:
HbLabel *mRestoreContentLabel;
- HbLabel *mDateTimeLabel;
+ HbLabel *mDateTimeLabel;
HbCheckBox *mCheckBox;
+ QGraphicsLinearLayout *hLayout;
+ HbWidget *mParentWidget;
+ HbLabel *mIconLabel;
+ FmFileIconProvider *mIconProvider;
};
#endif
--- a/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Fri Jun 25 17:08:34 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/backuprestore/fmrestorewidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h Fri Jun 25 17:08:34 2010 +0800
@@ -36,11 +36,12 @@
QList<int> selectionIndexes();
int backupDataCount();
+ void refresh();
private:
void init();
-signals:
- void checkStatusChanged();
+signals:
+ void stateChanged(int state);
private slots:
void on_list_activated( const QModelIndex &index );
--- a/filemanager/src/filemanager/src/components/fmcombinedquery.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmcombinedquery.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -25,7 +25,7 @@
#include <hblistwidgetitem.h>
#include <hbabstractviewitem.h>
-FmCombinedQuery::FmCombinedQuery( QGraphicsItem *parent ) : HbDialog( parent ),
+FmCombinedQuery::FmCombinedQuery( QGraphicsItem *parent ) : FmDialog( parent ),
mSelectMode ( MultiSelectMode ), mDominantIndex ( -1 )
{
mContentWidget = new QGraphicsWidget();
@@ -110,7 +110,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/fmcombinedquery.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmcombinedquery.h Fri Jun 25 17:08:34 2010 +0800
@@ -19,14 +19,13 @@
#define FMCOMBINEDQUERY_H
#include "fmcommon.h"
+#include "fmdialog.h"
#include <QString>
#include <QMap>
#include <QStringList>
#include <QGraphicsItem>
-#include <hbdialog.h>
-
class HbListWidget;
class QGraphicsWidget;
@@ -36,7 +35,7 @@
* Support multi, single select
*
*/
-class FmCombinedQuery : public HbDialog
+class FmCombinedQuery : public FmDialog
{
Q_OBJECT
public:
--- 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 Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,87 @@
+/*
+ * 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 )
+{
+ 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 )
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() == 0) {
+ QGraphicsWidget::addAction(new HbAction(hbTrId("Ok")));
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 1) {
+ QGraphicsWidget::addAction(action);
+ } else if (actionList.size() == 2) {
+ actionList.removeAt(1);
+ actionList.insert(1, action);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmdialog.h Fri Jun 25 17:08:34 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:
+ * The header file of filemanager base dialog class
+ */
+
+#ifndef FMDIALOG_H
+#define FMDIALOG_H
+
+#include <QEventLoop>
+#include <hbaction.h>
+#include <hbdialog.h>
+#include <hbmenu.h>
+class FmDialog : public HbDialog
+{
+Q_OBJECT
+public:
+ explicit FmDialog( QGraphicsItem *parent = 0 );
+ HbAction *exec();
+
+ HbAction *primaryAction() const;
+ void setPrimaryAction( HbAction *action );
+
+ HbAction *secondaryAction() const;
+ void setSecondaryAction( HbAction *action );
+public slots:
+ void dialogClosed(HbAction *action);
+private:
+ QEventLoop mEventLoop;
+ HbAction *mRetAction;
+};
+
+#endif
--- a/filemanager/src/filemanager/src/components/fmdlgutils.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdlgutils.cpp Fri Jun 25 17:08:34 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,8 +32,7 @@
#include <hblabel.h>
#include <hbaction.h>
-#include <hbmessagebox.h>
-
+
FmDlgUtils::FmDlgUtils( void )
{
}
@@ -39,7 +40,7 @@
FmDlgUtils::~FmDlgUtils( void )
{
}
-HbAction *FmDlgUtils::executeDialog( HbDialog *dialog, const QString &associatedDrives )
+HbAction *FmDlgUtils::executeDialog( FmDialog *dialog, const QString &associatedDrives )
{
for( int i = 0; i < associatedDrives.length(); i++ ) {
QString drive( associatedDrives[i] + QString( ":/" ) );
@@ -82,8 +83,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 );
@@ -158,8 +159,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 );
@@ -212,8 +213,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 );
@@ -246,7 +247,7 @@
bool FmDlgUtils::showTextQuery(
const QString& title, QString& text, bool isDimPrimaryActionWhenEmpty, int maxLength,
- const QString &associatedDrives )
+ const QString &associatedDrives, bool isReturnFalseWhenNoTextChanged )
{
bool ret( false );
bool ok ( true ); // SK return (out parameter)
@@ -261,8 +262,8 @@
}
cQuery->setHeadingWidget( new HbLabel( title ) );
- 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 );
@@ -286,7 +287,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 +303,19 @@
return ret;
}
-bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, const QString &associatedDrives )
+bool FmDlgUtils::showSinglePasswordQuery( const QString &title, QString &pwd, int maxLength, const QString &associatedDrives )
{
bool ret( false );
FmSingleTextQuery *cQuery = new FmSingleTextQuery( FmSingleTextQuery::DimPrimereActionWhenEmpty,
HbLineEdit::Password );
+ if( maxLength != -1 ){
+ cQuery->setLineEditMaxLength( maxLength );
+ }
cQuery->setHeadingWidget( new HbLabel( title ) );
- 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 );
@@ -331,16 +342,19 @@
}
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 +383,35 @@
delete cQuery;
return ret;
}
+
+bool FmDlgUtils::question( const QString &questionText, const QString &primaryButtonText,
+ const QString &secondaryButtonText )
+{
+ FmMessageBox msgBox;
+ return msgBox.question( questionText, primaryButtonText, secondaryButtonText );
+}
+
+void FmDlgUtils::information( const QString &informationText )
+{
+ FmMessageBox msgBox;
+ return msgBox.information( informationText );
+}
+
+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;
+}
--- a/filemanager/src/filemanager/src/components/fmdlgutils.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdlgutils.h Fri Jun 25 17:08:34 2010 +0800
@@ -25,7 +25,9 @@
#include <QStringList>
#include <QTime>
-class HbDialog;
+#include <hbglobal.h>
+
+class FmDialog;
class HbAction;
class FmDlgUtils : public QObject
@@ -76,20 +78,33 @@
static bool showTextQuery(
const QString &title, QString &driveName, bool isDimPrimaryActionWhenEmpty, int maxLength = -1,
- const QString &associatedDrives = QString() );
+ const QString &associatedDrives = QString(), bool isReturnFalseWhenNoTextChanged = true );
static bool showSinglePasswordQuery(
- const QString &title, QString &pwd,
+ 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 &firstLabel, const QString &secondLabel, QString &pwd, int maxLength = -1,
const QString &associatedDrives = QString() );
+
+ static bool question( const QString &questionText, const QString &primaryButtonText = QString( hbTrId("Yes") ),
+ const QString &secondaryButtonText = QString( hbTrId("No") ) );
+
+ static void information( const QString &informationText );
+
+ /**
+ * Query drive for backup
+ *
+ * @param title Title for query dialog
+ * @return selected drive name. empty for cancel.
+ */
+ static QString showBackupDriveQuery( const QString& title );
~FmDlgUtils(void);
private:
FmDlgUtils(void);
- static HbAction *executeDialog( HbDialog *dialog, const QString &associatedDrives );
+ 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 Fri Jun 25 17:08:34 2010 +0800
@@ -44,7 +44,8 @@
typeFilters.append( QString( "*.ico" ) );
typeFilters.append( QString( "*.vcf" ) );
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupImages, typeFilters ));
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupImages,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeExtName ));
typeFilters.clear();
typeFilters.append( QString( "*.aac" ) );
@@ -64,30 +65,36 @@
typeFilters.append( QString( "*.ott" ) );
typeFilters.append( QString( "*.mxmf" ) );
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupSoundFiles, typeFilters ));
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupSoundFiles,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeExtName ));
typeFilters.clear();
typeFilters.append( QString( "*.jad" ) );
typeFilters.append( QString( "*.jar" ) );
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupMidpJava, typeFilters ));
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupMidpJava,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeExtName ));
typeFilters.clear();
typeFilters.append( QString( "*.sis" ) );
typeFilters.append( QString( "*.sisx" ) );
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupNativeApps, typeFilters ));
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupNativeApps,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeExtName ));
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( "*.rm" ) );
+ typeFilters.append( QString( "*.rv" ) );
typeFilters.append( QString( "*.wmv" ) );
typeFilters.append( QString( "*.3g2" ) );
+ typeFilters.append( QString( "*.rmvb") );
+ typeFilters.append( QString( "*.mkv" ) );
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupVideos, typeFilters ));
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupVideos,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeExtName ));
typeFilters.clear();
typeFilters.append( QString( "*.doc" ) );
@@ -97,22 +104,63 @@
typeFilters.append( QString( "*.txt" ) );
typeFilters.append( QString( "*.xls" ) );
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupDocuments, typeFilters ));
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupDocuments,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeExtName ));
typeFilters.clear();
typeFilters.append( QString( "*.vcs" ) );
- dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupCalendar, typeFilters ));
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupCalendar,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeExtName ));
+ // Add absolute path and use EDataRecognizeAbsolutePath method for Contacts
+ typeFilters.clear();
+ typeFilters.append( QString( FmViewDetail_Contacts ) );
+ dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupContacts,
+ typeFilters, FmDriveDetailsDataGroup::EDataRecognizeAbsolutePath ));
return dataGroupList;
}
int FmDriveDetailsContent::querySizeofContent( const QString &driveName,
QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
-{
- quint64 totalSize = 0;
-
+{
+ int err = FmErrNone;
+ QList< FmDriveDetailsDataGroup* > dataGroupList = queryDetailsContent();
+ detailsSizeList.clear();
+ for( QList< FmDriveDetailsDataGroup* >::iterator it = dataGroupList.begin();
+ it!= dataGroupList.end(); ++it ) {
+ if ( *isStopped ){
+ return FmErrCancel;
+ }
+ FmDriveDetailsDataGroup* driveDetailsDataGroup = *it;
+
+ switch( (*it)->dataRecognizeType() )
+ {
+ case FmDriveDetailsDataGroup::EDataRecognizeExtName:
+ err = getDataSizeByExtName(driveName, driveDetailsDataGroup, detailsSizeList, isStopped) ;
+ break;
+ case FmDriveDetailsDataGroup::EDataRecognizeAbsolutePath:
+ err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroup, detailsSizeList, isStopped);
+ break;
+ default:
+ Q_ASSERT_X( false, "querySizeofContent", "please handle all recognize methods ");
+ break;
+ }
+
+ // return if error occur.
+ if( err != FmErrNone ) {
+ return err;
+ }
+ }
+ return FmErrNone;
+}
+
+int FmDriveDetailsContent::getDataSizeByExtName( const QString &driveName,
+ const FmDriveDetailsDataGroup* const dataGroup,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
+{
+ quint64 totalSize = 0;
QString path;
path.clear();
@@ -121,54 +169,57 @@
}
else{
path = driveName;
- }
-
- QList< FmDriveDetailsDataGroup* > dataGroupList = queryDetailsContent();
+ }
+ QStringList typeFilter = dataGroup->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( dataGroup->dataGroups(), totalSize ) );
+ return FmErrNone;
+
+}
+
+int FmDriveDetailsContent::getDataSizeByAbsolutePath( const QString &driveName,
+ const FmDriveDetailsDataGroup* const dataGroup,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
+{
+ quint64 totalSize = 0;
+ QStringList typeFilter = dataGroup->typeFilters();
- QStringList typeFilter;
- detailsSizeList.clear();
- QDir dir( path );
-
- for( QList< FmDriveDetailsDataGroup* >::iterator it = dataGroupList.begin();
- it!= dataGroupList.end(); ++it ){
+ for( QStringList::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->dataGroups(), totalSize ) );
return FmErrNone;
}
--- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.h Fri Jun 25 17:08:34 2010 +0800
@@ -26,6 +26,12 @@
class FmDriveDetailsDataGroup
{
public:
+ // used to identify recognize method
+ enum TDataRecognizeType{
+ EDataRecognizeExtName = 0, // recognize data by extension of filename
+ EDataRecognizeAbsolutePath // recognize data by ablsolute file path
+ };
+
enum TDataGroups{
EGroupImages = 0,
EGroupSoundFiles,
@@ -40,8 +46,13 @@
};
public:
- FmDriveDetailsDataGroup( TDataGroups dataGroups, QStringList typeFilters )
- : mDataGroups( dataGroups ), mTypeFilters( typeFilters ) {}
+ FmDriveDetailsDataGroup( TDataGroups dataGroups,
+ QStringList typeFilters,
+ TDataRecognizeType recognizeType )
+ : mDataGroups( dataGroups ), mTypeFilters( typeFilters ),
+ mDataRecognizeType( recognizeType )
+ {
+ }
FmDriveDetailsDataGroup( const FmDriveDetailsDataGroup &other )
{
*this = other;
@@ -56,10 +67,12 @@
TDataGroups dataGroups() const { return mDataGroups; }
QStringList typeFilters() const { return mTypeFilters; }
+ TDataRecognizeType dataRecognizeType() const { return mDataRecognizeType; }
private:
TDataGroups mDataGroups;
QStringList mTypeFilters;
+ TDataRecognizeType mDataRecognizeType;
};
class FmDriveDetailsSize
@@ -93,7 +106,27 @@
static QList<FmDriveDetailsDataGroup*> queryDetailsContent();
static int querySizeofContent(
const QString &driveName, QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
-
+ /**
+ * Gets data size for single FmDriveDetailsDataGroup, the method is scan files for extension.
+ * @param driveName which drive is searching
+ * @param dataGroup which dataGroup is searching, for example, EGroupImages, EGroupSoundFiles...
+ * @param detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
+ * @param isStopped isStopped will be set as true if user cancel this operation
+ * @return Filemanage wide error. Please refer to fmdefine.h
+ */
+ static int getDataSizeByExtName( const QString &driveName, const FmDriveDetailsDataGroup* const dataGroup,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
+
+ /**
+ * Gets data size for single FmDriveDetailsDataGroup, the method is find file of absolute path
+ * @param driveName which drive is searching
+ * @param dataGroup which dataGroup is searching, for example, EGroupContacts...
+ * @param detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
+ * @param 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* const dataGroup,
+ QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
};
class FmFolderDetails
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmdrivequery.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,93 @@
+/*
+ * 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 )
+{
+ mContentWidget = new QGraphicsWidget();
+ setContentWidget(mContentWidget);
+
+ QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
+ vLayout->setOrientation( Qt::Vertical );
+
+ mListView = new HbListView();
+ 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/fmdrivequery.h Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,60 @@
+/*
+ * 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 backup drive query of of file manager
+ */
+#ifndef FMDRIVEQUERY_H
+#define FMDRIVEQUERY_H
+
+#include "fmcommon.h"
+#include "fmdialog.h"
+#include "fmdrivemodel.h"
+
+#include <QString>
+#include <QMap>
+#include <QStringList>
+#include <QGraphicsItem>
+
+class HbListView;
+class QGraphicsWidget;
+
+// CLASS DECLARATION
+/**
+ * This class is used for drive select query dialog
+ *
+ */
+class FmDriveQuery : public FmDialog, public FmDriveListProvider
+{
+ Q_OBJECT
+public:
+ FmDriveQuery( QGraphicsItem *parent = 0 );
+ ~FmDriveQuery();
+ QString selectedDrive() const;
+
+ // from FmDriveListProvider
+ virtual void getDriveList( QStringList &driveList );
+
+public slots:
+ void activated(const QModelIndex &index);
+ void refreshModel( QString path );
+private:
+ QGraphicsWidget *mContentWidget; /// Content widget of popup dialog
+ HbListView *mListView; /// list view
+ FmDriveModel *mDriveModel; /// drive model
+
+ QString mSelectedDrive;
+};
+
+#endif //FMDRIVEQUERY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmmessagebox.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *
+ * Description:
+ * The source file of filemanager messagebox
+ */
+
+#include "fmmessagebox.h"
+#include <hbmessagebox.h>
+
+void FmMessageBox::information( const QString &informationText )
+{
+ HbMessageBox::information ( informationText,
+ this, SLOT(dialogClosed(HbAction*)) );
+ mEventLoop.exec();
+}
+
+bool FmMessageBox::question( const QString &questionText, const QString &primaryButtonText,
+ const QString &secondaryButtonText )
+{
+ HbMessageBox::question ( questionText,
+ this, SLOT(dialogClosed(HbAction*)), primaryButtonText, secondaryButtonText );
+ 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 Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ *
+ * Description:
+ * The 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 );
+
+ bool question( const QString &questionText, const QString &primaryButtonText,
+ const QString &secondaryButtonText );
+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 Fri Jun 25 17:08:34 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();
}
@@ -70,6 +70,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/fmmultitextquery.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmmultitextquery.h Fri Jun 25 17:08:34 2010 +0800
@@ -20,21 +20,22 @@
#define FMMULTITEXTQUERY_H
#include "fmcommon.h"
+#include "fmdialog.h"
-#include <hbdialog.h>
#include <hblineedit.h>
class HbWidget;
class HbLabel;
-class FmMultiTextQuery : public HbDialog
+class FmMultiTextQuery : public FmDialog
{
Q_OBJECT
public:
- FmMultiTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 );
+ explicit FmMultiTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 );
~FmMultiTextQuery();
public:
+ void setLineEditMaxLength( int length );
void setFirstEditText( const QString &text );
void setSecondEditText( const QString &text );
void setFirstLabelText( const QString &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 Fri Jun 25 17:08:34 2010 +0800
@@ -26,7 +26,7 @@
FmSingleTextQuery::FmSingleTextQuery( Options options,
HbLineEdit::EchoMode echoMode, QGraphicsItem *parent ) :
- HbDialog( parent ), mOptions( options ), mEchoMode( echoMode )
+ FmDialog( parent ), mOptions( options ), mEchoMode( echoMode )
{
init();
}
--- a/filemanager/src/filemanager/src/components/fmsingletextquery.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmsingletextquery.h Fri Jun 25 17:08:34 2010 +0800
@@ -19,12 +19,12 @@
#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:
--- a/filemanager/src/filemanager/src/components/fmtimequery.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmtimequery.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -24,7 +24,7 @@
#include <hbdatetimeedit.h>
-FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : HbDialog( parent )
+FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : FmDialog( parent )
{
mContentWidget = new QGraphicsWidget();
--- a/filemanager/src/filemanager/src/components/fmtimequery.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmtimequery.h Fri Jun 25 17:08:34 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 FmTimeQuery : public FmDialog
{
public:
FmTimeQuery(QGraphicsItem *parent=0);
--- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -19,20 +19,21 @@
#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 <QFileInfo>
#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 +43,8 @@
mSizeofJava( 0 ),
mSizeofNativeFiles( 0 ),
mSizeofDocument( 0 ),
- mSizeofCalendar( 0 )
+ mSizeofCalendar( 0 ),
+ mSizeofContacts( 0 )
{
init();
@@ -55,11 +57,6 @@
mListView->setModel( 0 );
delete mListView;
}
-
- if( mDirModel ){
- delete mDirModel;
- }
-
}
void FmViewDetailsDialog::init()
@@ -70,20 +67,20 @@
mListView = new HbListView( this );
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 +91,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 +177,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 +222,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,7 +284,8 @@
mSizeofJava = 0;
mSizeofNativeFiles = 0;
mSizeofDocument = 0;
- mSizeofCalendar = 0;
+ mSizeofCalendar = 0;
+ mSizeofContacts = 0;
for( QList< FmDriveDetailsSize* >::iterator it = detailsSizeList.begin();
it!= detailsSizeList.end(); ++it ){
@@ -396,48 +293,51 @@
switch( ( *it )->dataGroups() ){
case FmDriveDetailsDataGroup::EGroupImages:
{
- mSizeofImage = ( *it )->size();
+ mSizeofImage = ( *it )->size();
+ break;
}
- break;
case FmDriveDetailsDataGroup::EGroupSoundFiles:
{
- mSizeofSounds = ( *it )->size();
+ mSizeofSounds = ( *it )->size();
+ break;
}
- break;
case FmDriveDetailsDataGroup::EGroupMidpJava:
{
- mSizeofJava = ( *it )->size();
+ mSizeofJava = ( *it )->size();
+ break;
}
- break;
case FmDriveDetailsDataGroup::EGroupNativeApps:
{
- mSizeofNativeFiles = ( *it )->size();
+ mSizeofNativeFiles = ( *it )->size();
+ break;
}
- break;
case FmDriveDetailsDataGroup::EGroupVideos:
{
- mSizeofVideo = ( *it )->size();
+ mSizeofVideo = ( *it )->size();
+ break;
}
- break;
case FmDriveDetailsDataGroup::EGroupDocuments:
{
- mSizeofDocument = ( *it )->size();
+ mSizeofDocument = ( *it )->size();
+ break;
}
- break;
case FmDriveDetailsDataGroup::EGroupCalendar:
{
- mSizeofCalendar = ( *it )->size();
+ mSizeofCalendar = ( *it )->size();
+ break;
}
+ case FmDriveDetailsDataGroup::EGroupContacts:
+ {
+ mSizeofContacts = ( *it )->size();
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( ":/" ) );
--- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 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,25 @@
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 );
+ mLayout->addItem( mDetailsContentLabel );
+ mLayout->setAlignment( mDetailsContentLabel, Qt::AlignLeft );
mDetailsLabel = new HbLabel("");
mDetailsLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- layout->addItem( mDetailsLabel );
- layout->setAlignment( mDetailsLabel, Qt::AlignLeft );
+ mLayout->addItem( mDetailsLabel );
+ mLayout->setAlignment( mDetailsLabel, Qt::AlignLeft );
- setLayout( layout );
+ setLayout( mLayout );
}
--- a/filemanager/src/filemanager/src/components/fmviewdetailsitem.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsitem.h Fri Jun 25 17:08:34 2010 +0800
@@ -22,6 +22,7 @@
#include <hblistviewitem.h>
class HbLabel;
+class QGraphicsLinearLayout;
class FmViewDetailsItem : public HbListViewItem
{
@@ -45,6 +46,8 @@
private:
HbLabel *mDetailsContentLabel;
HbLabel *mDetailsLabel;
+
+ QGraphicsLinearLayout *mLayout;
};
#endif /* FMVIEWDETAILSITEM_H */
--- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -25,20 +25,19 @@
#include "fmdrivemodel.h"
#include "fmfiledialog.h"
-#include <QDirModel>
+#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), mOperationService(0),
+ mFileSystemWatcher(0), mLayout(0), mContextMenu(0), mListLongPressed( false )
{
init();
mOperationService = FmViewManager::viewManager()->operationService();
@@ -52,11 +51,20 @@
FmDriverListWidget::~FmDriverListWidget()
{
+ if (mContextMenu) {
+ mContextMenu->deleteLater();
+ }
}
void FmDriverListWidget::on_list_activated( const QModelIndex &index )
{
- emit activated( mModel->driveName( index ) );
+ FmLogger::log("FmDriverListWidget::on_list_activated");
+ if( mListLongPressed ) {
+ FmLogger::log("FmDriverListWidget::on_list_activated return because long pressed");
+ return;
+ }
+ FmLogger::log("FmDriverListWidget::on_list_activated emit activate to open drive");
+ emit activated( mModel->driveName( index ) );
}
void FmDriverListWidget::init()
@@ -80,15 +88,17 @@
mSearchPanel->hide();
// mLayout->addItem( mSearchPanel );
- mListView->setItemPrototype( new DiskListViewItem( mListView ) );
+ mListView->setItemPrototype( new DiskListViewItem(this) );
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 & ) ) );
@@ -107,111 +117,126 @@
void FmDriverListWidget::on_list_longPressed( HbAbstractViewItem *item, const QPointF &coords )
{
- HbMenu *contextMenu = new HbMenu();
-
+ FmLogger::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::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;
+ 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() ) );
- }
-
- 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() ) );
+ //state = 0x210;
+
+ connect( viewAction, SIGNAL( triggered() ),
+ this, SLOT( on_viewAction_triggered() ), Qt::QueuedConnection );
}
- 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::EDriveAvailable ) && ( state & FmDriverInfo::EDriveRemovable ) && !( state & FmDriverInfo::EDriveMassStorage ) ){
+ // MMC or Usb memory
+ 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 );
+ }
+ if( !( state & FmDriverInfo::EDriveUsbMemory ) ) { // 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( 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::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 );
+ }
+
+ #ifndef _DEBUG_ENABLE_FORMATMENU_
+ if ( ( state & FmDriverInfo::EDriveRemovable ) || ( state & FmDriverInfo::EDriveCorrupted )
+ || ( state & FmDriverInfo::EDriveLocked ) ){
+ #endif
+ 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 );
+ #ifndef _DEBUG_ENABLE_FORMATMENU_
+ }
+ #endif
+
+ if( state & FmDriverInfo::EDriveLocked ){
+ HbAction *unLockedAction = new HbAction();
+ unLockedAction->setObjectName( "unLockedAction" );
+ unLockedAction->setText( hbTrId( "Unlock" ) );
+ mContextMenu->addAction( unLockedAction );
+
+ connect( unLockedAction, SIGNAL( triggered() ),
+ this, SLOT( on_unLockedAction_triggered() ), Qt::QueuedConnection );
}
}
-#endif
-
- if( state & FmDriverInfo::EDriveLocked ){
- HbAction *unLockedAction = new HbAction();
- unLockedAction->setObjectName( "unLockedAction" );
- unLockedAction->setText( hbTrId( "Unlock" ) );
- contextMenu->addAction( unLockedAction );
+ if( mContextMenu->actions().count() > 0 ) {
+ mContextMenu->setPreferredPos( coords );
+ mContextMenu->open();
+ } else {
+ emit activated( diskName );
+ }
+}
- connect( unLockedAction, SIGNAL( triggered() ),
- this, SLOT( on_unLockedAction_triggered() ) );
- }
-
- contextMenu->exec( coords );
+void FmDriverListWidget::on_list_pressed( const QModelIndex & index )
+{
+ mListLongPressed = false;
}
void FmDriverListWidget::on_viewAction_triggered()
@@ -228,24 +253,24 @@
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 title( hbTrId( "Drive name ") );
QString volumeName = driverInfo.volumeName();
QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) );
while( FmDlgUtils::showTextQuery( title, volumeName, false, FmMaxLengthofDriveName, associatedDrives ) ){
int err = FmUtils::renameDrive( diskName, volumeName );
if ( err == FmErrNone ){
- HbMessageBox::information( hbTrId( "The name has been changed!" ) );
+ 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 +294,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 +316,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 ( 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 +330,7 @@
break;
}
} else {
- HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) );
+ FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) );
}
}
@@ -318,21 +343,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!" ) );
}
}
@@ -351,18 +375,18 @@
while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd ) ) {
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 +396,9 @@
{
QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
- if( HbMessageBox::question( hbTrId( "Format? Data will be deleted during formatting." ) ) ){
+ if( FmDlgUtils::question( hbTrId( "Format? Data will be deleted during formatting." ) ) ){
if( FmErrNone != mOperationService->asyncFormat( diskName ) )
- HbMessageBox::information( hbTrId( "Formatting failed." ) );
+ FmDlgUtils::information( hbTrId( "Formatting failed." ) );
}
}
@@ -382,7 +406,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 +419,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 Fri Jun 25 17:08:34 2010 +0800
@@ -23,11 +23,12 @@
#include "fmoperationservice.h"
#include <hbwidget.h>
-class QFileSystemWatcher;
+class FmDriveModel;
class HbListView;
class HbAbstractViewItem;
class HbSearchPanel;
-class FmDriveModel;
+class HbMenu;
+class QFileSystemWatcher;
class QGraphicsLinearLayout;
@@ -50,6 +51,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();
@@ -79,6 +81,10 @@
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 Fri Jun 25 17:08:34 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 )
{
+ FmLogger::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& ) ) );
--- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Fri Jun 25 17:08:34 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
@@ -123,18 +122,35 @@
QString logString = "FmFileBrowseWidget::setRootPath(" + pathName + ')';
FmLogger::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()
+{
+ FmLogger::log("FmFileBrowseWidget::on_listActivated start");
+ if( mListLongPressed ) {
+ FmLogger::log("FmFileBrowseWidget::on_list_activated end because longPressed");
+ return;
+ }
if (!mSelectable) {
- if (mModel->isDir(index) ) {
- changeRootIndex( index );
+ if (mModel->isDir(mActivatedModelIndex) ) {
+ FmLogger::log("FmFileBrowseWidget::on_list_activated changeRootIndex>>");
+ changeRootIndex( mActivatedModelIndex );
+ FmLogger::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 );
}
}
}
+ FmLogger::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,7 +299,7 @@
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() ) );
@@ -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
@@ -453,76 +477,91 @@
void FmFileBrowseWidget::refreshModel( const QString& path )
{
+ FmLogger::log( "FmFileBrowseWidget::refreshModel start" );
+ // This slot will be triggered when drive inserted/ejected
+ // Because filemanger do not notify dir/files changed yet( QFileSystem will auto refresh.)
QString currPath( currentPath().absoluteFilePath() );
- QString refreshPath( path );
+
+ if( currPath.isEmpty() ) {
+ // label style and no data shown( dirve is not present or locked, or corrupt )
- if( !currPath.isEmpty() ) {
- if( refreshPath.isEmpty() ) {
- refreshPath = currPath;
- }
- if( !FmUtils::isPathEqual( refreshPath, currPath ) ) {
- // no need refresh other path
- return;
+ //set path as drive root, cause refresh, so that data can be shown when insert MMC in device.
+ setRootPath( mCurrentDrive );
+ // update title
+ } else {
+ // display drive data normally
+ // ignore path refresh event as QFileSystemModel will auto refresh.
+
+ // Handle drive refresh event as drive may be ejected.
+ if( path.isEmpty() ) { // path is empty means drive is changed.
+ checkPathAndSetStyle( currPath );
}
- 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 ) );
}
+ emit setTitle( FmUtils::fillDriveVolume( mCurrentDrive, true ) );
+ FmLogger::log( "FmFileBrowseWidget::refreshModel 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 " ) );
+ 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 );
+ 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 +578,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 +624,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 +632,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 +661,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 +678,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 +691,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 +707,31 @@
{
QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() );
-
+ int maxFileNameLength = FmUtils::getMaxFileNameLength();
+ 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, true,
+ 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
+ if( !FmUtils::checkNewFolderOrFile( newTargetPath, errString ) ) {
+ FmDlgUtils::information( errString );
continue;
}
-
if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) {
- HbMessageBox::information( hbTrId("Rename failed!") );
+ FmDlgUtils::information( hbTrId("Rename failed!") );
+ }
+ else {
+ if ( oldSuffix != newFileInfo.suffix() ) {
+ 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 Fri Jun 25 17:08:34 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,7 +71,7 @@
bool rename( const QString &oldName, const QString &newName );
void setModelFilter( QDir::Filters filters );
- bool checkPathAndSetStyle( const QString& path );
+ int checkPathAndSetStyle( const QString& path );
void refreshModel( const QString& path );
void sortFiles( TSortType sortType );
void activeSearchPanel();
@@ -83,16 +85,19 @@
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 +121,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 +138,13 @@
HbLabel *mEmptyTipLabel;
QString mCurrentDrive;
+
+ //used to avoid activate when long press list.
+ bool mListLongPressed;
+ QModelIndex mActivatedModelIndex;
+
+ // provide iocn 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 Fri Jun 25 17:08:34 2010 +0800
@@ -34,7 +34,6 @@
#include <hbaction.h>
#include <hbtoolbar.h>
#include <hblineedit.h>
-#include <hbmessagebox.h>
#include <hbpushbutton.h>
#include <hbmainwindow.h>
@@ -109,33 +108,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 +171,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();
}
@@ -215,18 +225,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 +254,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 +289,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 +301,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 +339,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 +360,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 +377,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 +392,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 );
+
+ 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,
+ true, 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( newTargetPath, errString ) ) {
+ FmDlgUtils::information( errString );
+ continue;
}
+ if( !dir.mkdir( dirName ) ) {
+ FmDlgUtils::information( hbTrId("Operation failed!") );
+ }
+ refreshModel( path );
+ break;
+ }
}
}
+
void FmFileView::on_upAction_triggered()
{
mWidget->cdUp();
@@ -410,13 +428,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();
}
@@ -493,3 +504,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 Fri Jun 25 17:08:34 2010 +0800
@@ -82,6 +82,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;
--- a/filemanager/src/filemanager/src/fmfindresultmodel.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -18,9 +18,11 @@
#include "fmfindresultmodel.h"
#include "fmfindthread.h"
+#include "fmfileiconprovider.h"
#include <QDateTime>
-#include <QFileIconProvider>
+
+#include <hbglobal.h>
FmFindResultModel::FmFindResultModel( QObject *parent )
: QAbstractListModel( parent )
@@ -93,10 +95,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();
}
}
@@ -171,7 +173,6 @@
mFindThread->setLastResult( mFindResult );
}
removeRows( 0, mFindResult.size() );
- emit modelCountChanged( mFindResult.size() );
mFindThread->start();
}
@@ -188,8 +189,10 @@
void FmFindResultModel::on_findThread_found( int count )
{
- int size = mFindResult.size();
- insertRows( mFindResult.size() - count, count );
+ if( count > 0 ) {
+ int size = mFindResult.size();
+ insertRows( mFindResult.size() - count, count );
+ }
emit modelCountChanged( mFindResult.size() );
}
@@ -203,7 +206,7 @@
{
mFindThread = new FmFindThread( &mFindResult, this );
mFindThread->setObjectName( "findThread" );
- mIconProvider = new QFileIconProvider();
+ mIconProvider = new FmFileIconProvider();
}
bool FmFindResultModel::caseNameLessThan(const QString &s1, const QString &s2)
@@ -250,21 +253,26 @@
// emit layoutAboutToBeChanged();
+ QStringList lst( mFindResult );
+ removeRows( 0, mFindResult.size() );
+
switch( ( SortFlag )column )
{
case Name:
- qSort( mFindResult.begin(), mFindResult.end(), caseNameLessThan );
+ qSort( lst.begin(), lst.end(), caseNameLessThan );
break;
case Time:
- qSort( mFindResult.begin(), mFindResult.end(), caseTimeLessThan );
+ qSort( lst.begin(), lst.end(), caseTimeLessThan );
break;
case Size:
- qSort( mFindResult.begin(), mFindResult.end(), caseSizeLessThan );
+ qSort( lst.begin(), lst.end(), caseSizeLessThan );
break;
case Type:
- qSort( mFindResult.begin(), mFindResult.end(), caseTypeLessThan );
+ qSort( lst.begin(), lst.end(), caseTypeLessThan );
break;
- }
-// emit layoutChanged();
- emit refresh();
+ }
+
+ mFindResult = lst;
+ insertRows( 0, mFindResult.size() );
+ emit modelCountChanged( mFindResult.size() );
}
--- a/filemanager/src/filemanager/src/fmfindresultmodel.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.h Fri Jun 25 17:08:34 2010 +0800
@@ -26,7 +26,7 @@
#include <QAbstractListModel>
class FmFindThread;
-class QFileIconProvider;
+class FmFileIconProvider;
class FmFindResultModel : public QAbstractListModel
{
@@ -79,7 +79,6 @@
// 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 );
@@ -90,7 +89,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 Fri Jun 25 17:08:34 2010 +0800
@@ -23,6 +23,7 @@
FmFindThread::FmFindThread( QStringList *r, QObject *parent )
: QThread( parent )
{
+ setPriority( LowPriority );
mResult = r;
}
@@ -58,7 +59,6 @@
void FmFindThread::run()
{
mStop = false;
- setPriority( LowPriority );
if (findPattern.isEmpty() || !findPattern.isValid())
return;
@@ -105,9 +105,7 @@
findDirs.removeFirst();
}
- if( count > 0 ) {
- emitFound();
- }
+ emitFound();
}
void FmFindThread::emitFound()
@@ -125,7 +123,7 @@
void FmFindThread::findInResult()
{
if( mFindPath.isEmpty() ){
- int count = mLastResult.count();
+ int count = mResult->count();
for (QStringList::Iterator it = mLastResult.begin(); it != mLastResult.end(); ++it) {
if (mStop){
return;
@@ -144,4 +142,5 @@
}
}
}
+ emitFound();
}
--- a/filemanager/src/filemanager/src/fmfindview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindview.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -52,7 +52,7 @@
{
setTitle( keyword );
mFindWidget->find( keyword, path );
- mWaitNote->exec();
+ mWaitNote->open();
}
void FmFindView::stopFind()
--- a/filemanager/src/filemanager/src/fmfindwidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindwidget.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -75,8 +75,6 @@
void FmFindWidget::on_resultModel_finished()
{
emit finished();
- //Since layout problem is found, refresh it
- on_resultModel_refresh();
}
void FmFindWidget::on_resultModel_modelCountChanged( int count )
@@ -140,9 +138,6 @@
connect( mModel, SIGNAL( modelCountChanged( int )),
this, SLOT( on_resultModel_modelCountChanged( int )) );
- connect( mModel, SIGNAL( refresh()),
- this, SLOT( on_resultModel_refresh()) );
-
mListView = new HbListView( this );
mListView->setModel( mModel );
@@ -204,11 +199,5 @@
}
-void FmFindWidget::on_resultModel_refresh()
-{
- mListView->setModel( 0 );
- mListView->setModel( mModel );
-}
-
--- a/filemanager/src/filemanager/src/fmfindwidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindwidget.h Fri Jun 25 17:08:34 2010 +0800
@@ -65,8 +65,7 @@
void on_resultModel_finished();
void on_resultModel_modelCountChanged( int count );
- void on_resultModel_refresh();
-
+
private:
void init();
void initSearchPanel();
--- a/filemanager/src/filemanager/src/fmmainwindow.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmmainwindow.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -20,10 +20,9 @@
#include <hbaction.h>
-FmMainWindow::FmMainWindow()
+FmMainWindow::FmMainWindow() : mViewManager( 0 ), mFirstViewLoaded( false )
{
- init();
- QMetaObject::connectSlotsByName( this );
+ connect(this, SIGNAL(viewReady()), this, SLOT(delayedLoading()));
}
FmMainWindow::~FmMainWindow()
@@ -45,13 +44,13 @@
void FmMainWindow::init()
{
+ FmLogger::log("FmMainWindow::init start");
mViewManager = FmViewManager::CreateViewManager( this );
-
mViewManager->createDriverView();
-
connect( this, SIGNAL( orientationChanged( Qt::Orientation ) ),
this, SLOT( onOrientationChanged( Qt::Orientation ) ) );
+ FmLogger::log("FmMainWindow::init end");
// if ( orientation() == Qt::Vertical ) {
// createDriverView();
// } else {
@@ -59,3 +58,14 @@
// }
}
+void FmMainWindow::delayedLoading()
+{
+ FmLogger::log("FmMainWindow::delayedLoading start");
+ if( mFirstViewLoaded ) {
+ return;
+ }
+ init();
+ mFirstViewLoaded = true;
+ FmLogger::log("FmMainWindow::delayedLoading end");
+}
+
--- a/filemanager/src/filemanager/src/fmmainwindow.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmmainwindow.h Fri Jun 25 17:08:34 2010 +0800
@@ -35,11 +35,12 @@
private slots:
void onOrientationChanged( Qt::Orientation orientation );
-
+ void delayedLoading();
private:
void init();
FmViewManager *mViewManager;
+ bool mFirstViewLoaded;
};
#endif
--- a/filemanager/src/filemanager/src/fmsplitview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmsplitview.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -21,7 +21,6 @@
#include "fmdriverlistwidget.h"
#include <QGraphicsLinearLayout>
-#include <hbmessagebox.h>
#include <hbmenu.h>
#include <hbaction.h>
#include <hbmainwindow.h>
@@ -50,7 +49,7 @@
void FmSplitView::on_normalViewAction_triggered()
{
- mainWindow()->setCurrentView( mainWindow()->viewAt(0) );
+ mainWindow()->setCurrentView( mainWindow()->views().first() );
}
void FmSplitView::initMenu()
--- a/filemanager/src/filemanager/src/fmviewmanager.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -28,17 +28,18 @@
#include "fmoperationservice.h"
#include "fmoperationbase.h"
#include "fmdrivewatcher.h"
+#include "fmdialog.h"
+#include "fmdlgutils.h"
#include <hbview.h>
-#include <hbmessagebox.h>
#include <QFileSystemWatcher>
#include <QFileInfo>
-#include <hbdialog.h>
+
FmViewManager *FmViewManager::mViewManager = 0;
-FmDlgCloseUnit::FmDlgCloseUnit( HbDialog *dialog ) : mDialog( dialog )
+FmDlgCloseUnit::FmDlgCloseUnit( FmDialog *dialog ) : mDialog( dialog )
{
}
FmDlgCloseUnit::~FmDlgCloseUnit()
@@ -64,7 +65,7 @@
return mAssociatedDrives;
}
-HbDialog *FmDlgCloseUnit::dialog()
+FmDialog *FmDlgCloseUnit::dialog()
{
return mDialog;
}
@@ -150,10 +151,25 @@
emit refreshModel( path );
}
+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();
}
@@ -175,15 +191,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;
}
@@ -229,7 +244,10 @@
mMainWindow->addView( backupView );
mMainWindow->setCurrentView( backupView );
-
+ connect( this, SIGNAL( refreshModel( QString ) ), //emit when need refresh models
+ backupView, SLOT( refreshModel( QString ) ) );
+ connect( this, SIGNAL( refreshBackupDate() ), //emit when need refresh backup date
+ backupView, SLOT( refreshBackupDate() ) );
}
void FmViewManager::createRestoreView()
@@ -238,6 +256,7 @@
mMainWindow->addView( restoreView );
mMainWindow->setCurrentView( restoreView );
+ connect( this, SIGNAL( refreshRestoreView() ), restoreView, SLOT( refreshRestoreView() ) );
}
@@ -247,6 +266,7 @@
mMainWindow->addView( deleteBackupView );
mMainWindow->setCurrentView( deleteBackupView );
+ connect( this, SIGNAL( refreshDeleteBackupView() ), deleteBackupView, SLOT( refreshDeleteBackupView() ) );
}
@@ -279,6 +299,8 @@
{
FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) );
emit refreshModel( QString("") );
+ emit refreshDeleteBackupView();
+ emit refreshRestoreView();
checkDlgCloseUnit();
FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) );
--- a/filemanager/src/filemanager/src/fmviewmanager.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.h Fri Jun 25 17:08:34 2010 +0800
@@ -30,21 +30,21 @@
class FmOperationBase;
class QFileSystemWatcher;
class FmDriveWatcher;
-class HbDialog;
+class FmDialog;
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;
};
@@ -96,8 +96,12 @@
void on_fsWatcher_fileChanged(const QString &path);
void on_fsWatcher_directoryChanged(const QString &path);
void on_driveWatcher_driveAddedOrChanged();
+ void on_operationService_notifyFinish( FmOperationBase *operationBase );
signals:
void refreshModel( const QString &path );
+ void refreshBackupDate();
+ void refreshDeleteBackupView();
+ void refreshRestoreView();
private:
/// create view will push current view to stack
--- a/filemanager/src/filemanager/src/listviewitems.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/listviewitems.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -20,7 +20,6 @@
#include "listviewitems.h"
#include "fmutils.h"
-#include <QFileIconProvider>
#include <QGraphicsLinearLayout>
#include <hblabel.h>
@@ -32,12 +31,13 @@
: HbListViewItem( parent ),
mIconLabel( 0 ),
mDiskNameLabel( 0 ),
- mSizeLabel( 0 ),
- mFreeLabel( 0 ),
- mCheckBox( 0 )
+ mFirstLabel( 0 ),
+ mSecondLabel( 0 ),
+ mCheckBox( 0 ),
+ hLayout( 0 )
{
- init();
+ //init();
}
DiskListViewItem::~DiskListViewItem()
@@ -58,17 +58,18 @@
HbAbstractViewItem *DiskListViewItem::createItem()
{
- return new DiskListViewItem( parentItem() );
+ return new DiskListViewItem( *this );
}
void DiskListViewItem::updateChildItems()
{
+ //HbListViewItem::updateChildItems();
+ if( !hLayout ) {
+ init();
+ }
QVariant variant = modelIndex().data( Qt::DecorationRole );
QIcon icon = qvariant_cast<QIcon>( variant );
- if( icon.isNull() ) {
- QFileIconProvider fileIconProvider;
- icon = fileIconProvider.icon( QFileIconProvider::Drive );
- }
+ // FmFileIconProvider in FmDriveModel already handle null icon issue
QString displayString = modelIndex().data( Qt::DisplayRole ).toString();
QString diskName = modelIndex().data( Qt::UserRole ).toString();
@@ -79,8 +80,19 @@
FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
mDiskNameLabel->setPlainText( displayString );
- mSizeLabel->setPlainText( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) );
- mFreeLabel->setPlainText( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) );
+ if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) {
+ mFirstLabel->setPlainText( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) );
+ mSecondLabel->setPlainText( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) );
+ } else if( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) {
+ mFirstLabel->setPlainText( hbTrId ( "Locked" ) );
+ mSecondLabel->setPlainText( QString(" ") );
+ } else if( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) {
+ mFirstLabel->setPlainText( hbTrId ( "Corrupted" ) );
+ mSecondLabel->setPlainText( QString(" ") );
+ } else if( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent ) {
+ mFirstLabel->setPlainText( hbTrId ( "Not Ready" ) );
+ mSecondLabel->setPlainText( QString(" ") );
+ }
// mCheckBox->setCheckState( checkState() );
}
@@ -92,9 +104,11 @@
void DiskListViewItem::init()
{
- QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout();
+ hLayout = new QGraphicsLinearLayout();
+
hLayout->setOrientation( Qt::Horizontal );
-
+ hLayout->addItem(layout());
+
mIconLabel = new HbLabel();
mIconLabel->setMinimumWidth(32);
hLayout->addItem( mIconLabel );
@@ -109,15 +123,15 @@
vLayout->addItem( mDiskNameLabel );
vLayout->setAlignment( mDiskNameLabel, Qt::AlignLeft );
- mSizeLabel = new HbLabel();
- mSizeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- vLayout->addItem( mSizeLabel );
- vLayout->setAlignment( mSizeLabel, Qt::AlignLeft );
+ mFirstLabel = new HbLabel();
+ mFirstLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
+ vLayout->addItem( mFirstLabel );
+ vLayout->setAlignment( mFirstLabel, Qt::AlignLeft );
- mFreeLabel = new HbLabel();
- mFreeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
- vLayout->addItem( mFreeLabel );
- vLayout->setAlignment( mFreeLabel, Qt::AlignLeft );
+ mSecondLabel = new HbLabel();
+ mSecondLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
+ vLayout->addItem( mSecondLabel );
+ vLayout->setAlignment( mSecondLabel, Qt::AlignLeft );
HbWidget *labelsWidget = new HbWidget();
labelsWidget->setLayout(vLayout);
@@ -127,88 +141,3 @@
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
+++ b/filemanager/src/filemanager/src/listviewitems.h Fri Jun 25 17:08:34 2010 +0800
@@ -26,6 +26,7 @@
class HbCheckBox;
class HbLabel;
+class QGraphicsLinearLayout;
class DiskListViewItem : public HbListViewItem
{
@@ -38,7 +39,6 @@
virtual bool canSetModelIndex( const QModelIndex &index ) const;
virtual HbAbstractViewItem *createItem();
virtual void updateChildItems();
-
private slots:
void setCheckedState( int state );
@@ -50,9 +50,10 @@
HbLabel *mIconLabel;
HbLabel *mDiskNameLabel;
- HbLabel *mSizeLabel;
- HbLabel *mFreeLabel;
+ HbLabel *mFirstLabel;
+ HbLabel *mSecondLabel;
HbCheckBox *mCheckBox;
+ QGraphicsLinearLayout *hLayout;
};
/* not used
--- a/filemanager/src/filemanager/src/main.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/main.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -29,18 +29,22 @@
int main( int argc, char *argv[] )
{
+ FmLogger::log( "main start" );
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 );
+ translator.load( path + "filemanager_" + lang );
app.installTranslator(&translator);
+ app.setApplicationName( hbTrId("txt_fmgr_title_file_manager") );
+
+ FmLogger::log( "main_createMainwindow start" );
FmMainWindow mw;
+ FmLogger::log( "main_createMainwindow end" );
mw.show();
-
+ FmLogger::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 Fri Jun 25 17:08:34 2010 +0800
@@ -17,6 +17,8 @@
*/
#include "fmoperationbase.h"
+#include "fmdrivedetailstype.h"
+#include <QtAlgorithms>
FmOperationBase::FmOperationBase( QObject *parent, FmOperationService::TOperationType operationType ) :
QObject( parent ), mOperationType( operationType )
@@ -56,6 +58,7 @@
}
FmOperationDriveDetails::~FmOperationDriveDetails()
{
+ qDeleteAll(mDetailsSizeList);
}
QString FmOperationDriveDetails::driverName()
--- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -19,6 +19,7 @@
#include "fmcommon.h"
#include "fmoperationbase.h"
#include "fmdrivedetailstype.h"
+#include "fmutils.h"
#include <QDir>
#include <QFileInfo>
@@ -96,7 +97,7 @@
}
destFi.setFile( destFi.absoluteFilePath() );
} else {
- emit askForRename( destFi.absoluteFilePath(), &newName );
+ queryForRename( destFi.absoluteFilePath(), &newName );
if( newName.isEmpty() ) {
ret = FmErrCancel;
break;
@@ -106,7 +107,7 @@
}
} else{
// destination is dir
- emit askForRename( destFi.absoluteFilePath(), &newName );
+ queryForRename( destFi.absoluteFilePath(), &newName );
if( newName.isEmpty() ) {
ret = FmErrCancel;
break;
@@ -155,7 +156,7 @@
*mErrString = source;
ret = FmErrCannotCopy;
} else {
- IncreaseProgress( fileSize );
+ increaseProgress( fileSize );
}
} else if (fi.isDir()) {
ret = copyDirInsideContent( source, newName );
@@ -171,18 +172,21 @@
int FmOperationCopy::copyDirInsideContent( const QString &srcPath, const QString &destPath )
{
- if( destPath.contains( srcPath, Qt::CaseInsensitive ) ) {
+ QFileInfo srcInfo( srcPath );
+ QFileInfo destInfo( destPath );
+
+ QString destUpPath = FmUtils::fillPathWithSplash( destInfo.absolutePath() );
+ if( destUpPath.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;
@@ -210,7 +214,7 @@
*mErrString = fileInfo.absoluteFilePath();
return FmErrCannotCopy;
}
- IncreaseProgress( fileInfo.size() );
+ increaseProgress( fileInfo.size() );
} else if( fileInfo.isDir() ) {
//makedir
QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
@@ -235,7 +239,7 @@
return FmErrNone;
}
-void FmOperationCopy::IncreaseProgress( quint64 size )
+void FmOperationCopy::increaseProgress( quint64 size )
{
if( mTotalSize <=0 ) {
return;
@@ -247,3 +251,8 @@
emit notifyProgress( mCurrentStep );
}
}
+
+void FmOperationCopy::queryForRename( const QString &srcFile, QString *destFile )
+{
+ emit askForRename( srcFile, destFile );
+}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopy.h Fri Jun 25 17:08:34 2010 +0800
@@ -36,6 +36,7 @@
signals:
void askForRename( const QString &srcFile, QString *destFile );
void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted );
+ void showNote( const char *note );
void notifyPreparing( bool cancelable );
void notifyStart( bool cancelable, int maxSteps );
void notifyProgress( int currentStep );
@@ -43,7 +44,8 @@
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 );
+ void increaseProgress( quint64 size );
+ void queryForRename( const QString &srcFile, QString *destFile );
private:
QStringList mSourceList;
--- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -95,7 +95,7 @@
}
destFi.setFile( destFi.absoluteFilePath() );
} else {
- emit askForRename( destFi.absoluteFilePath(), &newName );
+ queryForRename( destFi.absoluteFilePath(), &newName );
if( newName.isEmpty() ) {
ret = FmErrCancel;
break;
@@ -105,7 +105,7 @@
}
} else{
// destination is dir
- emit askForRename( destFi.absoluteFilePath(), &newName );
+ queryForRename( destFi.absoluteFilePath(), &newName );
if( newName.isEmpty() ) {
ret = FmErrCancel;
break;
@@ -155,7 +155,7 @@
*mErrString = source;
ret = FmErrCannotRemove;
}
- IncreaseProgress( fileSize );
+ increaseProgress( fileSize );
} else if (fi.isDir()) {
if( FmUtils::isDefaultFolder( source ) ){
ret = FmErrRemoveDefaultFolder;
@@ -180,18 +180,20 @@
}
int FmOperationMove::moveDirInsideContent( const QString &srcPath, const QString &destPath )
{
- if( destPath.contains( srcPath, Qt::CaseInsensitive ) ) {
+ QFileInfo srcInfo( srcPath );
+ QFileInfo destInfo( destPath );
+
+ QString destUpPath = FmUtils::fillPathWithSplash( destInfo.absolutePath() );
+ if( destUpPath.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;
@@ -223,7 +225,7 @@
*mErrString = fileInfo.absoluteFilePath();
return FmErrCannotRemove;
}
- IncreaseProgress( fileSize );
+ increaseProgress( fileSize );
} else if( fileInfo.isDir() ) {
//makedir
QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() );
@@ -256,7 +258,7 @@
return FmErrNone;
}
-void FmOperationMove::IncreaseProgress( quint64 size )
+void FmOperationMove::increaseProgress( quint64 size )
{
if( mTotalSize <=0 ) {
return;
@@ -269,4 +271,7 @@
}
}
-
+void FmOperationMove::queryForRename( const QString &srcFile, QString *destFile )
+{
+ emit askForRename( srcFile, destFile );
+}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationmove.h Fri Jun 25 17:08:34 2010 +0800
@@ -35,6 +35,7 @@
signals:
void askForRename( const QString &srcFile, QString *destFile );
void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted );
+ void showNote( const QString ¬eString );
void notifyPreparing( bool cancelable );
void notifyStart( bool cancelable, int maxSteps );
void notifyProgress( int currentStep );
@@ -42,7 +43,8 @@
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 );
+ void increaseProgress( quint64 size );
+ void queryForRename( const QString &srcFile, QString *destFile );
private:
QStringList mSourceList;
--- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -21,10 +21,11 @@
#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>
FmOperationResultProcesser::FmOperationResultProcesser( FmOperationService *operationService )
: mOperationService( operationService ), mNote( 0 )
@@ -39,12 +40,31 @@
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 fileInfo(srcFile);
+ bool ret = FmDlgUtils::showTextQuery( questionText, value, true, maxFileNameLength, QString(), false );
+ while ( ret ) {
+ // remove whitespace from the start and the end.
+ value = value.trimmed();
+ QString newTargetPath = FmUtils::fillPathWithSplash(
+ fileInfo.absolutePath() ) + value;
+ QString errString;
+ // check if name/path is available for use.
+ if( !FmUtils::checkNewFolderOrFile( newTargetPath, errString ) ) {
+ FmDlgUtils::information( errString );
+ ret = FmDlgUtils::showTextQuery( questionText, value, true, maxFileNameLength, QString(), false );
+ continue;
+ } else {
+ break;
+ }
+ }
+ if( ret ) {
+ *destFile = value;
+ }
}
void FmOperationResultProcesser::onAskForReplace(
@@ -55,16 +75,21 @@
QString questionText = QString( "file " ) +
srcFile + QString( " already exist, replace it?" );
- if( HbMessageBox::question( questionText ) ) {
+ if( FmDlgUtils::question( questionText ) ) {
*isAccepted = true;
} else {
*isAccepted = false;
}
}
+void FmOperationResultProcesser::onShowNote( FmOperationBase* operationBase, const char *noteString )
+{
+ FmDlgUtils::information(hbTrId(noteString));
+}
+
void FmOperationResultProcesser::onNotifyWaiting( FmOperationBase* operationBase, bool cancelable )
{
- QString title = tr("Operation");
+ QString title = hbTrId("Operation");
switch( operationBase->operationType() )
{
case FmOperationService::EOperationTypeBackup:
@@ -119,7 +144,7 @@
void FmOperationResultProcesser::onNotifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps )
{
- QString title = tr("Operation");
+ QString title = hbTrId("Operation");
switch( operationBase->operationType() )
{
case FmOperationService::EOperationTypeBackup:
@@ -179,38 +204,44 @@
}
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();
+ if( ( state & FmDriverInfo::EDriveAvailable ) &&
+ ( state & FmDriverInfo::EDriveRemovable ) &&
+ !( state & FmDriverInfo::EDriveMassStorage ) ) {
+ QString volumeName;
+ while( FmDlgUtils::showTextQuery( title, volumeName, false, FmMaxLengthofDriveName ) ){
int err = FmUtils::renameDrive( driveName, volumeName );
if ( err == FmErrNone ){
- HbMessageBox::information( hbTrId( "The name has been changed!" ) );
+ FmDlgUtils::information( hbTrId( "The name has been changed!" ) );
mOperationService->on_operationThread_refreshModel( driveName );
break;
} else if( err == FmErrBadName ) {
- HbMessageBox::information( hbTrId( "Illegal characters! Use only letters and numbers." ) );
+ 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")) );
}
}
@@ -221,41 +252,56 @@
switch( error )
{
case FmErrAlreadyStarted:
- HbMessageBox::information( QString( hbTrId("Operation already started!")) );
+ FmDlgUtils::information( QString( hbTrId("Operation already started!")) );
+ return;
+ case FmErrLocked:
+ 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:
+ FmDlgUtils::information( QString( hbTrId("Operation failed because target media is corrupted!") ) );
+ return;
+ case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup
+ FmDlgUtils::information( QString( hbTrId("Operation failed because device is not ready!") ) );
+ return;
+ case FmErrDisMounted: // Caused by eject MMC when preparing backup
+ FmDlgUtils::information( QString( hbTrId("Operation failed because device 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,10 +310,10 @@
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")) );
}
}
@@ -276,7 +322,7 @@
{
Q_UNUSED( operationBase );
cancelProgress();
- HbMessageBox::information( QString( hbTrId("Operation Canceled!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation Canceled!") ) );
}
@@ -304,11 +350,16 @@
// mNote->setProgressDialogType( HbProgressDialog::WaitNote );
// }
mNote->setText( title );
- if( !cancelable )
- mNote->primaryAction()->setDisabled( true );
- else
- mNote->primaryAction()->setDisabled( false );
- mNote->exec();
+ 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();
}
@@ -333,13 +384,16 @@
mNote->setMaximum( 65535 );
mNote->setProgressValue( 0 );
mNote->setText( title );
- if( !cancelable ){
- mNote->primaryAction()->setDisabled( true );
- }
- else{
- mNote->primaryAction()->setDisabled( false );
- }
- mNote->exec();
+ 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();
}
void FmOperationResultProcesser::showProgress( QString title, bool cancelable, int maxValue )
@@ -365,15 +419,16 @@
mNote->setMaximum( maxValue );
mNote->setProgressValue( 0 );
-
- if( !cancelable ){
- mNote->primaryAction()->setDisabled( true );
- }
- else{
- mNote->primaryAction()->setDisabled( false );
- }
-
- mNote->exec();
+ 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();
}
void FmOperationResultProcesser::setProgress( int value )
--- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Fri Jun 25 17:08:34 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 );
--- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -29,7 +29,6 @@
#include "fmoperationformat.h"
#include <hbaction.h>
-#include <hbmessagebox.h>
FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ),
mCurrentOperation( 0 )
@@ -293,6 +292,10 @@
{
emit refreshModel( mCurrentOperation, path );
}
+void FmOperationService::on_operationThread_showNote( const char *noteString )
+{
+ mOperationResultProcesser->onShowNote( mCurrentOperation, noteString );
+}
void FmOperationService::on_operationThread_notifyWaiting( bool cancelable )
{
mOperationResultProcesser->onNotifyWaiting(
--- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Fri Jun 25 17:08:34 2010 +0800
@@ -95,6 +95,7 @@
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_showNote( const char *noteString );
void on_operationThread_notifyWaiting( bool cancelable );
void on_operationThread_notifyPreparing( bool cancelable );
void on_operationThread_notifyStart( bool cancelable, int maxSteps );
--- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -51,6 +51,8 @@
this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection );
connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ),
this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection );
+ connect( mOperationBase, SIGNAL( showNote( QString ) ),
+ this, SLOT( onShowNote( QString )), Qt::BlockingQueuedConnection );
start();
return FmErrNone;
@@ -69,6 +71,8 @@
this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection );
connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ),
this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection );
+ connect( mOperationBase, SIGNAL( showNote( QString ) ),
+ this, SLOT( onShowNote( QString )), Qt::BlockingQueuedConnection );
start();
@@ -144,6 +148,12 @@
{
emit askForReplace( srcFile, destFile, isAccepted );
}
+
+void FmOperationThread::onShowNote( const char *noteString )
+{
+ emit showNote( noteString );
+}
+
void FmOperationThread::on_operationElement_notifyPreparing( bool cancelable )
{
emit notifyPreparing( cancelable );
@@ -167,6 +177,7 @@
{
mErrString.clear();
FmOperationCopy *operationCopy = static_cast<FmOperationCopy*>(mOperationBase);
+ QString refreshDestPath = QFileInfo( operationCopy->targetPath() ).dir().absolutePath();
int ret = operationCopy->start( &mStop, &mErrString );
switch( ret )
@@ -176,6 +187,7 @@
break;
case FmErrNone:
emit notifyFinish();
+ emit refreshModel( refreshDestPath );
break;
default:
emit notifyError( ret, mErrString );
--- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Fri Jun 25 17:08:34 2010 +0800
@@ -55,6 +55,7 @@
void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted );
void refreshModel( const QString &path );
+ void showNote(const char*);
void notifyWaiting( bool cancelable );
void notifyPreparing( bool cancelable ); // this step could not be used if not needed.
void notifyStart( bool cancelable, int maxSteps );
@@ -67,6 +68,7 @@
private slots:
void onAskForRename( const QString &srcFile, QString *destFile );
void onAskForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted );
+ void onShowNote( const char *noteString );
void on_operationElement_notifyPreparing( bool cancelable );
void on_operationElement_notifyStart( bool cancelable, int maxSteps );
void on_operationElement_notifyProgress( int currentStep );
--- a/filemanager/src/fmbkupengine/src/MMCScBkupSBEUtils.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupengine/src/MMCScBkupSBEUtils.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -230,20 +230,19 @@
{
// Must first create a generic transfer type object... sigh...
CSBGenericTransferType* transferType = CSBGenericTransferType::NewL( nonConstOriginal->Externalise() );
- CleanupStack::PushL( transferType );
- switch(type)
+ CleanupStack::PushL( transferType );
+ if ( ESIDTransferDerivedType == type )
{
- case ESIDTransferDerivedType:
ret = CSBSIDTransferType::NewL( transferType );
- break;
- case EPackageTransferDerivedType:
+ }
+ else if ( EPackageTransferDerivedType == type )
+ {
ret = CSBPackageTransferType::NewL( transferType );
- break;
- case EJavaTransferDerivedType:
+ }
+ // Type is EJavaTransferDerivedType
+ else
+ {
ret = CSBJavaTransferType::NewL( transferType );
- break;
- default:
- break;
}
CleanupStack::PopAndDestroy( transferType );
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/fmbkupenginewrapper/bwins/fmbkupenginewrapperu.def Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 2010 +0800
@@ -14,6 +14,7 @@
# Description: The project file of FmBkupEngineWrapper
#
+CONFIG += hb
TARGET =
TEMPLATE = lib
QT = core
--- a/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Fri Jun 25 17:08:34 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/inc/fmbkupengine.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/inc/fmbkupengine.h Fri Jun 25 17:08:34 2010 +0800
@@ -84,7 +84,7 @@
void GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > &drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
- const int aDrive = FmErrNotFound );
+ const QString& aDrive );
void getBackupDriveList( QStringList &driveList );
--- 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 Fri Jun 25 17:08:34 2010 +0800
@@ -98,8 +98,18 @@
QList<FmBkupBackupCategory*> backupCategoryList,
QString drive, quint32 content)
{
+ FmLogger::log( "FmBkupEnginePrivate::startBackup_with drive: " + drive +
+ "_number:" + QString::number(DriverNameToNumber( drive )));
if( drive.isEmpty() ) {
iError = KErrPathNotFound;
+ FmLogger::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;
+ FmLogger::log( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is not available" );
return false;
}
QString logString;
@@ -183,10 +193,9 @@
FmLogger::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 ];
@@ -405,6 +414,7 @@
int FmBkupEnginePrivate::error()
{
+ FmLogger::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;
}
@@ -650,8 +668,9 @@
void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
- const TInt aDrive )
+ const QString& aDrive )
{
+ int targetDrive = DriverNameToNumber( aDrive );
FmBackupSettings& settings( *( q->BackupSettingsL() ) );
restoreInfoList.clear();
@@ -684,7 +703,7 @@
archives,
params,
AllowedDriveAttMatchMask(),
- aDrive );
+ targetDrive );
// Fill restore info
TInt count( archives.Count() );
@@ -705,7 +724,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 +769,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 +806,6 @@
}
}
}
-
fs.Close();
}
--- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.h Fri Jun 25 17:08:34 2010 +0800
@@ -77,7 +77,7 @@
bool StartRestoreL( QList<FmBkupDrivesAndOperation* > drivesAndOperationList );
void GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
- const TInt aDrive = KErrNotFound );
+ const QString& aDrive );
void getBackupDriveList( QStringList &driveList );
--- a/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -149,7 +149,7 @@
void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
- const int aDrive )
+ const QString& aDrive )
{
restoreInfoList.clear();
QString debugString;
@@ -162,7 +162,7 @@
dateTime.setTime_t( settings.value( "dateTime" ).toUInt() );
QString drive = settings.value( "drive" ).toString();
settings.endGroup();
- if( content != 0 && ( DriverNameToNumber(drive) == aDrive || aDrive < 0 ) )
+ if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) )
{
FmRestoreInfo restoreInfo( content, dateTime, drive );
restoreInfoList.push_back( restoreInfo );
@@ -173,7 +173,7 @@
dateTime.setTime_t( settings.value( "dateTime" ).toUInt() );
drive = settings.value( "drive" ).toString();
settings.endGroup();
- if( content != 0 && ( DriverNameToNumber(drive) == aDrive || aDrive < 0 ) )
+ if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) )
{
FmRestoreInfo restoreInfo( content, dateTime, drive );
restoreInfoList.push_back( restoreInfo );
@@ -184,7 +184,7 @@
dateTime.setTime_t( settings.value( "dateTime" ).toUInt() );
drive = settings.value( "drive" ).toString();
settings.endGroup();
- if( content != 0 && ( DriverNameToNumber(drive) == aDrive || aDrive < 0 ) )
+ if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) )
{
FmRestoreInfo restoreInfo( content, dateTime, drive );
restoreInfoList.push_back( restoreInfo );
@@ -195,7 +195,7 @@
dateTime.setTime_t( settings.value( "dateTime" ).toUInt() );
drive = settings.value( "drive" ).toString();
settings.endGroup();
- if( content != 0 && ( DriverNameToNumber(drive) == aDrive || aDrive < 0 ) )
+ if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) )
{
FmRestoreInfo restoreInfo( content, dateTime, drive );
restoreInfoList.push_back( restoreInfo );
@@ -206,7 +206,7 @@
dateTime.setTime_t( settings.value( "dateTime" ).toUInt() );
drive = settings.value( "drive" ).toString();
settings.endGroup();
- if( content != 0 && ( DriverNameToNumber(drive) == aDrive || aDrive < 0 ) )
+ if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) )
{
FmRestoreInfo restoreInfo( content, dateTime, drive );
restoreInfoList.push_back( restoreInfo );
@@ -217,7 +217,7 @@
dateTime.setTime_t( settings.value( "dateTime" ).toUInt() );
drive = settings.value( "drive" ).toString();
settings.endGroup();
- if( content != 0 && ( DriverNameToNumber(drive) == aDrive || aDrive < 0 ) )
+ if( content != 0 && ( drive.contains( aDrive, Qt::CaseInsensitive ) || aDrive.isEmpty() ) )
{
FmRestoreInfo restoreInfo( content, dateTime, drive );
restoreInfoList.push_back( restoreInfo );
@@ -425,3 +425,9 @@
return driverName;
}
+void FmBkupEnginePrivate::getBackupDriveList( QStringList &driveList )
+ {
+ driveList.append("E:/");
+ driveList.append("F:/");
+ }
+
--- 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 Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 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();
+}
--- a/filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -30,7 +30,7 @@
connect( d, SIGNAL( notifyStart( bool, int ) ), this, SIGNAL( notifyStart( bool, int ) ) );
connect( d, SIGNAL( notifyUpdate(int) ), this, SIGNAL( notifyUpdate(int) ) );
connect( d, SIGNAL( notifyFinish(int) ),
- this, SIGNAL( notifyFinish(int) ) );
+ this, SIGNAL( notifyFinish(int) ), Qt::DirectConnection );
connect( d, SIGNAL( notifyMemoryLow(int, int& ) ), this, SIGNAL( notifyMemoryLow(int, int&) ) );
connect( d, SIGNAL( notifyBackupFilesExist( bool& )), this, SIGNAL( notifyBackupFilesExist( bool&) ) );
}
@@ -88,7 +88,7 @@
void FmBkupEngine::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > &drivesAndOperationList,
QList< FmRestoreInfo > &restoreInfoList,
- const int aDrive )
+ const QString& aDrive )
{
d->GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, aDrive );
}
--- a/filemanager/src/fmbkupenginewrapper/src/fmrestoresettings.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmbkupenginewrapper/src/fmrestoresettings.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -60,7 +60,8 @@
QList< FmRestoreInfo > restoreInfoList;
- mEngine.GetRestoreInfoArray( drivesAndOperationList, restoreInfoList );
+ QString targetDrive = mEngine.BackupSettingsL()->availableTargetDrive();
+ mEngine.GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, targetDrive );
// fetch info list from engine, and then init the entry list for display
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/fmfiledialog/bwins/fmfiledialogu.def Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 2010 +0800
@@ -31,13 +31,13 @@
-lcone \
-ldirectorylocalizer
- 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.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -32,6 +32,7 @@
#include "hblineedit.h"
#include <QGraphicsLinearLayout>
+#include <QEventLoop>
FmFileDialog::FmFileDialog( QGraphicsItem *parent ) :
HbDialog( parent ), d_ptr( new FmFileDialogPrivate( this ) )
@@ -67,7 +68,7 @@
FmFileDialog dialog( parent );
dialog.d_ptr->init( args );
if( dialog.exec() ) {
- ret = FmUtils::fillPathWithSplash( dialog.d_ptr->currentPath() );
+ ret = FmUtils::formatPath( dialog.d_ptr->currentPath() );
}
return ret;
}
@@ -96,7 +97,7 @@
FmFileDialog dialog( parent );
dialog.d_ptr->init( args );
if( dialog.exec() ) {
- ret = FmUtils::fillPathWithSplash( dialog.d_ptr->currentPath() )
+ ret = FmUtils::formatPath( dialog.d_ptr->currentPath() )
+ dialog.d_ptr->selectedFile();
}
return ret;
@@ -126,7 +127,7 @@
FmFileDialog dialog( parent );
dialog.d_ptr->init( args );
if( dialog.exec() ) {
- ret = FmUtils::fillPathWithSplash( dialog.d_ptr->currentPath() )
+ ret = FmUtils::formatPath( dialog.d_ptr->currentPath() )
+ dialog.d_ptr->selectedFile();
}
return ret;
@@ -136,13 +137,70 @@
bool FmFileDialog::exec()
{
- if ( d_ptr->isOkAction( HbDialog::exec() ) ) {
+ HbDialog::open( this, SLOT(dialogClosed(HbAction*)) );
+ d_ptr->eventLoop().exec();
+
+ if ( d_ptr->isOkAction( d_ptr->retAction() ) ) {
return true;
} else {
return false ;
}
}
+void FmFileDialog::dialogClosed(HbAction *action)
+{
+ d_ptr->setRetAction( action );
+ d_ptr->eventLoop().exit();
+}
+HbAction *FmFileDialog::primaryAction() const
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() > 0) {
+ return (HbAction *)(actionList.at(0));
+ } else {
+ return 0;
+ }
+
+}
+void FmFileDialog::setPrimaryAction( HbAction *action )
+{
+ 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 *FmFileDialog::secondaryAction() const
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() > 1) {
+ return (HbAction *)(actionList.at(1));
+ } else {
+ return 0;
+ }
+}
+
+void FmFileDialog::setSecondaryAction( HbAction *action )
+{
+ QList<QAction *> actionList = QGraphicsWidget::actions();
+ if (actionList.size() == 0) {
+ QGraphicsWidget::addAction(new HbAction(hbTrId("Ok")));
+ 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/fmfiledialog/src/fmfiledialog_p.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp Fri Jun 25 17:08:34 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/fmfiledialog_p.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfiledialog_p.h Fri Jun 25 17:08:34 2010 +0800
@@ -20,8 +20,10 @@
#ifndef FMFILEDIALOG_P_H
#define FMFILEDIALOG_P_H
+#include "fmfiledialog.h"
+
#include <QDir>
-#include "fmfiledialog.h"
+#include <QEventLoop>
class HbPushButton;
class FmFileWidget;
@@ -64,7 +66,11 @@
QString currentPath() const;
QString selectedFile() const;
bool isOkAction( HbAction *action );
-
+
+ void setRetAction( HbAction *action );
+ HbAction *retAction();
+ QEventLoop &eventLoop();
+
protected:
void createAndSetActions(const QString & primaryActionText,const QString & secondaryActionText);
void createContentWidget();
@@ -81,7 +87,7 @@
void setTitle( const QString &str );
void setRootPath( const QString &pathName );
-
+
public:
void _q_handleUpButton();
void _q_handleTextChanged(const QString &text);
@@ -111,6 +117,9 @@
QString mCaptionHead;
FmFileDialogArgs mArgs;
+
+ HbAction *mRetAction;
+ QEventLoop mEventLoop;
};
#endif // FMFILEDIALOG_P_H
--- a/filemanager/src/fmfiledialog/src/fmfilewidget.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfilewidget.cpp Fri Jun 25 17:08:34 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 ) ) {
+ FmLogger::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 ) ) ) {
+ FmLogger::log( "FmFileWidget::setRootPath set drive model" );
setModel( mDriveModel );
+ FmLogger::log( "FmFileWidget::setRootPath set drive model end" );
emit pathChanged( QString() );
} else {
- setModel( mDirModel );
- mListView->setRootIndex( mDirModel->index( pathName ) );
+ FmLogger::log( "FmFileWidget::setRootPath set dir model end" );
+ setModel( mFileSystemModel );
+ FmLogger::log( "FmFileWidget::setRootPath set dir model end" );
+ mListView->setRootIndex( mFileSystemModel->setRootPath( pathName ) );
+ FmLogger::log( "FmFileWidget::setRootPath set rootIndex" );
emit pathChanged( pathName );
}
+ FmLogger::log( "FmFileWidget::setRootPath end" );
}
-
-
void FmFileWidget::on_list_activated( const QModelIndex &index )
+ {
+ mActivatedModelIndex = index;
+ emit listActivated();
+ }
+
+void FmFileWidget::on_listActivated()
{
+ FmLogger::log("FmFileWidget::on_list_activated start" );
if( mCurrentModel == mDriveModel ) {
- QString driveName = mDriveModel->driveName( index );
+ //If currenty model is DriveModel, open drive and set path
+ QString driveName = mDriveModel->driveName( mActivatedModelIndex );
QString checkedPath = FmUtils::checkDriveToFolderFilter( driveName );
if( checkedPath.isEmpty() ) {
+ FmLogger::log("FmFileWidget::on_list_activated end becaise checkedpath empty" );
return;
}
- setModel( mDirModel );
- mListView->setRootIndex( mDirModel->index( checkedPath ) );
+ FmLogger::log("FmFileWidget::on_list_activated setModel dir start" );
+ setModel( mFileSystemModel );
+ FmLogger::log("FmFileWidget::on_list_activated setModel dir end" );
+ setRootPath( checkedPath );
+ FmLogger::log("FmFileWidget::on_list_activated setRootIndex" );
emit pathChanged( checkedPath );
+ FmLogger::log("FmFileWidget::on_list_activated finish emit pathChanged" );
}
- else if( mCurrentModel == mDirModel ) {
- if ( mDirModel->isDir(index) ) {
- changeRootIndex( index );
+ else if( mCurrentModel == mFileSystemModel ) {
+ //If currenty model is FileSystemModel, open path or emit file activate signal.
+ if ( mFileSystemModel->isDir( mActivatedModelIndex ) ) {
+ FmLogger::log("FmFileWidget::on_list_activated start changeRootIndex" );
+ changeRootIndex( mActivatedModelIndex );
+ FmLogger::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() );
+ FmLogger::log("FmFileWidget::on_list_activated finish emit fileActivated" );
}
}
} else {
Q_ASSERT( false );
}
+ FmLogger::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 ) {
+ FmLogger::log("FmFileWidget::changeRootIndex start" );
+ if( mCurrentModel != mFileSystemModel ) {
+ FmLogger::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 );
+ FmLogger::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 currenty 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();
}
@@ -202,7 +239,7 @@
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:"
+ currentPath().absoluteFilePath() ) );
--- a/filemanager/src/fmfiledialog/src/fmfilewidget.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/fmfiledialog/src/fmfilewidget.h Fri Jun 25 17:08:34 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/commonutils.pri Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/commonutils.pri Fri Jun 25 17:08:34 2010 +0800
@@ -17,11 +17,13 @@
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
symbian {
INTERNAL_HEADERS += $$PWD/fms60utils.h \
@@ -34,6 +36,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 Fri Jun 25 17:08:34 2010 +0800
@@ -25,7 +25,7 @@
// MACRO for launch find view quickly from driver view and search "b" in "c:\ruby"
//#define _DEBUG_SPEED_FINDVIEW_
-//#define _DEBUG_ENABLE_FORMATMENU_
+// #define _DEBUG_ENABLE_FORMATMENU_
// MARCO for hide d, z, folder except C:\data in windows for debug
@@ -34,8 +34,10 @@
//#define _DEBUG_LOG_ENABLE_
//used to test drive hide which drive could be listed but not available
-//#define _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
+// #define _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
+//used to test locked drive
+// #define _DEBUG_LOCKED_DRIVE_Z
#include "fmlogger.h"
#include "fmdefine.h"
--- a/filemanager/src/inc/fmdefine.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdefine.h Fri Jun 25 17:08:34 2010 +0800
@@ -18,46 +18,57 @@
#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
#endif
--- a/filemanager/src/inc/fmdrivemodel.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdrivemodel.cpp Fri Jun 25 17:08:34 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 ) {
+ FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_true" ) );
+ FmUtils::getDriveList( mDriveList, true );
+ } else {
+ FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_false" ) );
+ FmUtils::getDriveList( mDriveList, false );
+ }
}
- emit layoutChanged();
+
+ emit layoutChanged();
+ for( int i=0; i<mDriveList.count(); i++ ) {
+ emit dataChanged(index( i, 0 ), index( i, 0 ));
+ }
}
@@ -97,10 +110,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();
}
}
--- a/filemanager/src/inc/fmdrivemodel.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmdrivemodel.h Fri Jun 25 17:08:34 2010 +0800
@@ -20,9 +20,31 @@
#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
@@ -35,7 +57,8 @@
};
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();
@@ -49,9 +72,13 @@
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/fmfileiconprovider.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmfileiconprovider.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -16,56 +16,171 @@
*/
#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 orignal 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 );
+ QIcon retIcon;
+
+ QString filePath( info.absoluteFilePath() );
+ FmFileTypeRecognizer::FileType fileType = mFileTypeRecognizer->getType( filePath );
+ switch( fileType )
+ {
+ case FmFileTypeRecognizer::FileTypeDrive:
+ {
+ FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( filePath ).driveState();
+ if( driveState & FmDriverInfo::EDriveAvailable ){
+ if( driveState & FmDriverInfo::EDriveRemovable ) {
+ if( driveState & FmDriverInfo::EDriveMassStorage ) {
+ // Mass Storage
+ retIcon = HbIcon( massMemoryIcon ).qicon();
+ break;
+ } else if( driveState & FmDriverInfo::EDriveUsbMemory ) {
+ // Usb Memory
+ retIcon = HbIcon( usbMemoryIcon ).qicon();
+ break;
+ } else{
+ //Memory Card
+ retIcon = HbIcon( mmcIcon ).qicon();
+ break;
+ }
+ } else{
+ //Phone Memory
+ retIcon = HbIcon( phoneMemoryIcon ).qicon();
+ break;
}
- } else{
- //Phone Memory
- return QIcon( phoneMemoryIcon );
+ } else if( driveState & FmDriverInfo::EDriveLocked ) {
+ retIcon = HbIcon( mmcLockedIcon ).qicon();
+ break;
+ } else if( driveState & FmDriverInfo::EDriveCorrupted ) {
+ retIcon = HbIcon( mmcNoneIcon ).qicon();
+ break;
+ } else if( driveState & FmDriverInfo::EDriveNotPresent ){
+ retIcon = HbIcon( mmcNoneIcon ).qicon();
+ break;
+ } else {
+ retIcon = HbIcon( mmcNoneIcon ).qicon();
+ 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;
+ }
+ case FmFileTypeRecognizer::FileTypeTone:
+ {
+ retIcon = HbIcon( toneIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypePlaylist:
+ {
+ retIcon = HbIcon( playlistIcon ).qicon();
+ break;
+ }
+ case FmFileTypeRecognizer::FileTypeText:
+ {
+ retIcon = HbIcon( textIcon ).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::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
+ // this will be mostly used in win32 platform,
+ // because path for HbIcon only existed in hb theme of symbian
+ 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 Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,140 @@
+/*
+ * 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()
+{
+ QStringList fileExtensionList;
+
+ fileExtensionList.append( QString( "bmp" ) );
+ fileExtensionList.append( QString( "gif" ) );
+ fileExtensionList.append( QString( "jpe" ) );
+ fileExtensionList.append( QString( "jpeg" ) );
+ fileExtensionList.append( QString( "jpg" ) );
+ fileExtensionList.append( QString( "ota" ) );
+ fileExtensionList.append( QString( "png" ) );
+ fileExtensionList.append( QString( "tif" ) );
+ fileExtensionList.append( QString( "tiff" ) );
+ fileExtensionList.append( QString( "wbmp" ) );
+ fileExtensionList.append( QString( "wmf" ) );
+ fileExtensionList.append( QString( "jp2" ) );
+ fileExtensionList.append( QString( "jpg2" ) );
+ fileExtensionList.append( QString( "jp3" ) );
+ fileExtensionList.append( QString( "ico" ) );
+ fileExtensionList.append( QString( "vcf" ) );
+ mFileTypeMap.insert( FileTypeImage, fileExtensionList );
+
+ fileExtensionList.clear();
+ fileExtensionList.append( QString( "3gp" ) );
+ fileExtensionList.append( QString( "mp4" ) );
+ fileExtensionList.append( QString( "nim" ) );
+ fileExtensionList.append( QString( "rm" ) );
+ fileExtensionList.append( QString( "rv" ) );
+ fileExtensionList.append( QString( "wmv" ) );
+ fileExtensionList.append( QString( "3g2" ) );
+ fileExtensionList.append( QString( "rmvb") );
+ fileExtensionList.append( QString( "mkv" ) );
+ mFileTypeMap.insert( FileTypeVideo, fileExtensionList );
+
+ fileExtensionList.clear();
+ fileExtensionList.append( QString( "aac" ) );
+ fileExtensionList.append( QString( "amr" ) );
+ fileExtensionList.append( QString( "au" ) );
+ fileExtensionList.append( QString( "awb" ) );
+ fileExtensionList.append( QString( "mid" ) );
+ fileExtensionList.append( QString( "mp3" ) );
+ fileExtensionList.append( QString( "ra" ) );
+ fileExtensionList.append( QString( "rmf" ) );
+ fileExtensionList.append( QString( "rng" ) );
+ fileExtensionList.append( QString( "snd" ) );
+ fileExtensionList.append( QString( "wav" ) );
+ fileExtensionList.append( QString( "wve" ) );
+ fileExtensionList.append( QString( "wma" ) );
+ fileExtensionList.append( QString( "m4a" ) );
+ fileExtensionList.append( QString( "ott" ) );
+ fileExtensionList.append( QString( "mxmf" ) );
+ mFileTypeMap.insert( FileTypeTone, fileExtensionList );
+
+ fileExtensionList.clear();
+ fileExtensionList.append( QString( "doc" ) );
+ fileExtensionList.append( QString( "pdf" ) );
+ fileExtensionList.append( QString( "pps" ) );
+ fileExtensionList.append( QString( "ppt" ) );
+ fileExtensionList.append( QString( "txt" ) );
+ fileExtensionList.append( QString( "xls" ) );
+ mFileTypeMap.insert( FileTypeText, fileExtensionList );
+
+ fileExtensionList.clear();
+ fileExtensionList.append( QString( "sis" ) );
+ fileExtensionList.append( QString( "sisx" ) );
+ mFileTypeMap.insert( FileTypeSisx, fileExtensionList );
+
+ fileExtensionList.clear();
+ fileExtensionList.append( QString( "jad" ) );
+ fileExtensionList.append( QString( "jar" ) );
+ mFileTypeMap.insert( FileTypeJava, fileExtensionList );
+
+ fileExtensionList.clear();
+ fileExtensionList.append( QString( "swf" ) );
+ mFileTypeMap.insert( FileTypeFlash, fileExtensionList );
+
+ // have not handle FileTypePlaylist
+ // have not handle FileTypeWidget
+ // have not handle FileTypeWebLink
+
+ // make mFileExtensionMap( data map for extenstion ) from mFileTypeMap
+ // this map is used to speed up recognize
+ QMapIterator<FileType, QStringList> i( mFileTypeMap );
+ while (i.hasNext()) {
+ i.next();
+ foreach( const QString extension, i.value() ) {
+ mFileExtensionMap.insert( extension, i.key() );
+ }
+ }
+
+
+}
+
+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 );
+}
+
+const QStringList FmFileTypeRecognizer::getFileListFromFileType( const FmFileTypeRecognizer::FileType fileType ) const
+{
+ return mFileTypeMap.value( fileType, QStringList() );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/inc/fmfiletyperecognizer.h Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,75 @@
+/*
+ * 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 FMFILERECOGNIZER_H
+#define FMFILERECOGNIZER_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 ;
+
+ /*!
+ Profide a list of extension name by designate the FileType.
+ */
+ const QStringList getFileListFromFileType( const FmFileTypeRecognizer::FileType fileType ) const;
+
+private:
+ // used to store FileType, extension name list pare.
+ QMap<FileType, QStringList> mFileTypeMap;
+
+ // used to store single extension name, FileType pare.
+ // this map comes from mFileTypeMap
+ QMap<QString, FileType> mFileExtensionMap;
+};
+
+#endif /* FMDRIVEDETAILSTYPE_H */
+
--- a/filemanager/src/inc/fmlogger.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmlogger.h Fri Jun 25 17:08:34 2010 +0800
@@ -24,7 +24,7 @@
#include <QString>
#include <QFile>
#include <QTextStream>
-
+#include <QDateTime>
class FmLogger
{
public:
@@ -32,14 +32,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
--- a/filemanager/src/inc/fmutils.h Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmutils.h Fri Jun 25 17:08:34 2010 +0800
@@ -28,23 +28,24 @@
public:
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,
};
Q_DECLARE_FLAGS( DriveState, driveState )
@@ -87,14 +88,13 @@
static QString getDriveLetterFromPath( const QString &path );
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 int 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 );
@@ -103,10 +103,10 @@
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 bool checkDriveAccessFilter( const QString &driveName );
static QString checkDriveToFolderFilter( const QString &path );
static QString checkFolderToDriveFilter( const QString &path );
- static bool isPathAccessabel( const QString &path );
+ static int isPathAccessabel( const QString &path );
static bool isDriveAvailable( const QString &path );
static bool isPathEqual( const QString &pathFst, const QString &pathLast );
@@ -119,6 +119,19 @@
static QString getBurConfigPath( QString appPath );
static bool isDefaultFolder( const QString &folderPath );
static QString Localize( const QString &path );
+
+ static int getMaxFileNameLength();
+ static bool checkMaxPathLength( const QString& path );
+ static bool checkFolderFileName( const QString& name );
+
+ /**
+ * check file or folder path is illegal or not.
+ *
+ * @param path file/folder path.
+ * @param errString if return false, errString will be set for error note.
+ * @return true for not illegal and false for illegal path.
+ */
+ static bool checkNewFolderOrFile( const QString &path, QString &errString );
};
--- a/filemanager/src/inc/fmutils_s60.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmutils_s60.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -37,19 +37,23 @@
#include <QDir>
#include <QFile>
+#include <hbglobal.h>
+
#include <xqaiwrequest.h>
#include <xqappmgr.h>
-#include <shareuidialog.h>
+#include <shareui.h>
#define BURCONFIGFILE "z:/private/2002BCC0/burconfig.xml"
QString FmUtils::getDriveNameFromPath( const QString &path )
{
- if( path.length() <3 ) {
+ // 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 path.left( 3 );
+ return checkedPath.left( 3 );
}
QString FmUtils::getDriveLetterFromPath( const QString &path )
@@ -62,6 +66,9 @@
FmDriverInfo FmUtils::queryDriverInfo( const QString &driverName )
{
+ if( driverName.isEmpty() ) {
+ return FmDriverInfo( 0, 0, driverName, QString(), FmDriverInfo::EDriveNotPresent );
+ }
CCoeEnv *env = CCoeEnv::Static();
RFs& fs = env->FsSession();
@@ -70,17 +77,29 @@
drive = driverName[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( volumeName == 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 ) ){
@@ -89,7 +108,11 @@
state |= FmDriverInfo::EDriveMassStorage | FmDriverInfo::EDriveRemovable;
}
-
+ if ( drvStatus & DriveInfo::EDriveUsbMemory )
+ {
+ state |= FmDriverInfo::EDriveUsbMemory;
+ }
+
if ( drvStatus & DriveInfo::EDriveRom ){
state |= FmDriverInfo::EDriveRom;
}
@@ -123,12 +146,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,10 +183,19 @@
case KErrCorrupt:
state |= FmDriverInfo::EDriveCorrupted;
break;
+ case KErrInUse:
+ state |= FmDriverInfo::EDriveInUse;
+ break;
default: // other errors
state |= FmDriverInfo::EDriveNotPresent;
break;
}
+ QString logString ( "FmUtils::queryDriverInfo_" + driverName +
+ "_volumeInfoErr:" + QString::number( volumeInfoErr ) +
+ "_driveInfoErr:" + QString::number( driveInfoErr ) +
+ "_errorCode:" + QString::number( errorCode ) +
+ "_driveSatus:" + QString::number( state ) );
+ FmLogger::log( logString );
return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driverName, volumeName, state );
}
@@ -155,84 +211,12 @@
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 ( 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 )
{
+ if( driverName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
QString logString = "Drive name:" + driverName;
FmLogger::log( logString );
logString = "Password:" + Pwd;
@@ -271,6 +255,9 @@
int FmUtils::unlockDrive( const QString &driverName, const QString &Pwd )
{
+ if( driverName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
QString logString = "Drive name:" + driverName;
FmLogger::log( logString );
logString = "Password:" + Pwd;
@@ -313,6 +300,9 @@
int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd )
{
+ if( driverName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
QString logString = "checkDrivePwd Drive name:" + driverName;
logString += " password:" + pwd;
FmLogger::log( logString );
@@ -322,6 +312,9 @@
int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd)
{
+ if( driverName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
QString logString = "setDrivePwd Drive name:" + driverName ;
logString += " Old password:" + oldPwd;
logString += " New password:" + newPwd;
@@ -373,7 +366,10 @@
int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName)
{
- foreach( QChar ch, newVolumeName )
+ if( driverName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
+ foreach( const QChar &ch, newVolumeName )
{
bool a = ch.isSpace();
bool b = ch.isLetterOrNumber();
@@ -408,8 +404,11 @@
}
}
-void FmUtils::ejectDrive( const QString &driverName )
+int FmUtils::ejectDrive( const QString &driverName )
{
+ if( driverName.isEmpty() ) {
+ return FmErrWrongParam;
+ }
QString logString = "FmUtils::ejectDrive start";
FmLogger::log( logString );
@@ -424,6 +423,7 @@
KCoreAppUIsMmcRemovedWithoutEject,
ECoreAppUIsEjectCommandUsedToDrive | ( drive << KDriveShift )
);
+ return FmErrNone;
}
QString FmUtils::getFileType( const QString &filePath )
@@ -506,6 +506,9 @@
bool FmUtils::isDriveC( const QString &driverName )
{
+ if( driverName.isEmpty() ) {
+ return false;
+ }
TInt drive = 0;
drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
if( drive == EDriveC ){
@@ -529,6 +532,9 @@
void FmUtils::createDefaultFolders( const QString &driverName )
{
+ if( driverName.isEmpty() ) {
+ return;
+ }
int err;
TInt drive = 0;
@@ -597,14 +603,23 @@
QString FmUtils::fillPathWithSplash( const QString &filePath )
{
- QString newFilePath( filePath );
+ QString newFilePath;
if( filePath.isEmpty() ) {
return newFilePath;
}
- if( filePath.at( filePath.length()-1 ) != QChar( '/' ) ){
- newFilePath.append( QChar( '/' ) );
+ foreach( QChar ch, filePath ) {
+ if( ch == QChar('\\') || ch == QChar('/') ) {
+ newFilePath.append( QDir::separator() );
+ } else {
+ newFilePath.append( ch );
+ }
}
+
+ if( newFilePath.right( 1 )!= QDir::separator() ){
+ newFilePath.append( QDir::separator() );
+ }
+
return newFilePath;
}
@@ -617,10 +632,15 @@
return newFilePath;
}
-// used to filter drive which need be hide.
-bool FmUtils::checkDriveFilter( const QString &driveName )
+// filter un-accessable drive
+bool FmUtils::checkDriveAccessFilter( const QString &driveName )
{
- if( driveName.contains( "D:" ) || driveName.contains( "Z:" ) ) {
+ if( driveName.isEmpty() ) {
+ return false;
+ }
+ FmDriverInfo driveInfo = queryDriverInfo( driveName );
+ if( ( driveInfo.driveState()& FmDriverInfo::EDriveRam ) ||
+ ( driveInfo.driveState()& FmDriverInfo::EDriveRom ) ) {
return false;
}
return true;
@@ -635,8 +655,8 @@
}
*/
QString checkedPath = fillPathWithSplash( path );
- if( checkedPath.compare( QString( "C:/"), Qt::CaseInsensitive ) == 0 ) {
- checkedPath += QString( "data/" );
+ if( checkedPath.compare( Drive_C, Qt::CaseInsensitive ) == 0 ) {
+ checkedPath += QString( "data" ) + QDir::separator();
return checkedPath;
}
return path;
@@ -653,47 +673,50 @@
logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath;
FmLogger::log( logString );
- if( checkedPath.compare( QString( "C:/data/"), Qt::CaseInsensitive ) == 0 ) {
+ if( checkedPath.compare( Folder_C_Data, Qt::CaseInsensitive ) == 0 ) {
FmLogger::log( QString( " change from c:/data/ to C:/" ) );
- return QString( "C:/" );
+ return Drive_C;
}
return path;
}
-bool FmUtils::isPathAccessabel( const QString &path )
+int FmUtils::isPathAccessabel( const QString &path )
{
+ // Used to check if path is accessable, very important feature
+ // and will return filemanager error.
FmLogger::log( QString( "isPathAccessabel:" ) + path );
+ if( path.isEmpty() ) {
+ return FmErrPathNotExist;
+ }
if( path.length() <= 3 && !isDriveAvailable( path ) ) { //used to filter locked drive
FmLogger::log( QString( "isPathAccessabel false: path is drive and not available" ) );
- return false;
+ return FmErrDriveNotAvailable;
}
QFileInfo fileInfo( path );
- if( fileInfo.absoluteFilePath().contains( QString( Drive_C ), Qt::CaseInsensitive ) &&
- !fileInfo.absoluteFilePath().contains( QString( Folder_C_Data ), Qt::CaseInsensitive ) ) {
+ if( fileInfo.absoluteFilePath().contains( Drive_C, Qt::CaseInsensitive ) &&
+ !fileInfo.absoluteFilePath().contains( Folder_C_Data, Qt::CaseInsensitive ) ) {
FmLogger::log( QString( "isPathAccessabel false: path contain C and not in data folder" ) );
- return false;
+ return FmErrPathDenied;
}
- if( fileInfo.absoluteFilePath().contains( QString( Drive_D ), Qt::CaseInsensitive ) ) {
- FmLogger::log( QString( "isPathAccessabel false: path contain D" ) );
- return false;
- }
- if( fileInfo.absoluteFilePath().contains( QString( Drive_Z ), Qt::CaseInsensitive ) ) {
- FmLogger::log( QString( "isPathAccessabel false: path contain Z" ) );
- return false;
+ if( !checkDriveAccessFilter( FmUtils::getDriveNameFromPath( fileInfo.absoluteFilePath() ) ) ){
+ return FmErrDriveDenied;
}
if( !fileInfo.exists() ) {
FmLogger::log( QString( "isPathAccessabel false: path not exist" ) );
- return false;
+ return FmErrPathNotExist;
}
- FmLogger::log( QString( "isPathAccessabel true" ) );
- return true;
+ FmLogger::log( QString( "isPathAccessabel FmErrNone" ) );
+ return FmErrNone;
}
// only used to check drive, when MMC is not inserted, also return false
bool FmUtils::isDriveAvailable( const QString &path )
{
FmLogger::log( QString( "isDriveAvailable:" ) + path );
+ if( path.isEmpty() ) {
+ return false;
+ }
FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState();
if( ( driveState & FmDriverInfo::EDriveAvailable ) ) {
FmLogger::log( QString( "isDriveAvailable true" ) );
@@ -714,7 +737,7 @@
foreach( QFileInfo fileInfo, infoList ) {
QString driveName = fileInfo.absolutePath();
- if( checkDriveFilter( driveName ) ) {
+ if( checkDriveAccessFilter( driveName ) ) {
if( !isHideUnAvailableDrive ) {
driveList.append( driveName );
}
@@ -729,9 +752,12 @@
QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume )
{
QString ret;
+ if( driveName.isEmpty() ) {
+ return ret;
+ }
QString tempDriveName = fillPathWithSplash( driveName );
- ret = removePathSplash( driveName );
+ QString checkedDriveName( removePathSplash( driveName ) );
FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName );
QString volumeName = driverInfo.volumeName();
@@ -741,25 +767,37 @@
if( driveState & FmDriverInfo::EDriveAvailable ){
if( driveState & FmDriverInfo::EDriveRemovable ) {
if( driveState & FmDriverInfo::EDriveMassStorage ) {
- volumeName.append( QObject::tr( "Mass Storage" ) );
+ // Mass Storage
+ ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName );
+ } else if( driveState & FmDriverInfo::EDriveUsbMemory ) {
+ // USB Memory
+ ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName );
+ } else{
+ // Memory Card
+ ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName );
}
- else{
- volumeName.append( QObject::tr( "Memory Card" ) );
- }
+ } else{
+ // phone memory
+ ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName );
}
- else{
- volumeName.append( QObject::tr( "Phone Memory" ) );
- }
- }
+ }
}
-
- ret += QString( " " ) + volumeName;
+
+ if( ret.isEmpty() ) {
+ // set ret as volumeName
+ // txt_fmgr_dblist_1_2 is not correct, can not use.
+ ret = hbTrId( "%1 %2" ).arg( checkedDriveName ).arg( volumeName );
+ }
return ret;
}
-int FmUtils::launchFile( const QString &filePath )
+int FmUtils::launchFile( const QString &filePath )
{
QFile file( filePath );
+ if( !file.exists() ) {
+ return false;
+ }
+
XQApplicationManager mAiwMgr;
XQAiwRequest *request = mAiwMgr.create(file);
if ( request == 0 ) {
@@ -852,12 +890,68 @@
QString FmUtils::formatPath( const QString &path )
{
- QString formatPath = path;
- QRegExp regExp( "/" );
- formatPath.replace( regExp, "\\" );
-
- if( path.right( 1 )!= "\\"){
- formatPath.append( "\\" );
+ QString formatPath;
+ foreach( QChar ch, path ) {
+ if( ch == QChar('\\') || ch == QChar('/') ) {
+ formatPath.append( QDir::separator() );
+ } else {
+ formatPath.append( ch );
+ }
+ }
+
+ if( formatPath.right( 1 ) != QDir::separator() ){
+ formatPath.append( QDir::separator() );
}
return formatPath;
}
+
+int FmUtils::getMaxFileNameLength()
+{
+ return KMaxFileName;
+}
+
+bool FmUtils::checkMaxPathLength( const QString& path )
+{
+ if( path.length() > KMaxPath ) {
+ return false;
+ }
+ return true;
+}
+bool FmUtils::checkFolderFileName( const QString& name )
+{
+ if( name.endsWith( QChar('.'), Qt::CaseInsensitive ) ) {
+ return false;
+ }
+ if( name.contains( QChar('\\'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('/'), Qt::CaseInsensitive ) ||
+ name.contains( QChar(':'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('*'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('?'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('\"'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('<'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('>'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('|'), Qt::CaseInsensitive ) ){
+ return false;
+ }
+ if( name.length() > KMaxFileName ) {
+ return false;
+ }
+ return true;
+}
+
+bool FmUtils::checkNewFolderOrFile( const QString &path, QString &errString )
+{
+ QFileInfo fileInfo( path );
+ bool ret( true );
+ if (!FmUtils::checkFolderFileName( fileInfo.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;
+}
--- a/filemanager/src/inc/fmutils_win.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/inc/fmutils_win.cpp Fri Jun 25 17:08:34 2010 +0800
@@ -25,7 +25,11 @@
#include <QUrl>
#include <QVariant>
+#include <hbglobal.h>
+
#define BURCONFIGFILE "burconfig.xml"
+const int KMaxFileName=0x100;
+const int KMaxPath=0x100;
QString FmUtils::getDriveNameFromPath( const QString &path )
{
@@ -73,6 +77,21 @@
if ( drvStatus == DRIVE_REMOVABLE ) {
state |= FmDriverInfo::EDriveRemovable;
}
+#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
+ if ( driverName.contains( Drive_D, Qt::CaseInsensitive ) ) {
+ state |= FmDriverInfo::EDriveNotPresent;
+ }
+#endif
+
+#ifdef _DEBUG_LOCKED_DRIVE_Z
+ if ( driverName.contains( Drive_Z, Qt::CaseInsensitive ) ) {
+ state |= FmDriverInfo::EDriveLocked;
+ }
+#endif
+ if( !(state&FmDriverInfo::EDriveNotPresent) && !(state&FmDriverInfo::EDriveLocked) &&
+ !(state&FmDriverInfo::EDriveCorrupted) ) {
+ state |= FmDriverInfo::EDriveAvailable;
+ }
return FmDriverInfo( size, freeSize, driverName, QString::fromWCharArray( &volumeName[0] ), state );
}
@@ -88,6 +107,7 @@
return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB";
}
}
+
/*
quint32 FmUtils::getDriverState( const QString &driverName )
{
@@ -147,7 +167,7 @@
int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName)
{
Q_UNUSED( driverName );
- foreach( QChar ch, newVolumeName )
+ foreach( const QChar &ch, newVolumeName )
{
// If not alphadigit or space, return error
if( !ch.isLetterOrNumber() && !ch.isSpace() )
@@ -158,9 +178,10 @@
return 0;
}
-void FmUtils::ejectDrive( const QString &driverName )
+int FmUtils::ejectDrive( const QString &driverName )
{
Q_UNUSED( driverName );
+ return FmErrNone;
}
QString FmUtils::getFileType( const QString &filePath )
@@ -178,8 +199,12 @@
bool FmUtils::isDriveC( const QString &driverName )
{
- Q_UNUSED( driverName );
- return false;
+ if( driverName.contains(Drive_C,Qt::CaseInsensitive) ){
+ return true;
+ }
+ else{
+ return false;
+ }
}
bool FmUtils::isDrive( const QString &path )
@@ -199,14 +224,23 @@
QString FmUtils::fillPathWithSplash( const QString &filePath )
{
- QString newFilePath( filePath );
+ QString newFilePath;
if( filePath.isEmpty() ) {
return newFilePath;
}
- if( filePath.at( filePath.length()-1 ) != QChar( '/' ) ){
- newFilePath.append( QChar( '/' ) );
+ foreach( QChar ch, filePath ) {
+ if( ch == QChar('\\') || ch == QChar('/') ) {
+ newFilePath.append( QDir::separator() );
+ } else {
+ newFilePath.append( ch );
+ }
}
+
+ if( newFilePath.right( 1 )!= QDir::separator() ){
+ newFilePath.append( QDir::separator() );
+ }
+
return newFilePath;
}
@@ -219,10 +253,10 @@
return newFilePath;
}
-bool FmUtils::checkDriveFilter( const QString &driveName )
+bool FmUtils::checkDriveAccessFilter( const QString &driveName )
{
#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
- if( driveName.contains( "D:" ) || driveName.contains( "Z:" ) ) {
+ if( driveName.contains( Drive_D, Qt::CaseInsensitive ) || driveName.contains( Drive_Z, Qt::CaseInsensitive ) ) {
return false;
}
#endif
@@ -271,12 +305,12 @@
}
-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
+ if(!isDriveAvailable( path ) ) { //used to filter locked drive
+ return FmErrDriveNotAvailable;
+ }
+
QFileInfo fileInfo( path );
#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
@@ -292,18 +326,22 @@
}
#endif
if( !fileInfo.exists() ) {
- return false;
+ return FmErrPathNotExist;
}
- return true;
+ return FmErrNone;
}
bool FmUtils::isDriveAvailable( const QString &path )
{
- QFileInfo fileInfo( path );
- if( !fileInfo.exists() ) {
- return false;
- }
- return true;
+#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
+ if(path.contains(Drive_D, Qt::CaseInsensitive))
+ return false;
+#endif
+#ifdef _DEBUG_LOCKED_DRIVE_Z
+ if(path.contains(Drive_Z, Qt::CaseInsensitive))
+ return false;
+#endif
+ return true;
}
void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive )
@@ -312,7 +350,7 @@
foreach( QFileInfo fileInfo, infoList ) {
QString driveName = fileInfo.absolutePath();
- if( checkDriveFilter( driveName ) ) {
+ if( checkDriveAccessFilter( driveName ) ) {
if( !isHideUnAvailableDrive ) {
driveList.append( driveName );
}
@@ -329,29 +367,33 @@
QString ret;
QString tempDriveName = fillPathWithSplash( driveName );
- ret = removePathSplash( driveName );
+ QString checkedDriveName( 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 ) ){
+ FmDriverInfo::DriveState driveState = queryDriverInfo( tempDriveName ).driveState();
+ if( driveState & FmDriverInfo::EDriveAvailable ){
if( driveState & FmDriverInfo::EDriveRemovable ) {
if( driveState & FmDriverInfo::EDriveMassStorage ) {
- volumeName.append( QObject::tr( "Mass Storage" ) );
+ // Mass Storage
+ ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName );
+ } else if( driveState & FmDriverInfo::EDriveUsbMemory ) {
+ // USB Memory
+ ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName );
+ } else{
+ // Memory Card
+ ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName );
}
- else{
- volumeName.append( QObject::tr( "Memory Card" ) );
- }
- }
- else{
- volumeName.append( QObject::tr( "Phone Memory" ) );
+ } else{
+ // phone memory
+ ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName );
}
}
+ } else {
+ ret = hbTrId( "txt_fmgr_dblist_1_2" ).arg( checkedDriveName ).arg( volumeName );
}
-
- ret += QString( " " ) + volumeName;
return ret;
}
@@ -397,6 +439,68 @@
QString FmUtils::formatPath( const QString &path )
{
- Q_UNUSED( path );
- return false;
+ QString formatPath;
+ foreach( QChar ch, path ) {
+ if( ch == QChar('\\') || ch == QChar('/') ) {
+ formatPath.append( QDir::separator() );
+ } else {
+ formatPath.append( ch );
+ }
+ }
+
+ if( formatPath.right( 1 ) != QDir::separator() ){
+ formatPath.append( QDir::separator() );
+ }
+ return formatPath;
+}
+
+int FmUtils::getMaxFileNameLength()
+{
+ return KMaxFileName;
+}
+
+bool FmUtils::checkMaxPathLength( const QString& path )
+{
+ if( path.length() > KMaxPath ) {
+ return false;
+ }
+ return true;
}
+bool FmUtils::checkFolderFileName( const QString& name )
+{
+ if( name.endsWith( QChar('.'), Qt::CaseInsensitive ) ) {
+ return false;
+ }
+ if( name.contains( QChar('\\'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('/'), Qt::CaseInsensitive ) ||
+ name.contains( QChar(':'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('*'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('?'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('\"'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('<'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('>'), Qt::CaseInsensitive ) ||
+ name.contains( QChar('|'), Qt::CaseInsensitive ) ){
+ return false;
+ }
+ if( name.length() > KMaxFileName ) {
+ return false;
+ }
+ return true;
+}
+
+bool FmUtils::checkNewFolderOrFile( const QString &path, QString &errString )
+{
+ QFileInfo fileInfo( path );
+ bool ret( true );
+ if (!FmUtils::checkFolderFileName( fileInfo.fileName() ) ) {
+ errString = hbTrId( "Invalid file or folder name, try again!" );
+ ret = false;
+ } else if( !FmUtils::checkMaxPathLength( path ) ) {
+ errString = hbTrId( "the path you specified is too long, try again!" );
+ ret = false;
+ } else if (fileInfo.exists()) {
+ errString = hbTrId( "%1 already exist!" ).arg( fileInfo.fileName() );
+ ret = false;
+ }
+ return ret;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/tsrc/tsrc.pro Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,26 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+SUBDIRS = unit/unit_backuprestoresettings
+
+CONFIG += ordered
+#CONFIG += symbian_test
+test.depends = first
+test.CONFIG += recursive
+autotest.depends = first
+autotest.CONFIG += recursive
+QMAKE_EXTRA_TARGETS += test autotest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/tsrc/unit/unit_backuprestoresettings/runtest.bat Fri Jun 25 17:08:34 2010 +0800
@@ -0,0 +1,19 @@
+@rem
+@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem All rights reserved.
+@rem This component and the accompanying materials are made available
+@rem under the terms of "Eclipse Public License v1.0"
+@rem which accompanies this distribution, and is available
+@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+@rem
+@rem Initial Contributors:
+@rem Nokia Corporation - initial contribution.
+@rem
+@rem Contributors:
+@rem
+@rem Description:
+@rem
+
+\epoc32\RELEASE\WINSCW\udeb\unit_backuprestoresettings.exe -xml -o c:\unit_backuprestoresettings.xml
+copy \epoc32\winscw\c\unit_backuprestoresettings.xml
+del \epoc32\winscw\c\unit_backuprestoresettings.xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/tsrc/unit/unit_backuprestoresettings/src/unit_backuprestoresettings.cpp Fri Jun 25 17:08:34 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 Fri Jun 25 17:08:34 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
--- a/layers.sysdef.xml Mon May 03 12:24:39 2010 +0300
+++ b/layers.sysdef.xml Fri Jun 25 17:08:34 2010 +0800
@@ -6,8 +6,9 @@
<SystemDefinition name="files" schema="1.5.1">
<systemModel>
<layer name="bldfirst_app_layer">
- <module name="fmbkupengine">
+ <module name="filemanager_components">
<unit name="fmbkupengine" unitID="presdo.fmbkupengine" bldFile="&layer_real_source_path;/filemanager/src/fmbkupengine/group" mrp="" />
+ <unit name="fmfiledialog" unitID="presdo.fmfiledialog" mrp="" bldFile="&layer_real_source_path;/filemanager/src/fmfiledialog" proFile="fmfiledialog.pro" qmakeArgs="-r -config rom"/>
</module>
</layer>
<layer name="app_layer">
@@ -15,5 +16,10 @@
<unit unitID="filemanager" mrp="" bldFile="&layer_real_source_path;/filemanager" name="filemanager" proFile="filemanager.pro" qmakeArgs="-r -config rom"/>
</module>
</layer>
+ <layer name="qt_unit_test_layer">
+ <module name="filemanager_tests">
+ <unit unitID="presdoe.filemanager_tests" mrp="" bldFile="&layer_real_source_path;/filemanager/tsrc" proFile="tsrc.pro" name="filemanager_tests" qmakeArgs="-r"/>
+ </module>
+ </layer>
</systemModel>
</SystemDefinition>
\ No newline at end of file