# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276252188 -10800 # Node ID 1d0c87b42e2e383f561283d1f76b71045ebaacfc # Parent 15299bc55001d4f82271a01843a65a5f76b0c20a Revision: 201021 Kit: 2010123 diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/filemanager.pro --- a/filemanager/filemanager.pro Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/filemanager.pro Fri Jun 11 13:29:48 2010 +0300 @@ -21,4 +21,4 @@ } SUBDIRS += src/fmbkupenginewrapper -SUBDIRS += src/filemanager +SUBDIRS += src/filemanager \ No newline at end of file diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/burconfig.xml --- a/filemanager/src/filemanager/burconfig.xml Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/burconfig.xml Fri Jun 11 13:29:48 2010 +0300 @@ -115,9 +115,9 @@ 0x2002bcc0 0x20029f80 0x1028246F - 0x10282475 + 0x200211DC 0x102033E6 - + \ No newline at end of file diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/filemanager.pri --- a/filemanager/src/filemanager/filemanager.pri Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/filemanager.pri Fri Jun 11 13:29:48 2010 +0300 @@ -108,4 +108,4 @@ } symbian { SOURCES += src/operationservice/fmoperationformat_s60.cpp -} +} \ No newline at end of file diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupconfigloader.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -25,8 +25,6 @@ #include #include -#include - FmBackupConfigLoader::FmBackupConfigLoader(void) { diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -26,8 +26,6 @@ #include "fmcommon.h" #include "fmdlgutils.h" -#include - FmBackupRestoreHandler::FmBackupRestoreHandler( QObject *parent ) : QObject( parent ), mBackupConfigLoader( 0 ) { mBkupEngine = new FmBkupEngine( this ); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -20,7 +20,7 @@ #include "fmbackupwidget.h" #include "fmviewmanager.h" #include "fmoperationbase.h" - +#include "fmdlgutils.h" #include @@ -28,8 +28,6 @@ #include #include #include -#include - FmBackupView::FmBackupView() : FmViewBase( EBackupView ) { @@ -97,19 +95,19 @@ 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 path or drive is not available!") ) ); + 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; } } diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -28,9 +28,6 @@ #include #include #include -#include - - FmDeleteBackupView::FmDeleteBackupView() : FmViewBase( EDeleteBackupView ) { @@ -143,3 +140,7 @@ toolBar()->removeAction( mLeftAction ); } +void FmDeleteBackupView::refreshDeleteBackupView() +{ + mDeleteBackupWidget->refresh(); +} diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h Fri Jun 11 13:29:48 2010 +0300 @@ -34,11 +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 diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -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 #include #include - #include FmDeleteBackupWidget::FmDeleteBackupWidget( HbWidget *parent ) @@ -47,17 +45,16 @@ { mListView->setModel( 0 ); loadData(); - mListView->setModel( mModel ); - mItemList.clear(); + mListView->setModel( mModel ); for (int i = 0; i < mModel->rowCount(); ++i) { QModelIndex index = mModel->index(i); - mRestoreViewItem = static_cast< FmRestoreViewItem* > + FmRestoreViewItem* restoreViewItem = static_cast< FmRestoreViewItem* > (mListView->itemByIndex(index)); - connect(mRestoreViewItem, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int))); - mItemList.push_back(mRestoreViewItem); - + connect(restoreViewItem, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int))); } + emit stateChanged(0); } + QList FmDeleteBackupWidget::selectionIndexes() { QList selectionList; @@ -93,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 ); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h Fri Jun 11 13:29:48 2010 +0300 @@ -53,9 +53,7 @@ QStringListModel *mModel; FmRestoreSettings *mRestoreSettings; - FmBackupConfigLoader *mBackupConfigLoader; - FmRestoreViewItem *mRestoreViewItem; - QList mItemList; + FmBackupConfigLoader *mBackupConfigLoader; }; #endif diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -20,6 +20,7 @@ #include "fmrestorewidget.h" #include "fmviewmanager.h" #include "fmoperationbase.h" +#include "fmdlgutils.h" #include @@ -27,9 +28,6 @@ #include #include #include -#include - - FmRestoreView::FmRestoreView(): FmViewBase( ERestoreView ) { @@ -99,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(tr("restore failed")); break; } } @@ -143,3 +141,8 @@ mRestoreAction->setEnabled(false); } } + +void FmRestoreView::refreshRestoreView() +{ + mRestoreWigdet->refresh(); +} diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmrestoreview.h --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.h Fri Jun 11 13:29:48 2010 +0300 @@ -38,6 +38,7 @@ void on_leftAction_triggered(); void on_restoreAction_triggered(); void onCheckBoxStateChange(); + void refreshRestoreView(); #ifdef FM_CHANGE_ORIENT_ENABLE void on_rotateAction_triggered(); #endif diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -16,9 +16,9 @@ * The source file of the restore view list item of file manager */ #include "fmrestoreviewitem.h" - +#include "fmfileiconprovider.h" #include - +#include #include #include #include @@ -64,47 +64,62 @@ return; } - mRestoreContentLabel->setPlainText( stringList.first() ); + mRestoreContentLabel->setPlainText(stringList.first()); - if( stringList.first() != stringList.last() ){ - mDateTimeLabel->setPlainText( stringList.last() ); - } - connect(this, SIGNAL(stateChanged(int)), mParentWidget, SIGNAL(stateChanged(int))); + if (stringList.size() > 0) + { + mDateTimeLabel->setPlainText(stringList.at(1)); + } + if (stringList.size() > 1) + { + QIcon icon = mIconProvider->icon(QFileInfo(stringList.at(2))); + if (icon.isNull()) + { + QFileIconProvider fileIconProvider; + icon = fileIconProvider.icon(QFileIconProvider::Drive); + } + mIconLabel->setIcon(HbIcon(icon)); + } + + connect(this, SIGNAL(stateChanged(int)), mParentWidget, + SIGNAL(stateChanged(int))); } - void FmRestoreViewItem::init() { + 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 ); + hLayout->setOrientation(Qt::Horizontal); + hLayout->addItem(layout()); + + 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 ); - connect(mCheckBox, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int))); - setLayout( hLayout ); - + hLayout->addItem(textWidget); + hLayout->setAlignment(textWidget, Qt::AlignVCenter); + + connect(mCheckBox, SIGNAL(stateChanged(int)), this, + SIGNAL(stateChanged(int))); + setLayout(hLayout); } void FmRestoreViewItem::setCheckBoxState() diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h Fri Jun 11 13:29:48 2010 +0300 @@ -26,6 +26,7 @@ class HbLineEdit; class QGraphicsLinearLayout; class HbWidget; +class FmFileIconProvider; //FmRestoreViewItem class FmRestoreViewItem : public HbListViewItem { @@ -52,11 +53,13 @@ private: HbLabel *mRestoreContentLabel; - HbLabel *mDateTimeLabel; + HbLabel *mDateTimeLabel; HbCheckBox *mCheckBox; QGraphicsLinearLayout *hLayout; HbWidget *mParentWidget; + HbLabel *mIconLabel; + FmFileIconProvider *mIconProvider; }; #endif diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -72,8 +72,7 @@ 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(); mRestoreSettings->load( mBackupConfigLoader->driversAndOperationList() ); @@ -89,6 +88,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 ); @@ -111,3 +113,44 @@ { 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); + +} diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h --- a/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h Fri Jun 11 13:29:48 2010 +0300 @@ -36,6 +36,7 @@ QList selectionIndexes(); int backupDataCount(); + void refresh(); private: void init(); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/components/fmdialog.h --- a/filemanager/src/filemanager/src/components/fmdialog.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdialog.h Fri Jun 11 13:29:48 2010 +0300 @@ -20,10 +20,9 @@ #define FMDIALOG_H #include -#include #include - -#include "hbmenu.h" +#include +#include class FmDialog : public HbDialog { Q_OBJECT diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/components/fmdlgutils.cpp --- a/filemanager/src/filemanager/src/components/fmdlgutils.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdlgutils.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -389,3 +389,9 @@ FmMessageBox msgBox; return msgBox.question( questionText, primaryButtonText, secondaryButtonText ); } + +void FmDlgUtils::information( const QString &informationText ) +{ + FmMessageBox msgBox; + return msgBox.information( informationText ); +} diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/components/fmdlgutils.h --- a/filemanager/src/filemanager/src/components/fmdlgutils.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdlgutils.h Fri Jun 11 13:29:48 2010 +0300 @@ -89,6 +89,8 @@ static bool question( const QString &questionText, const QString &primaryButtonText = tr("Yes"), const QString &secondaryButtonText = tr("No") ); + static void information( const QString &informationText ); + ~FmDlgUtils(void); private: FmDlgUtils(void); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/components/fmmessagebox.cpp --- a/filemanager/src/filemanager/src/components/fmmessagebox.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmmessagebox.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -19,6 +19,13 @@ #include "fmmessagebox.h" #include +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 ) { diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/components/fmmessagebox.h --- a/filemanager/src/filemanager/src/components/fmmessagebox.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmmessagebox.h Fri Jun 11 13:29:48 2010 +0300 @@ -33,6 +33,8 @@ ~FmMessageBox() { } + void information( const QString &informationText ); + bool question( const QString &questionText, const QString &primaryButtonText, const QString &secondaryButtonText ); public slots: diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/components/fmviewdetailsitem.cpp --- a/filemanager/src/filemanager/src/components/fmviewdetailsitem.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsitem.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -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 ); } diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/components/fmviewdetailsitem.h --- a/filemanager/src/filemanager/src/components/fmviewdetailsitem.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmviewdetailsitem.h Fri Jun 11 13:29:48 2010 +0300 @@ -22,6 +22,7 @@ #include class HbLabel; +class QGraphicsLinearLayout; class FmViewDetailsItem : public HbListViewItem { @@ -45,6 +46,8 @@ private: HbLabel *mDetailsContentLabel; HbLabel *mDetailsLabel; + + QGraphicsLinearLayout *mLayout; }; #endif /* FMVIEWDETAILSITEM_H */ diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmdriverlistwidget.cpp --- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -32,13 +32,12 @@ #include #include #include -#include #include FmDriverListWidget::FmDriverListWidget( QGraphicsItem *parent ) -: HbWidget( parent ), - mCurrentItem( 0 ), - mOperationService( 0 ), mListLongPressed( false ) +: 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,6 +51,9 @@ FmDriverListWidget::~FmDriverListWidget() { + if (mContextMenu) { + mContextMenu->deleteLater(); + } } void FmDriverListWidget::on_list_activated( const QModelIndex &index ) @@ -86,7 +88,7 @@ mSearchPanel->hide(); // mLayout->addItem( mSearchPanel ); - mListView->setItemPrototype( new DiskListViewItem() ); + mListView->setItemPrototype( new DiskListViewItem(this) ); connect( mListView, SIGNAL( activated( const QModelIndex & ) ), this, SLOT( on_list_activated( const QModelIndex & ) ) ); connect( mListView, SIGNAL( pressed( const QModelIndex & ) ), @@ -96,7 +98,7 @@ 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 & ) ) ); @@ -119,22 +121,25 @@ 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 ) ) { - HbMenu *contextMenu = new HbMenu(); - if( state & FmDriverInfo::EDriveAvailable ) { HbAction *viewAction = new HbAction(); viewAction->setObjectName( "viewAction" ); viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_memory" ) ); - contextMenu->addAction( viewAction ); + mContextMenu->addAction( viewAction ); //state = 0x210; connect( viewAction, SIGNAL( triggered() ), - this, SLOT( on_viewAction_triggered() ) ); + this, SLOT( on_viewAction_triggered() ), Qt::QueuedConnection ); } if( ( state & FmDriverInfo::EDriveAvailable ) && ( state & FmDriverInfo::EDriveRemovable ) && !( state & FmDriverInfo::EDriveMassStorage ) ){ @@ -143,45 +148,45 @@ HbAction *renameAction = new HbAction(); renameAction->setObjectName( "renameAction" ); renameAction->setText( hbTrId( "txt_fmgr_menu_rename" ) ); - contextMenu->addAction( renameAction ); + mContextMenu->addAction( renameAction ); connect( renameAction, SIGNAL( triggered() ), - this, SLOT( on_renameAction_triggered() ) ); + this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection ); } else{ HbAction *nameAction = new HbAction(); nameAction->setObjectName( "nameAction" ); nameAction->setText( hbTrId( "txt_fmgr_menu_name" ) ); - contextMenu->addAction( nameAction ); + mContextMenu->addAction( nameAction ); connect( nameAction, SIGNAL( triggered() ), - this, SLOT( on_nameAction_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" ) ); - contextMenu->addAction( changePwdAction ); + mContextMenu->addAction( changePwdAction ); HbAction *removePwdAction = new HbAction(); removePwdAction->setObjectName( "removePwdAction" ); removePwdAction->setText( hbTrId( "txt_fmgr_menu_remove_password" ) ); - contextMenu->addAction( removePwdAction ); + mContextMenu->addAction( removePwdAction ); connect( changePwdAction, SIGNAL( triggered() ), - this, SLOT( on_changePwdAction_triggered() ) ); + this, SLOT( on_changePwdAction_triggered() ), Qt::QueuedConnection ); connect( removePwdAction, SIGNAL( triggered() ), - this, SLOT( on_removePwdAction_triggered() ) ); + this, SLOT( on_removePwdAction_triggered() ), Qt::QueuedConnection ); } else{ HbAction *setPwdAction = new HbAction(); setPwdAction->setObjectName( "setPwdAction" ); setPwdAction->setText( hbTrId( "txt_fmgr_menu_set_password" ) ); - contextMenu->addAction( setPwdAction ); + mContextMenu->addAction( setPwdAction ); connect( setPwdAction, SIGNAL( triggered() ), - this, SLOT( on_setPwdAction_triggered() ) ); + this, SLOT( on_setPwdAction_triggered() ), Qt::QueuedConnection ); } } } @@ -190,10 +195,10 @@ 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() ) ); + this, SLOT( on_ejectAction_triggered() ), Qt::QueuedConnection ); } #ifndef _DEBUG_ENABLE_FORMATMENU_ @@ -203,10 +208,10 @@ HbAction *formatAction = new HbAction(); formatAction->setObjectName( "formatAction" ); formatAction->setText( hbTrId( "txt_fmgr_menu_format" ) ); - contextMenu->addAction( formatAction ); + mContextMenu->addAction( formatAction ); connect( formatAction, SIGNAL( triggered() ), - this, SLOT( on_formatAction_triggered() ) ); + this, SLOT( on_formatAction_triggered() ), Qt::QueuedConnection ); #ifndef _DEBUG_ENABLE_FORMATMENU_ } #endif @@ -215,15 +220,18 @@ HbAction *unLockedAction = new HbAction(); unLockedAction->setObjectName( "unLockedAction" ); unLockedAction->setText( hbTrId( "Unlock" ) ); - contextMenu->addAction( unLockedAction ); + mContextMenu->addAction( unLockedAction ); connect( unLockedAction, SIGNAL( triggered() ), - this, SLOT( on_unLockedAction_triggered() ) ); + this, SLOT( on_unLockedAction_triggered() ), Qt::QueuedConnection ); } - contextMenu->setPreferredPos( coords ); - contextMenu->open(); } - + if( mContextMenu->actions().count() > 0 ) { + mContextMenu->setPreferredPos( coords ); + mContextMenu->open(); + } else { + emit activated( diskName ); + } } void FmDriverListWidget::on_list_pressed( const QModelIndex & index ) @@ -245,7 +253,7 @@ 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; } @@ -256,13 +264,13 @@ 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; } } @@ -288,18 +296,18 @@ QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) ); 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; @@ -312,9 +320,9 @@ 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 { @@ -322,7 +330,7 @@ break; } } else { - HbMessageBox::information( hbTrId( "The password is incorrect, try again!" ) ); + FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) ); } } @@ -341,15 +349,15 @@ 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!" ) ); } } @@ -368,18 +376,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; } } @@ -391,7 +399,7 @@ 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." ) ); } } @@ -425,8 +433,8 @@ 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 ) diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmdriverlistwidget.h --- a/filemanager/src/filemanager/src/fmdriverlistwidget.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverlistwidget.h Fri Jun 11 13:29:48 2010 +0300 @@ -23,11 +23,12 @@ #include "fmoperationservice.h" #include -class QFileSystemWatcher; +class FmDriveModel; class HbListView; class HbAbstractViewItem; class HbSearchPanel; -class FmDriveModel; +class HbMenu; +class QFileSystemWatcher; class QGraphicsLinearLayout; @@ -80,6 +81,7 @@ QString mFindTargetPath; QGraphicsLinearLayout *mLayout; + HbMenu *mContextMenu; //used to avoid activate when long press list. bool mListLongPressed; diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmdriverview.cpp --- a/filemanager/src/filemanager/src/fmdriverview.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmdriverview.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -23,7 +23,6 @@ #include -#include #include #include #include diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmfilebrowsewidget.cpp --- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -36,7 +36,6 @@ #include #include #include -#include #include FmFileBrowseWidget::FmFileBrowseWidget( HbWidget *parent, FmFileBrowseWidget::Style style ) @@ -208,14 +207,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 ); - } - */ } @@ -283,7 +274,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(); @@ -292,7 +283,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() ) ); @@ -307,7 +298,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(); @@ -316,7 +307,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(); @@ -325,7 +316,7 @@ contextMenu->addAction( renameAction ); connect( renameAction, SIGNAL( triggered() ), - this, SLOT( on_renameAction_triggered() ) ); + this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection ); } // if( fileInfo.isFile() ){ @@ -381,6 +372,8 @@ 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 & ) ) ); } @@ -421,7 +414,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 & ) ) ); @@ -565,8 +558,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 ) @@ -619,13 +612,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!" ) ); } } } @@ -648,13 +641,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!" ) ); } } @@ -678,13 +671,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!" ) ); } } } @@ -698,24 +691,25 @@ QString newName( fileInfo.fileName() ); while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true, - maxFileNameLength, QString() , false ) ){ + maxFileNameLength, QString() , true ) ){ QString newTargetPath = FmUtils::fillPathWithSplash( fileInfo.absolutePath() ) + newName; QFileInfo newFileInfo( newTargetPath ); - if( newFileInfo.exists() ) { - HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( newName ) ); - continue; - } - if( !FmUtils::checkFolderFileName( newName ) ) { - HbMessageBox::information( hbTrId( "Invalid file or folder name, try again!" ) ); + if( !FmUtils::checkFolderFileName( newName ) ) { + FmDlgUtils::information( hbTrId( "Invalid file or folder name!" ) ); continue; } if( !FmUtils::checkMaxPathLength( newTargetPath ) ) { - HbMessageBox::information( hbTrId( "the path you specified is too long, try again!" ) ); + FmDlgUtils::information( hbTrId( "the path you specified is too long!" ) ); continue; } + if( newFileInfo.exists() ) { + FmDlgUtils::information( hbTrId( "%1 already exist!" ).arg( newName ) ); + continue; + } + if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) { - HbMessageBox::information( hbTrId("Rename failed!") ); + FmDlgUtils::information( hbTrId("Rename failed!") ); } break; } diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmfileview.cpp --- a/filemanager/src/filemanager/src/fmfileview.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfileview.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -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" ) ); 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(); } @@ -221,12 +231,13 @@ 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( tr("No File/Folder selected" ) ); } #ifdef FM_CHANGE_ORIENT_ENABLE @@ -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 ); } @@ -366,13 +377,13 @@ break; case FmErrAlreadyStarted: // last operation have not finished - HbMessageBox::information( tr( "Operatin already started!" ) ); + FmDlgUtils::information( tr( "Operatin already started!" ) ); break; case FmErrWrongParam: - HbMessageBox::information( tr( "Wrong parameters!" ) ); + FmDlgUtils::information( tr( "Wrong parameters!" ) ); break; default: - HbMessageBox::information( tr( "Operation fail to start!" ) ); + FmDlgUtils::information( tr( "Operation fail to start!" ) ); } setSelectable( false ); } @@ -394,20 +405,20 @@ dir.absolutePath() ) + dirName; QFileInfo newFileInfo( newTargetPath ); if( !FmUtils::checkFolderFileName( dirName ) ) { - HbMessageBox::information( hbTrId( "Invalid file or folder name!" ) ); + FmDlgUtils::information( hbTrId( "Invalid file or folder name!" ) ); continue; } if( !FmUtils::checkMaxPathLength( newTargetPath ) ) { - HbMessageBox::information( hbTrId( "the path you specified is too long!" ) ); + FmDlgUtils::information( hbTrId( "the path you specified is too long!" ) ); continue; } if( newFileInfo.exists() ) { - HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( dirName ) ); + FmDlgUtils::information( hbTrId( "%1 already exist!" ).arg( dirName ) ); continue; } if( !dir.mkdir( dirName ) ) { - HbMessageBox::information( hbTrId("Operation failed!") ); + FmDlgUtils::information( hbTrId("Operation failed!") ); } refreshModel( path ); break; @@ -423,13 +434,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(); } diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmsplitview.cpp --- a/filemanager/src/filemanager/src/fmsplitview.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmsplitview.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -21,7 +21,6 @@ #include "fmdriverlistwidget.h" #include -#include #include #include #include diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmviewmanager.cpp --- a/filemanager/src/filemanager/src/fmviewmanager.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewmanager.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -29,9 +29,9 @@ #include "fmoperationbase.h" #include "fmdrivewatcher.h" #include "fmdialog.h" +#include "fmdlgutils.h" #include -#include #include #include @@ -192,7 +192,7 @@ } if( checkedPath.isEmpty() ) { - HbMessageBox::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) ); + FmDlgUtils::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) ); return; } @@ -248,6 +248,7 @@ mMainWindow->addView( restoreView ); mMainWindow->setCurrentView( restoreView ); + connect( this, SIGNAL( refreshRestoreView() ), restoreView, SLOT( refreshRestoreView() ) ); } @@ -257,6 +258,7 @@ mMainWindow->addView( deleteBackupView ); mMainWindow->setCurrentView( deleteBackupView ); + connect( this, SIGNAL( refreshDeleteBackupView() ), deleteBackupView, SLOT( refreshDeleteBackupView() ) ); } @@ -289,6 +291,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" ) ); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/fmviewmanager.h --- a/filemanager/src/filemanager/src/fmviewmanager.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmviewmanager.h Fri Jun 11 13:29:48 2010 +0300 @@ -100,6 +100,8 @@ signals: void refreshModel( const QString &path ); void refreshBackupView(); + void refreshDeleteBackupView(); + void refreshRestoreView(); private: /// create view will push current view to stack diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/listviewitems.cpp --- a/filemanager/src/filemanager/src/listviewitems.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/listviewitems.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -32,8 +32,8 @@ : HbListViewItem( parent ), mIconLabel( 0 ), mDiskNameLabel( 0 ), - mSizeLabel( 0 ), - mFreeLabel( 0 ), + mFirstLabel( 0 ), + mSecondLabel( 0 ), mCheckBox( 0 ), hLayout( 0 ) @@ -84,8 +84,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() ); } @@ -116,15 +127,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); @@ -134,88 +145,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(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( 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(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 ); -} -*/ diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/listviewitems.h --- a/filemanager/src/filemanager/src/listviewitems.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/listviewitems.h Fri Jun 11 13:29:48 2010 +0300 @@ -50,8 +50,8 @@ HbLabel *mIconLabel; HbLabel *mDiskNameLabel; - HbLabel *mSizeLabel; - HbLabel *mFreeLabel; + HbLabel *mFirstLabel; + HbLabel *mSecondLabel; HbCheckBox *mCheckBox; QGraphicsLinearLayout *hLayout; }; diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -47,25 +46,34 @@ srcFile + QString( " already exist, please rename:" ); QString value; QFileInfo fileInfo(srcFile); - while (FmDlgUtils::showTextQuery( questionText, value, true, maxFileNameLength, QString(), false )) { + bool ret = FmDlgUtils::showTextQuery( questionText, value, true, maxFileNameLength, QString(), false ); + while ( ret ) { + bool checkResult = true; QString newTargetPath = FmUtils::fillPathWithSplash( fileInfo.absolutePath() ) + value; QFileInfo newFileInfo( newTargetPath ); if (!FmUtils::checkFolderFileName(value)) { - HbMessageBox::information( hbTrId( "Invalid file or folder name, try again!" ) ); - continue; + FmDlgUtils::information( hbTrId( "Invalid file or folder name, try again!" ) ); + checkResult = false; } if( !FmUtils::checkMaxPathLength( newTargetPath ) ) { - HbMessageBox::information( hbTrId( "the path you specified is too long, try again!" ) ); - continue; + FmDlgUtils::information( hbTrId( "the path you specified is too long, try again!" ) ); + checkResult = false; } if (newFileInfo.exists()) { - HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( value ) ); - continue; + FmDlgUtils::information( hbTrId( "%1 already exist!" ).arg( value ) ); + checkResult = false; } - break; + if( !checkResult ) { + ret = FmDlgUtils::showTextQuery( questionText, value, true, maxFileNameLength, QString(), false ); + continue; + } else { + break; + } } - *destFile = value; + if( ret ) { + *destFile = value; + } } void FmOperationResultProcesser::onAskForReplace( @@ -85,7 +93,7 @@ void FmOperationResultProcesser::onShowNote( FmOperationBase* operationBase, const char *noteString ) { - HbMessageBox::information(hbTrId(noteString)); + FmDlgUtils::information(hbTrId(noteString)); } void FmOperationResultProcesser::onNotifyWaiting( FmOperationBase* operationBase, bool cancelable ) @@ -205,7 +213,7 @@ } case FmOperationService::EOperationTypeFormat: { - HbMessageBox::information( QString( hbTrId("Format succeed!")) ); + FmDlgUtils::information( QString( hbTrId("Format succeed!")) ); FmOperationFormat *paramFormat = static_cast( operationBase ); QString title( tr( "Drive name ") ); QString driveName( paramFormat->driverName() ); @@ -218,13 +226,13 @@ 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; } } @@ -233,16 +241,16 @@ } 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")) ); } } @@ -253,56 +261,56 @@ switch( error ) { case FmErrAlreadyStarted: - HbMessageBox::information( QString( hbTrId("Operation already started!")) ); + FmDlgUtils::information( QString( hbTrId("Operation already started!")) ); return; case FmErrLocked: - HbMessageBox::information( QString( hbTrId("Operation failed because drive is locked!")) ); + FmDlgUtils::information( QString( hbTrId("Operation failed because drive is locked!")) ); return; case FmErrPathNotFound: - HbMessageBox::information( QString( hbTrId("Operation failed because can not find target path or drive is not available!") ) ); + FmDlgUtils::information( QString( hbTrId("Operation failed because can not find target path or drive is not available!") ) ); return; case FmErrCorrupt: - HbMessageBox::information( QString( hbTrId("Operation failed because target media is corrupted!") ) ); + FmDlgUtils::information( QString( hbTrId("Operation failed because target media is corrupted!") ) ); return; case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup - HbMessageBox::information( QString( hbTrId("Operation failed because device is not ready!") ) ); + FmDlgUtils::information( QString( hbTrId("Operation failed because device is not ready!") ) ); return; case FmErrDisMounted: // Caused by eject MMC when preparing backup - HbMessageBox::information( QString( hbTrId("Operation failed because device has been removed!") ) ); + 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; } } @@ -311,10 +319,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")) ); } } @@ -323,7 +331,7 @@ { Q_UNUSED( operationBase ); cancelProgress(); - HbMessageBox::information( QString( hbTrId("Operation Canceled!") ) ); + FmDlgUtils::information( QString( hbTrId("Operation Canceled!") ) ); } @@ -350,6 +358,7 @@ // } else { // mNote->setProgressDialogType( HbProgressDialog::WaitNote ); // } + mNote->setText( title ); QList actionList = mNote->actions(); if (actionList.size() > 0) { QAction *cancelAction = actionList.at(0); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -29,7 +29,6 @@ #include "fmoperationformat.h" #include -#include FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ), mCurrentOperation( 0 ) diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/filemanager/src/operationservice/fmoperationthread.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Fri Jun 11 13:29:48 2010 +0300 @@ -55,7 +55,7 @@ void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void refreshModel( const QString &path ); - void showNote( const QString ¬eString ); + 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 ); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/fmbkupengine/src/MMCScBkupSBEUtils.cpp --- a/filemanager/src/fmbkupengine/src/MMCScBkupSBEUtils.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/fmbkupengine/src/MMCScBkupSBEUtils.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -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 ); } diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h --- a/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/inc/fmbackupsettings.h Fri Jun 11 13:29:48 2010 +0300 @@ -46,7 +46,7 @@ const QString constFileManagerBackupSettingsContentSettings = "Settings"; const QString constFileManagerBackupSettingsContentMessages = "Messages"; const QString constFileManagerBackupSettingsContentContacts = "Contacts"; -const QString constFileManagerBackupSettingsContentCalendar = "Calendar entries"; +const QString constFileManagerBackupSettingsContentCalendar = "Calendar"; const QString constFileManagerBackupSettingsContentBookmarks = "Bookmarks"; const QString constFileManagerBackupSettingsContentUserFiles = "Files"; diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp --- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -724,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 ); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.cpp --- a/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -149,7 +149,7 @@ void FmBkupEnginePrivate::GetRestoreInfoArray( QList 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 ); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h --- a/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h Fri Jun 11 13:29:48 2010 +0300 @@ -56,7 +56,7 @@ bool StartRestoreL( QList drivesAndOperationList ); void GetRestoreInfoArray( QList drivesAndOperationList, QList< FmRestoreInfo > &restoreInfoList, - const int aDrive = 0 ); + const QString& aDrive ); void getBackupDriveList( QStringList &driveList ); private: int DriverNameToNumber( QString driverName ); diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/fmfiledialog/src/fmfiledialog.cpp --- a/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -68,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; } @@ -97,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; @@ -127,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; diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/inc/commonutils.pri --- a/filemanager/src/inc/commonutils.pri Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/inc/commonutils.pri Fri Jun 11 13:29:48 2010 +0300 @@ -45,4 +45,4 @@ } HEADERS += $$INTERNAL_HEADERS -SOURCES += $$INTERNAL_SOURCES +SOURCES += $$INTERNAL_SOURCES \ No newline at end of file diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/inc/fmcommon.h --- a/filemanager/src/inc/fmcommon.h Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/inc/fmcommon.h Fri Jun 11 13:29:48 2010 +0300 @@ -36,6 +36,8 @@ //used to test drive hide which drive could be listed but not available //#define _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_ +//used to test locked drive +//#define _DEBUG_LOCKED_DRIVE_Z #include "fmlogger.h" #include "fmdefine.h" diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/inc/fmdrivemodel.cpp --- a/filemanager/src/inc/fmdrivemodel.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/inc/fmdrivemodel.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -38,6 +38,7 @@ { QFileInfoList infoList = QDir::drives(); + emit layoutAboutToBeChanged(); mDriveList.clear(); if( mOptions & HideUnAvailableDrive ) { FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_true" ) ); @@ -46,7 +47,10 @@ FmLogger::log( QString( "FmDriveModel::refresh HideUnAvailableDrive_false" ) ); FmUtils::getDriveList( mDriveList, false ); } - emit layoutChanged(); + emit layoutChanged(); + for( int i=0; i KMaxPath ) { return false; } return true; - } +} bool FmUtils::checkFolderFileName( const QString& name ) { if( name.endsWith( QChar('.'), Qt::CaseInsensitive ) ) { diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/src/inc/fmutils_win.cpp --- a/filemanager/src/inc/fmutils_win.cpp Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/src/inc/fmutils_win.cpp Fri Jun 11 13:29:48 2010 +0300 @@ -26,6 +26,8 @@ #include #define BURCONFIGFILE "burconfig.xml" +const int KMaxFileName=0x100; +const int KMaxPath=0x100; QString FmUtils::getDriveNameFromPath( const QString &path ) { @@ -73,6 +75,21 @@ if ( drvStatus == DRIVE_REMOVABLE ) { state |= FmDriverInfo::EDriveRemovable; } +#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_ + if ( driverName.contains( "D", Qt::CaseInsensitive ) ) { + state |= FmDriverInfo::EDriveNotPresent; + } +#endif + +#ifdef _DEBUG_LOCKED_DRIVE_Z + if ( driverName.contains( "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 ); } @@ -273,10 +290,10 @@ bool FmUtils::isPathAccessabel( const QString &path ) { -#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_ - if(path.contains("D:")) + if(!isDriveAvailable( path ) ) { //used to filter locked drive return false; -#endif + } + QFileInfo fileInfo( path ); #ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_ @@ -299,11 +316,15 @@ 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("D:")) + return false; +#endif +#ifdef _DEBUG_LOCKED_DRIVE_Z + if(path.contains("Z:")) + return false; +#endif + return true; } void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ) @@ -400,3 +421,37 @@ Q_UNUSED( path ); return false; } + +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; +} \ No newline at end of file diff -r 15299bc55001 -r 1d0c87b42e2e filemanager/tsrc/unit/unit_backuprestoresettings/unit_backuprestoresettings.pro --- a/filemanager/tsrc/unit/unit_backuprestoresettings/unit_backuprestoresettings.pro Thu May 27 12:45:43 2010 +0300 +++ b/filemanager/tsrc/unit/unit_backuprestoresettings/unit_backuprestoresettings.pro Fri Jun 11 13:29:48 2010 +0300 @@ -16,6 +16,7 @@ QT += testlib CONFIG += qtestlib +CONFIG += symbian_test TEMPLATE = app TARGET = include ( ../../../src/inc/commoninc.pri )