--- a/filemanager/src/filemanager/filemanager.pri Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/filemanager.pri Wed Jun 23 18:03:11 2010 +0300
@@ -59,7 +59,8 @@
src/components/fmviewdetailsitem.h \
src/components/fmdrivedetailstype.h \
src/components/fmmessagebox.h \
- src/components/fmdialog.h
+ src/components/fmdialog.h \
+ src/components/fmdrivequery.h
SOURCES += src/main.cpp \
src/fmdriverlistwidget.cpp \
@@ -101,7 +102,8 @@
src/components/fmviewdetailsitem.cpp \
src/components/fmdrivedetailstype.cpp \
src/components/fmmessagebox.cpp \
- src/components/fmdialog.cpp
+ src/components/fmdialog.cpp \
+ src/components/fmdrivequery.cpp
win32 {
SOURCES += src/operationservice/fmoperationformat_win.cpp
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -138,7 +138,16 @@
toolBar()->removeAction( mToolBarAction );
}
-void FmBackupView::refreshBackupView()
+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 Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.h Wed Jun 23 18:03:11 2010 +0300
@@ -46,7 +46,9 @@
void removeToolBarAction();
public slots:
- void refreshBackupView();
+ void refreshBackupDate();
+ void refreshModel( const QString& path );
+
private slots:
void on_leftAction_triggered();
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -354,36 +354,10 @@
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;
- 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 );
-
- if( drive == targetDrive )
- {
- // adjust index offset against drive.
- selectIndex = currentIndex;
- }
- ++currentIndex;
- }
-
- if( FmDlgUtils::showSingleSettingQuery( title, queryStringList, selectIndex ) )
- {
- mBackupSettings->setTargetDrive( driveStringList.at( selectIndex ) );
+ QString drive = FmDlgUtils::showBackupDriveQuery( title );
+ if( !drive.isEmpty() &&
+ mBackupSettings->targetDrive().compare( drive, Qt::CaseInsensitive ) != 0 ) {
+ mBackupSettings->setTargetDrive( drive );
emit doModelRefresh();
}
}
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h Wed Jun 23 18:03:11 2010 +0300
@@ -45,12 +45,14 @@
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();
--- a/filemanager/src/filemanager/src/components/fmdlgutils.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdlgutils.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -24,6 +24,7 @@
#include "fmutils.h"
#include "fmviewmanager.h"
#include "fmmessagebox.h"
+#include "fmdrivequery.h"
#include <QString>
#include <QStringList>
@@ -395,3 +396,22 @@
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( "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 Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdlgutils.h Wed Jun 23 18:03:11 2010 +0300
@@ -90,6 +90,14 @@
const QString &secondaryButtonText = tr("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:
--- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -82,11 +82,12 @@
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( "*.rmvb") );
+ typeFilters.append( QString( "*.mkv" ) );
dataGroupList.append( new FmDriveDetailsDataGroup( FmDriveDetailsDataGroup::EGroupVideos, typeFilters ));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/components/fmdrivequery.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -0,0 +1,92 @@
+/*
+ * 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)
+{
+
+}
+
+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 Wed Jun 23 18:03:11 2010 +0300
@@ -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
--- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -424,6 +424,9 @@
FmUtils::getDriveList( driveList, true );
if(driveList.count() > 0 ) {
mFindTargetPath = driveList.first();
+ if( FmUtils::isDriveC( mFindTargetPath ) ) {
+ mFindTargetPath = QString( Folder_C_Data );
+ }
} else {
mFindTargetPath.clear();
}
--- a/filemanager/src/filemanager/src/fmdriverview.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmdriverview.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -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 Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -688,10 +688,12 @@
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,
maxFileNameLength, QString() , true ) ){
+ // remove whitespace from the start and the end.
+ newName = newName.trimmed();
QString newTargetPath = FmUtils::fillPathWithSplash(
fileInfo.absolutePath() ) + newName;
QFileInfo newFileInfo( newTargetPath );
@@ -711,6 +713,12 @@
if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) {
FmDlgUtils::information( hbTrId("Rename failed!") );
}
+ else {
+ QString newSuffix( newFileInfo.suffix() );
+ if ( oldSuffix != newSuffix ) {
+ FmDlgUtils::information( hbTrId( "File may become unusable when file name extension is changed" ) );
+ }
+ }
break;
- }
+ }
}
--- a/filemanager/src/filemanager/src/fmfileview.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfileview.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -394,13 +394,15 @@
{
int maxFileNameLength = FmUtils::getMaxFileNameLength();
QString associatedDrive = FmUtils::getDriveLetterFromPath( mWidget->currentPath().absoluteFilePath() );
+ QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() );
+ QString dirName = createDefaultFolderName( path );
- QString dirName( hbTrId( "New folder" ) );
- QString path = FmUtils::fillPathWithSplash( mWidget->currentPath().absoluteFilePath() );
- QDir dir( path );
+ QDir dir( path );
if( dir.exists() ) {
while( FmDlgUtils::showTextQuery( hbTrId( "Enter name for " ), dirName,
true, maxFileNameLength, associatedDrive , false ) ){
+ // remove whitespace from the start and the end.
+ dirName = dirName.trimmed();
QString newTargetPath = FmUtils::fillPathWithSplash(
dir.absolutePath() ) + dirName;
QFileInfo newFileInfo( newTargetPath );
@@ -510,3 +512,25 @@
{
this->setTitle( title );
}
+
+QString FmFileView::createDefaultFolderName( const QString &path )
+{
+ QString dirBaseName( hbTrId( "New folder" ) );
+ QString dirName( dirBaseName );
+ QString dirAbsolutePath( path + dirName );
+ QFileInfo fileInfo( dirAbsolutePath );
+ int i = 0;
+ while ( fileInfo.exists() ) {
+ ++i;
+ dirName = dirBaseName;
+ dirName.append( hbTrId("(") );
+ if ( i < 10 ) {
+ dirName.append( hbTrId("0") );
+ }
+ dirName.append( QString::number(i) );
+ dirName.append( hbTrId(")") );
+ dirAbsolutePath = path + dirName;
+ fileInfo.setFile( dirAbsolutePath );
+ }
+ return dirName;
+}
--- a/filemanager/src/filemanager/src/fmfileview.h Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfileview.h Wed Jun 23 18:03:11 2010 +0300
@@ -82,6 +82,14 @@
void infoNoFileSelected();
void removeToolBarAction();
+ /**
+ * Create Default folder name while create folder.
+ *
+ * @param 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 Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -171,7 +171,6 @@
mFindThread->setLastResult( mFindResult );
}
removeRows( 0, mFindResult.size() );
- emit modelCountChanged( mFindResult.size() );
mFindThread->start();
}
@@ -188,8 +187,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() );
}
@@ -250,21 +251,30 @@
// emit layoutAboutToBeChanged();
+ QStringList lst;
+ for (int i = 0; i < mFindResult.size(); ++i)
+ lst.append( mFindResult.at(i) );
+
+ 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();
+ }
+
+ for (int i = 0; i < lst.count(); ++i)
+ mFindResult.append( lst.at(i) );
+ insertRows( 0, mFindResult.size() );
+ emit modelCountChanged( mFindResult.size() );
}
--- a/filemanager/src/filemanager/src/fmfindresultmodel.h Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.h Wed Jun 23 18:03:11 2010 +0300
@@ -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 );
--- a/filemanager/src/filemanager/src/fmfindthread.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindthread.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -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/fmfindwidget.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindwidget.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -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 Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmfindwidget.h Wed Jun 23 18:03:11 2010 +0300
@@ -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/fmviewmanager.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -155,7 +155,8 @@
{
if( operationBase->operationType() == FmOperationService::EOperationTypeBackup )
{
- emit refreshBackupView();
+ // after finish backup, we need refresh backup date in backup view.
+ emit refreshBackupDate();
}
}
@@ -238,8 +239,10 @@
mMainWindow->addView( backupView );
mMainWindow->setCurrentView( backupView );
- connect( this, SIGNAL( refreshBackupView() ), backupView, SLOT( refreshBackupView() ) );
-
+ 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()
--- a/filemanager/src/filemanager/src/fmviewmanager.h Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.h Wed Jun 23 18:03:11 2010 +0300
@@ -99,7 +99,7 @@
void on_operationService_notifyFinish( FmOperationBase *operationBase );
signals:
void refreshModel( const QString &path );
- void refreshBackupView();
+ void refreshBackupDate();
void refreshDeleteBackupView();
void refreshRestoreView();
--- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -49,6 +49,8 @@
bool ret = FmDlgUtils::showTextQuery( questionText, value, true, maxFileNameLength, QString(), false );
while ( ret ) {
bool checkResult = true;
+ // remove whitespace from the start and the end.
+ value = value.trimmed();
QString newTargetPath = FmUtils::fillPathWithSplash(
fileInfo.absolutePath() ) + value;
QFileInfo newFileInfo( newTargetPath );
--- a/filemanager/src/inc/fmcommon.h Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/inc/fmcommon.h Wed Jun 23 18:03:11 2010 +0300
@@ -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,10 +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
+// #define _DEBUG_LOCKED_DRIVE_Z
#include "fmlogger.h"
#include "fmdefine.h"
--- a/filemanager/src/inc/fmdefine.h Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/inc/fmdefine.h Wed Jun 23 18:03:11 2010 +0300
@@ -56,10 +56,10 @@
#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 FmMaxLengthofDriveName 11
#define FmMaxLengthofDrivePassword 8
--- a/filemanager/src/inc/fmdrivemodel.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/inc/fmdrivemodel.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -22,8 +22,9 @@
#include <QDir>
#include <QFileInfo>
-FmDriveModel::FmDriveModel( QObject *parent, Options options ) :
- QAbstractListModel( parent ), mOptions( options )
+FmDriveModel::FmDriveModel( QObject *parent, Options options,
+ FmDriveListProvider *driveListProvider ) :
+ QAbstractListModel( parent ), mOptions( options ), mDriveListProvider( driveListProvider )
{
mIconProvider = new FmFileIconProvider();
refresh();
@@ -36,17 +37,23 @@
void FmDriveModel::refresh()
{
- QFileInfoList infoList = QDir::drives();
-
- emit layoutAboutToBeChanged();
+ 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();
for( int i=0; i<mDriveList.count(); i++ ) {
emit dataChanged(index( i, 0 ), index( i, 0 ));
--- a/filemanager/src/inc/fmdrivemodel.h Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/inc/fmdrivemodel.h Wed Jun 23 18:03:11 2010 +0300
@@ -23,6 +23,27 @@
#include <QFileIconProvider>
#include <QModelIndex>
+/*!
+ \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 +56,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();
@@ -52,6 +74,10 @@
QFileIconProvider *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/fmutils_s60.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/inc/fmutils_s60.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -571,24 +571,21 @@
QString FmUtils::fillPathWithSplash( const QString &filePath )
{
- QString newFilePath = filePath ;
+ QString newFilePath;
if( filePath.isEmpty() ) {
return newFilePath;
}
-
- QString tempString;
- for( int i=0; i<newFilePath.length(); i++ ) {
- QChar ch( newFilePath[i] );
- if( ch == QChar('\\') ) {
- tempString.append( QChar('/') );
+
+ foreach( QChar ch, filePath ) {
+ if( ch == QChar('\\') || ch == QChar('/') ) {
+ newFilePath.append( QDir::separator() );
} else {
- tempString.append( ch );
+ newFilePath.append( ch );
}
}
- newFilePath = tempString;
- if( newFilePath.right( 1 )!= QChar('/') ){
- newFilePath.append( QChar('/') );
+ if( newFilePath.right( 1 )!= QDir::separator() ){
+ newFilePath.append( QDir::separator() );
}
return newFilePath;
@@ -623,8 +620,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;
@@ -641,9 +638,9 @@
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;
@@ -657,16 +654,16 @@
return false;
}
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;
}
- if( fileInfo.absoluteFilePath().contains( QString( Drive_D ), Qt::CaseInsensitive ) ) {
+ if( fileInfo.absoluteFilePath().contains( Drive_D, Qt::CaseInsensitive ) ) {
FmLogger::log( QString( "isPathAccessabel false: path contain D" ) );
return false;
}
- if( fileInfo.absoluteFilePath().contains( QString( Drive_Z ), Qt::CaseInsensitive ) ) {
+ if( fileInfo.absoluteFilePath().contains( Drive_Z, Qt::CaseInsensitive ) ) {
FmLogger::log( QString( "isPathAccessabel false: path contain Z" ) );
return false;
}
@@ -844,12 +841,17 @@
QString FmUtils::formatPath( const QString &path )
{
- QString formatPath = path;
- QRegExp regExp( "/" );
- formatPath.replace( regExp, "\\" );
-
- if( formatPath.right( 1 ) != QChar('\\') ){
- formatPath.append( QChar('\\') );
+ 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;
}
--- a/filemanager/src/inc/fmutils_win.cpp Fri Jun 11 13:29:48 2010 +0300
+++ b/filemanager/src/inc/fmutils_win.cpp Wed Jun 23 18:03:11 2010 +0300
@@ -195,8 +195,12 @@
bool FmUtils::isDriveC( const QString &driverName )
{
- Q_UNUSED( driverName );
- return false;
+ if( driverName.contains("C",Qt::CaseInsensitive) ){
+ return true;
+ }
+ else{
+ return false;
+ }
}
bool FmUtils::isDrive( const QString &path )
@@ -216,14 +220,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;
}
@@ -418,8 +431,19 @@
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()