# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274953543 -10800 # Node ID 15299bc55001d4f82271a01843a65a5f76b0c20a # Parent edd66bde63a43e7dd485738b2bfbcdd6bec839e7 Revision: 201019 Kit: 2010121 diff -r edd66bde63a4 -r 15299bc55001 filemanager/filemanager.pro --- a/filemanager/filemanager.pro Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/filemanager.pro Thu May 27 12:45:43 2010 +0300 @@ -21,4 +21,4 @@ } SUBDIRS += src/fmbkupenginewrapper -SUBDIRS += src/filemanager \ No newline at end of file +SUBDIRS += src/filemanager diff -r edd66bde63a4 -r 15299bc55001 filemanager/filemanager_plat/inc/fmfiledialog.h --- a/filemanager/filemanager_plat/inc/fmfiledialog.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/filemanager_plat/inc/fmfiledialog.h Thu May 27 12:45:43 2010 +0300 @@ -105,7 +105,12 @@ ~FmFileDialog(); bool exec(); + HbAction *primaryAction() const; + void setPrimaryAction( HbAction *action ); + HbAction *secondaryAction() const; + void setSecondaryAction( HbAction *action ); + FmFileDialogPrivate *d_ptr; Q_DISABLE_COPY( FmFileDialog) diff -r edd66bde63a4 -r 15299bc55001 filemanager/rom/filemngr.iby --- a/filemanager/rom/filemngr.iby Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/rom/filemngr.iby Thu May 27 12:45:43 2010 +0300 @@ -24,7 +24,6 @@ file=ABI_DIR\BUILD_DIR\filemngr.exe SHARED_LIB_DIR\filemngr.exe HB_UPGRADABLE_APP_REG_RSC(filemngr) -S60_APP_RESOURCE(filemngr) file=ABI_DIR\BUILD_DIR\fmbkupengine.dll SHARED_LIB_DIR\fmbkupengine.dll diff -r edd66bde63a4 -r 15299bc55001 filemanager/rom/rom.pri --- a/filemanager/rom/rom.pri Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/rom/rom.pri Thu May 27 12:45:43 2010 +0300 @@ -18,12 +18,7 @@ symbian { FILEMNGR_IBY_DIR = $$section(PWD, ":", 1) - exists(/epoc32/include/platform_paths.hrh) { - BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " - } else { - BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " - } - + BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include" BLD_INF_RULES.prj_exports += "$$FILEMNGR_IBY_DIR/filemngr.iby CORE_APP_LAYER_IBY_EXPORT_PATH(filemngr.iby)" BLD_INF_RULES.prj_exports += "$$FILEMNGR_IBY_DIR/filemngr_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(filemngr_resources.iby)" } diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/bwins/fmfiledialogu.def --- a/filemanager/src/bwins/fmfiledialogu.def Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/bwins/fmfiledialogu.def Thu May 27 12:45:43 2010 +0300 @@ -18,4 +18,8 @@ ?getExistingDirectory@FmFileDialog@@SA?AVQString@@PAVHbWidget@@ABV2@1ABVQStringList@@V?$QFlags@W4Option@FmFileDialog@@@@@Z @ 17 NONAME ; class QString FmFileDialog::getExistingDirectory(class HbWidget *, class QString const &, class QString const &, class QStringList const &, class QFlags) ?qt_metacast@FmFileDialog@@UAEPAXPBD@Z @ 18 NONAME ; void * FmFileDialog::qt_metacast(char const *) ?dialogClosed@FmFileDialog@@AAEXPAVHbAction@@@Z @ 19 NONAME ; void FmFileDialog::dialogClosed(class HbAction *) + ?setSecondaryAction@FmFileDialog@@AAEXPAVHbAction@@@Z @ 20 NONAME ; void FmFileDialog::setSecondaryAction(class HbAction *) + ?secondaryAction@FmFileDialog@@ABEPAVHbAction@@XZ @ 21 NONAME ; class HbAction * FmFileDialog::secondaryAction(void) const + ?setPrimaryAction@FmFileDialog@@AAEXPAVHbAction@@@Z @ 22 NONAME ; void FmFileDialog::setPrimaryAction(class HbAction *) + ?primaryAction@FmFileDialog@@ABEPAVHbAction@@XZ @ 23 NONAME ; class HbAction * FmFileDialog::primaryAction(void) const diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/eabi/fmfiledialogu.def --- a/filemanager/src/eabi/fmfiledialogu.def Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/eabi/fmfiledialogu.def Thu May 27 12:45:43 2010 +0300 @@ -20,4 +20,8 @@ _ZThn8_N12FmFileDialogD0Ev @ 19 NONAME _ZThn8_N12FmFileDialogD1Ev @ 20 NONAME _ZN12FmFileDialog12dialogClosedEP8HbAction @ 21 NONAME + _ZN12FmFileDialog16setPrimaryActionEP8HbAction @ 22 NONAME + _ZN12FmFileDialog18setSecondaryActionEP8HbAction @ 23 NONAME + _ZNK12FmFileDialog13primaryActionEv @ 24 NONAME + _ZNK12FmFileDialog15secondaryActionEv @ 25 NONAME diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/burconfig.xml --- a/filemanager/src/filemanager/burconfig.xml Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/burconfig.xml Thu May 27 12:45:43 2010 +0300 @@ -120,4 +120,4 @@ - \ No newline at end of file + diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/filemanager.pri --- a/filemanager/src/filemanager/filemanager.pri Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/filemanager.pri Thu May 27 12:45:43 2010 +0300 @@ -108,4 +108,4 @@ } symbian { SOURCES += src/operationservice/fmoperationformat_s60.cpp -} \ No newline at end of file +} diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp Thu May 27 12:45:43 2010 +0300 @@ -38,7 +38,7 @@ connect( mBkupEngine, SIGNAL( notifyStart( bool, int) ), this, SLOT( onNotifyStart( bool, int ) ), Qt::QueuedConnection ); connect( mBkupEngine, SIGNAL( notifyUpdate(int) ), this, SLOT( onNotifyUpdate(int) ), Qt::QueuedConnection ); connect( mBkupEngine, SIGNAL( notifyFinish(int) ), - this, SLOT( onNotifyFinish(int) ), Qt::QueuedConnection ); + this, SLOT( onNotifyFinish(int) ), Qt::DirectConnection ); connect( mBkupEngine, SIGNAL( notifyMemoryLow(int, int& ) ), this, SLOT( onNotifyMemoryLow(int, int&) ) ); connect( mBkupEngine, SIGNAL( notifyBackupFilesExist( bool& )), this, SLOT( onNotifyBackupFilesExist( bool& ))); diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmbackupviewitem.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackupviewitem.cpp Fri May 14 15:42:43 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * - * Description: - * The source file of the back up view list item of file manager - */ - -#include "fmbackupviewitem.h" - -#include - -#include -#include -#include -#include - - -FmBackupViewItem::FmBackupViewItem( QGraphicsItem *parent ) - : mTitleLabel( 0 ), - //mTipsLabel( 0 ), - mTipsLineEdit( 0 ), - HbListViewItem( parent ) -{ - init(); -} - -FmBackupViewItem::~FmBackupViewItem() -{ -} - -void FmBackupViewItem::polish(HbStyleParameters& params) -{ - Q_UNUSED(params); -} - -HbAbstractViewItem *FmBackupViewItem::createItem() -{ - return new FmBackupViewItem( parentItem() ); -} - -void FmBackupViewItem::updateChildItems() -{ - QString string = modelIndex().data( Qt::DisplayRole ).toString(); - - QStringList stringList = string.split( '\t' ); - - if( stringList.count() == 0 ){ - return; - } - - mTitleLabel->setText( stringList.first() ); - - if( stringList.first() != stringList.last() ){ - //mTipsLabel->setText( stringList.last() ); - mTipsLineEdit->setText( stringList.last() ); - } -} - - -void FmBackupViewItem::init() -{ - QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); - vLayout->setOrientation( Qt::Vertical ); - - mTitleLabel = new HbLabel( "" ); - mTitleLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); - vLayout->addItem( mTitleLabel ); - vLayout->setAlignment( mTitleLabel, Qt::AlignLeft ); - - //mTipsLabel = new HbLabel( "" ); - //mTipsLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) ); - //mTipsLabel->setAlignment( Qt::AlignHCenter ); - - //vLayout->addItem( mTipsLabel ); - //vLayout->setAlignment( mTipsLabel, Qt::AlignLeft ); - - mTipsLineEdit = new HbLineEdit( "" ); - mTipsLineEdit->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) ); - //mTipsLineEdit->setAlignment( Qt::AlignHCenter ); - mTipsLineEdit->setReadOnly( true ); - - vLayout->addItem( mTipsLineEdit ); - vLayout->setAlignment( mTipsLineEdit, Qt::AlignLeft ); - - setLayout( vLayout ); -} - -//FmRestoreViewItem -FmRestoreViewItem::FmRestoreViewItem( QGraphicsItem *parent ) - : mRestoreContentLabel( 0 ), - mDateTimeLabel( 0 ), - mCheckBox( 0 ), - HbListViewItem( parent ) -{ - init(); -} - -FmRestoreViewItem::~FmRestoreViewItem() -{ -} - - -HbAbstractViewItem *FmRestoreViewItem::createItem() -{ - return new FmRestoreViewItem( parentItem() ); -} - -void FmRestoreViewItem::polish(HbStyleParameters& params) -{ - Q_UNUSED(params); -} - -void FmRestoreViewItem::updateChildItems() -{ - QString string = modelIndex().data( Qt::DisplayRole ).toString(); - - QStringList stringList = string.split( '\t' ); - - if( stringList.count() == 0 ){ - return; - } - - mRestoreContentLabel->setText( stringList.first() ); - - if( stringList.first() != stringList.last() ){ - mDateTimeLabel->setText( stringList.last() ); - } - -} - - -void FmRestoreViewItem::init() -{ - QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout(); - hLayout->setOrientation( Qt::Horizontal ); - - mCheckBox = new HbCheckBox( this ); - hLayout->addItem( mCheckBox ); - hLayout->setAlignment( mCheckBox, Qt::AlignVCenter ); - - QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(); - vLayout->setOrientation( Qt::Vertical ); - - mRestoreContentLabel = new HbLabel(""); - mRestoreContentLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) ); - vLayout->addItem( mRestoreContentLabel ); - vLayout->setAlignment( mRestoreContentLabel, Qt::AlignLeft ); - - mDateTimeLabel = new HbLabel(""); - mDateTimeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) ); - vLayout->addItem( mDateTimeLabel ); - vLayout->setAlignment( mDateTimeLabel, Qt::AlignLeft ); - - HbWidget *textWidget = new HbWidget(); - textWidget->setLayout(vLayout); - - hLayout->addItem( textWidget ); - hLayout->setAlignment( textWidget, Qt::AlignVCenter ); - - setLayout( hLayout ); - -} - -void FmRestoreViewItem::setCheckBoxState() -{ - if ( mCheckBox->checkState() == Qt::Unchecked ){ - mCheckBox->setCheckState( Qt::Checked ); - setSelected( true ); - } - else if( mCheckBox->checkState() == Qt::Checked ){ - mCheckBox->setCheckState( Qt::Unchecked ); - setSelected( false ); - } -} diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmbackupviewitem.h --- a/filemanager/src/filemanager/src/backuprestore/fmbackupviewitem.h Fri May 14 15:42:43 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * - * Description: - * The header file of the back up view list item of file manager - */ - -#ifndef FMBACKUPVIEWITEM_H -#define FMBACKUPVIEWITEM_H - -#include - -class HbLabel; -class HbCheckBox; -class HbLineEdit; - -class FmBackupViewItem : public HbListViewItem -{ - Q_OBJECT - -public: - FmBackupViewItem( QGraphicsItem *parent = 0 ); - ~FmBackupViewItem(); - -public: - virtual HbAbstractViewItem *createItem(); - virtual void updateChildItems(); -private: - virtual void polish(HbStyleParameters& params); - -private: - void init(); - -private: - HbLabel *mTitleLabel; - //HbLabel *mTipsLabel; - HbLineEdit *mTipsLineEdit; -}; - -//FmRestoreViewItem -class FmRestoreViewItem : public HbListViewItem -{ - Q_OBJECT - -public: - FmRestoreViewItem( QGraphicsItem *parent = 0 ); - ~FmRestoreViewItem(); - -public: - virtual HbAbstractViewItem *createItem(); - virtual void updateChildItems(); - void setCheckBoxState(); - -private: - virtual void polish(HbStyleParameters& params); - -private: - void init(); - -private: - HbLabel *mRestoreContentLabel; - HbLabel *mDateTimeLabel; - - HbCheckBox *mCheckBox; -}; - -#endif diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp Thu May 27 12:45:43 2010 +0300 @@ -49,30 +49,24 @@ void FmBackupWidget::on_list_released( const QModelIndex &index ) { - if( mListReleased == true ) { - return; - } - mListReleased = true; HbDataFormModelItem *item = mModel->itemFromIndex(index); if( item != mLastPressedItem || mDataForm->isScrolling() || mScrolled ) { mScrolled = false; - mListReleased = false; return; } mScrolled = false; if( item == mContentsItem ){ - ChangeContents(); + emit changeContents(); } else if( item == mTargetItem ){ - ChangeTargetDrive(); + emit changeTargetDrive(); } else if( item == mSchedulingItem ){ - ChangeScheduling(); + emit changeScheduling(); } else if( item == mWeekdayItem ){ - ChangeWeekday(); + emit changeWeekday(); } else if( item == mTimeItem ){ - ChangeTime(); + emit changeTime(); } - mListReleased = false; } void FmBackupWidget::on_list_pressed( const QModelIndex &index ) @@ -110,7 +104,13 @@ connect( this, SIGNAL( doModelRefresh() ), this, SLOT( refreshModel() ), Qt::QueuedConnection ); - + + connect( this, SIGNAL(changeContents()), this, SLOT(on_changeContents()), Qt::QueuedConnection); + connect( this, SIGNAL(changeScheduling()), this, SLOT(on_changeScheduling()), Qt::QueuedConnection); + connect( this, SIGNAL(changeWeekday()), this, SLOT(on_changeWeekday()), Qt::QueuedConnection); + connect( this, SIGNAL(changeTime()), this, SLOT(on_changeTime()), Qt::QueuedConnection); + connect( this, SIGNAL(changeTargetDrive()), this, SLOT(on_changeTargetDrive()), Qt::QueuedConnection); + //mBackupSettings = new FmBackupSettings(); mBackupSettings = FmViewManager::viewManager()->operationService()->backupRestoreHandler()->bkupEngine()->BackupSettingsL(); mBackupSettings->load(); @@ -273,7 +273,7 @@ -void FmBackupWidget::ChangeContents() +void FmBackupWidget::on_changeContents() { QString title = constFileManagerBackupSettingsTitleContents; @@ -294,7 +294,7 @@ } -void FmBackupWidget::ChangeScheduling() +void FmBackupWidget::on_changeScheduling() { QString title = constFileManagerBackupSettingsTitleScheduling; QStringList queryStringList; @@ -316,7 +316,7 @@ } } -void FmBackupWidget::ChangeWeekday() +void FmBackupWidget::on_changeWeekday() { QString title = constFileManagerBackupSettingsTitleWeekday; QStringList queryStringList; @@ -338,7 +338,7 @@ } } -void FmBackupWidget::ChangeTime() +void FmBackupWidget::on_changeTime() { QString title = constFileManagerBackupSettingsTitleTime; QTime queryTime = mBackupSettings->time(); @@ -351,7 +351,7 @@ } -void FmBackupWidget::ChangeTargetDrive() +void FmBackupWidget::on_changeTargetDrive() { QString title = constFileManagerBackupSettingsTitleTargetDrive; QStringList queryStringList; diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h --- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.h Thu May 27 12:45:43 2010 +0300 @@ -39,6 +39,11 @@ signals: void doModelRefresh(); + void changeContents(); + void changeScheduling(); + void changeWeekday(); + void changeTime(); + void changeTargetDrive(); private slots: void on_list_released( const QModelIndex &index ); @@ -46,18 +51,18 @@ void on_list_scrollingStarted(); void refreshModel(); + + void on_changeContents(); + void on_changeScheduling(); + void on_changeWeekday(); + void on_changeTime(); + void on_changeTargetDrive(); private: void initModel(); void init(); void expandAllGroup(); - - void ChangeContents(); - void ChangeScheduling(); - void ChangeWeekday(); - void ChangeTime(); - void ChangeTargetDrive(); private: diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.cpp Thu May 27 12:45:43 2010 +0300 @@ -38,8 +38,7 @@ initMainWidget(); initToolBar(); - initMenu(); - adjustActions(); + initMenu(); mOperationService = FmViewManager::viewManager()->operationService(); QMetaObject::connectSlotsByName( this ); @@ -64,6 +63,7 @@ mDeleteAction->setObjectName( "deleteAction" ); mDeleteAction->setText( hbTrId( "Delete backups" ) ); menu()->addAction( mDeleteAction ); + mDeleteAction->setEnabled(false); } void FmDeleteBackupView::initMainWidget() @@ -71,16 +71,30 @@ mDeleteBackupWidget = new FmDeleteBackupWidget( this ); mDeleteBackupWidget->setObjectName( "deleteBackupWidget" ); setWidget( mDeleteBackupWidget ); + connect(mDeleteBackupWidget, SIGNAL(stateChanged(int)), this, SLOT(on_deleteBackupWidget_stateChanged(int))); } +void FmDeleteBackupView::on_deleteBackupWidget_stateChanged(int state) +{ + Q_UNUSED(state); + QList items = mDeleteBackupWidget->selectionIndexes(); + if (items.count() > 0) { + mLeftAction->setEnabled(true); + mDeleteAction->setEnabled(true); + } else { + mLeftAction->setEnabled(false); + mDeleteAction->setEnabled(false); + } +} + void FmDeleteBackupView::initToolBar() { mLeftAction = new HbAction( this ); mLeftAction->setObjectName( "leftAction" ); mLeftAction->setText( hbTrId( "delete" ) ); toolBar()->addAction( mLeftAction ); - + mLeftAction->setEnabled(false); toolBar()->setOrientation( Qt::Horizontal ); //action = new HbAction( this ); @@ -121,18 +135,7 @@ mOperationService->syncDeleteBackup( selection ); mDeleteBackupWidget->refresh(); - adjustActions(); -} - -void FmDeleteBackupView::adjustActions() -{ - if( mDeleteBackupWidget->backupDataCount() > 0 ) { - mDeleteAction->setDisabled( false ); - mLeftAction->setDisabled( false ); - } else { - mDeleteAction->setDisabled( true ); - mLeftAction->setDisabled( true ); - } + on_deleteBackupWidget_stateChanged(0); } void FmDeleteBackupView::removeToolBarAction() diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupview.h Thu May 27 12:45:43 2010 +0300 @@ -38,6 +38,7 @@ private slots: void on_leftAction_triggered(); void on_deleteAction_triggered(); + void on_deleteBackupWidget_stateChanged(int state); #ifdef FM_CHANGE_ORIENT_ENABLE void on_rotateAction_triggered(); #endif @@ -45,9 +46,7 @@ private: void initMenu(); void initMainWidget(); - void initToolBar(); - void adjustActions(); - + void initToolBar(); void removeToolBarAction(); private: diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp Thu May 27 12:45:43 2010 +0300 @@ -48,6 +48,15 @@ mListView->setModel( 0 ); loadData(); mListView->setModel( mModel ); + mItemList.clear(); + for (int i = 0; i < mModel->rowCount(); ++i) { + QModelIndex index = mModel->index(i); + mRestoreViewItem = static_cast< FmRestoreViewItem* > + (mListView->itemByIndex(index)); + connect(mRestoreViewItem, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int))); + mItemList.push_back(mRestoreViewItem); + + } } QList FmDeleteBackupWidget::selectionIndexes() { @@ -112,6 +121,7 @@ mListView->setModel( mModel ); mListView->setItemPrototype( new FmRestoreViewItem( this ) ); + } diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h --- a/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.h Thu May 27 12:45:43 2010 +0300 @@ -25,6 +25,7 @@ class QStringListModel; class FmRestoreSettings; class FmBackupConfigLoader; +class FmRestoreViewItem; class FmDeleteBackupWidget : public HbWidget { @@ -37,6 +38,8 @@ void refresh(); QList selectionIndexes(); int backupDataCount(); +signals: + void stateChanged(int state); private: void loadData(); void init(); @@ -51,6 +54,8 @@ FmRestoreSettings *mRestoreSettings; FmBackupConfigLoader *mBackupConfigLoader; + FmRestoreViewItem *mRestoreViewItem; + QList mItemList; }; #endif diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Thu May 27 12:45:43 2010 +0300 @@ -37,8 +37,7 @@ initMainWidget(); initToolBar(); - initMenu(); - adjustActions(); + initMenu(); mOperationService = FmViewManager::viewManager()->operationService(); QMetaObject::connectSlotsByName( this ); @@ -63,6 +62,7 @@ mRestoreAction->setObjectName( "restoreAction" ); mRestoreAction->setText( hbTrId( "Restore data" ) ); menu()->addAction( mRestoreAction ); + mRestoreAction->setEnabled(false); } void FmRestoreView::initMainWidget() @@ -70,6 +70,7 @@ mRestoreWigdet = new FmRestoreWigdet( this ); setWidget( mRestoreWigdet ); + connect(mRestoreWigdet, SIGNAL(stateChanged(int)), this, SLOT(onCheckBoxStateChange())); } @@ -79,7 +80,7 @@ mLeftAction->setObjectName( "leftAction" ); mLeftAction->setText( hbTrId( "Restore" ) ); toolBar()->addAction( mLeftAction ); - + mLeftAction->setEnabled(false); toolBar()->setOrientation( Qt::Horizontal ); } @@ -126,19 +127,19 @@ on_leftAction_triggered(); } -void FmRestoreView::adjustActions() -{ - if( mRestoreWigdet->backupDataCount() > 0 ) { - mRestoreAction->setDisabled( false ); - mLeftAction->setDisabled( false ); - } else { - mRestoreAction->setDisabled( true ); - mLeftAction->setDisabled( true ); - } -} - void FmRestoreView::removeToolBarAction() { toolBar()->removeAction( mLeftAction ); } +void FmRestoreView::onCheckBoxStateChange() +{ + QList items = mRestoreWigdet->selectionIndexes(); + if (items.count() > 0) { + mLeftAction->setEnabled(true); + mRestoreAction->setEnabled(true); + } else { + mLeftAction->setEnabled(false); + mRestoreAction->setEnabled(false); + } +} diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmrestoreview.h --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.h Thu May 27 12:45:43 2010 +0300 @@ -37,6 +37,7 @@ private slots: void on_leftAction_triggered(); void on_restoreAction_triggered(); + void onCheckBoxStateChange(); #ifdef FM_CHANGE_ORIENT_ENABLE void on_rotateAction_triggered(); #endif @@ -44,9 +45,7 @@ private: void initMenu(); void initMainWidget(); - void initToolBar(); - void adjustActions(); - + void initToolBar(); void removeToolBarAction(); private: diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.cpp Thu May 27 12:45:43 2010 +0300 @@ -29,10 +29,11 @@ : HbListViewItem( parent ), mRestoreContentLabel( 0 ), mDateTimeLabel( 0 ), - mCheckBox( 0 ) - + mCheckBox( 0 ), + hLayout( 0 ), + mParentWidget((HbWidget *)parent) { - init(); + //init(); } FmRestoreViewItem::~FmRestoreViewItem() @@ -42,7 +43,7 @@ HbAbstractViewItem *FmRestoreViewItem::createItem() { - return new FmRestoreViewItem( parentItem() ); + return new FmRestoreViewItem( *this ); } void FmRestoreViewItem::polish(HbStyleParameters& params) @@ -52,6 +53,9 @@ void FmRestoreViewItem::updateChildItems() { + if( !hLayout ) { + init(); + } QString string = modelIndex().data( Qt::DisplayRole ).toString(); QStringList stringList = string.split( '\t' ); @@ -65,15 +69,17 @@ if( stringList.first() != stringList.last() ){ mDateTimeLabel->setPlainText( stringList.last() ); } + connect(this, SIGNAL(stateChanged(int)), mParentWidget, SIGNAL(stateChanged(int))); } void FmRestoreViewItem::init() { - QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout(); + hLayout = new QGraphicsLinearLayout(); hLayout->setOrientation( Qt::Horizontal ); - + hLayout->addItem(layout()); + mCheckBox = new HbCheckBox( this ); hLayout->addItem( mCheckBox ); hLayout->setAlignment( mCheckBox, Qt::AlignVCenter ); @@ -96,8 +102,8 @@ hLayout->addItem( textWidget ); hLayout->setAlignment( textWidget, Qt::AlignVCenter ); - - setLayout( hLayout ); + connect(mCheckBox, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int))); + setLayout( hLayout ); } @@ -105,12 +111,12 @@ { if ( mCheckBox->checkState() == Qt::Unchecked ){ mCheckBox->setCheckState( Qt::Checked ); - setSelected( true ); + setSelected( true ); } else if( mCheckBox->checkState() == Qt::Checked ){ mCheckBox->setCheckState( Qt::Unchecked ); setSelected( false ); - } + } } bool FmRestoreViewItem::getCheckBoxState() @@ -121,3 +127,4 @@ return true; } } + diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h --- a/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreviewitem.h Thu May 27 12:45:43 2010 +0300 @@ -24,7 +24,8 @@ class HbLabel; class HbCheckBox; class HbLineEdit; - +class QGraphicsLinearLayout; +class HbWidget; //FmRestoreViewItem class FmRestoreViewItem : public HbListViewItem { @@ -32,13 +33,16 @@ public: FmRestoreViewItem( QGraphicsItem *parent = 0 ); - ~FmRestoreViewItem(); + ~FmRestoreViewItem(); public: virtual HbAbstractViewItem *createItem(); virtual void updateChildItems(); void setCheckBoxState(); bool getCheckBoxState(); +signals: + void stateChanged(int); + private: virtual void polish(HbStyleParameters& params); @@ -51,6 +55,8 @@ HbLabel *mDateTimeLabel; HbCheckBox *mCheckBox; + QGraphicsLinearLayout *hLayout; + HbWidget *mParentWidget; }; #endif diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp --- a/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.cpp Thu May 27 12:45:43 2010 +0300 @@ -96,8 +96,7 @@ ++index; } - mListView->setItemPrototype( new FmRestoreViewItem( this ) ); - + mListView->setItemPrototype( new FmRestoreViewItem(this) ); } void FmRestoreWigdet::on_list_activated( const QModelIndex &index ) @@ -105,8 +104,7 @@ FmRestoreViewItem *restoreViewItem = static_cast< FmRestoreViewItem* > ( mListView->itemByIndex( index ) ); - restoreViewItem->setCheckBoxState(); - emit checkStatusChanged(); + restoreViewItem->setCheckBoxState(); } int FmRestoreWigdet::backupDataCount() diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h --- a/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/backuprestore/fmrestorewidget.h Thu May 27 12:45:43 2010 +0300 @@ -39,8 +39,8 @@ private: void init(); -signals: - void checkStatusChanged(); +signals: + void stateChanged(int state); private slots: void on_list_activated( const QModelIndex &index ); diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/components/fmdialog.cpp --- a/filemanager/src/filemanager/src/components/fmdialog.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdialog.cpp Thu May 27 12:45:43 2010 +0300 @@ -36,3 +36,52 @@ mRetAction = action; mEventLoop.exit(); } + +HbAction *FmDialog::primaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 0) { + return (HbAction *)(actionList.at(0)); + } else { + return 0; + } + +} + +void FmDialog::setPrimaryAction( HbAction *action ) +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + actionList.clear(); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(0); + actionList.insert(0, action); + } +} + +HbAction *FmDialog::secondaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 1) { + return (HbAction *)(actionList.at(1)); + } else { + return 0; + } +} + +void FmDialog::setSecondaryAction( HbAction *action ) +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + QGraphicsWidget::addAction(new HbAction(hbTrId("Ok"))); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(1); + actionList.insert(1, action); + } +} diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/components/fmdialog.h --- a/filemanager/src/filemanager/src/components/fmdialog.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/components/fmdialog.h Thu May 27 12:45:43 2010 +0300 @@ -30,6 +30,12 @@ public: explicit FmDialog( QGraphicsItem *parent = 0 ); HbAction *exec(); + + HbAction *primaryAction() const; + void setPrimaryAction( HbAction *action ); + + HbAction *secondaryAction() const; + void setSecondaryAction( HbAction *action ); public slots: void dialogClosed(HbAction *action); private: diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/fmfilebrowsewidget.cpp --- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp Thu May 27 12:45:43 2010 +0300 @@ -694,10 +694,11 @@ { QString filePath = mModel->filePath( mCurrentItem->modelIndex() ); QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() ); - + int maxFileNameLength = FmUtils::getMaxFileNameLength(); + QString newName( fileInfo.fileName() ); - - while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true ) ){ + while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true, + maxFileNameLength, QString() , false ) ){ QString newTargetPath = FmUtils::fillPathWithSplash( fileInfo.absolutePath() ) + newName; QFileInfo newFileInfo( newTargetPath ); @@ -705,7 +706,14 @@ HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( newName ) ); continue; } - + if( !FmUtils::checkFolderFileName( newName ) ) { + HbMessageBox::information( hbTrId( "Invalid file or folder name, try again!" ) ); + continue; + } + if( !FmUtils::checkMaxPathLength( newTargetPath ) ) { + HbMessageBox::information( hbTrId( "the path you specified is too long, try again!" ) ); + continue; + } if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) { HbMessageBox::information( hbTrId("Rename failed!") ); } diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/fmfileview.cpp --- a/filemanager/src/filemanager/src/fmfileview.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/fmfileview.cpp Thu May 27 12:45:43 2010 +0300 @@ -389,29 +389,29 @@ QDir dir( path ); if( dir.exists() ) { while( FmDlgUtils::showTextQuery( hbTrId( "Enter name for " ), dirName, - true, maxFileNameLength, associatedDrive , false ) ){ - QString newTargetPath = FmUtils::fillPathWithSplash( - dir.absolutePath() ) + dirName; - QFileInfo newFileInfo( newTargetPath ); - if( !FmUtils::checkFolderFileName( dirName ) ) { - HbMessageBox::information( hbTrId( "Invalid file or folder name!" ) ); - continue; - } - if( !FmUtils::checkMaxPathLength( newTargetPath ) ) { - HbMessageBox::information( hbTrId( "the path you specified is too long!" ) ); - continue; - } - if( newFileInfo.exists() ) { - HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( dirName ) ); - continue; - } - - if( !dir.mkdir( dirName ) ) { - HbMessageBox::information( hbTrId("Operation failed!") ); - } - refreshModel( path ); - break; + true, maxFileNameLength, associatedDrive , false ) ){ + QString newTargetPath = FmUtils::fillPathWithSplash( + dir.absolutePath() ) + dirName; + QFileInfo newFileInfo( newTargetPath ); + if( !FmUtils::checkFolderFileName( dirName ) ) { + HbMessageBox::information( hbTrId( "Invalid file or folder name!" ) ); + continue; + } + if( !FmUtils::checkMaxPathLength( newTargetPath ) ) { + HbMessageBox::information( hbTrId( "the path you specified is too long!" ) ); + continue; } + if( newFileInfo.exists() ) { + HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( dirName ) ); + continue; + } + + if( !dir.mkdir( dirName ) ) { + HbMessageBox::information( hbTrId("Operation failed!") ); + } + refreshModel( path ); + break; + } } } diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopy.cpp Thu May 27 12:45:43 2010 +0300 @@ -19,6 +19,7 @@ #include "fmcommon.h" #include "fmoperationbase.h" #include "fmdrivedetailstype.h" +#include "fmutils.h" #include #include @@ -96,7 +97,7 @@ } destFi.setFile( destFi.absoluteFilePath() ); } else { - emit askForRename( destFi.absoluteFilePath(), &newName ); + queryForRename( destFi.absoluteFilePath(), &newName ); if( newName.isEmpty() ) { ret = FmErrCancel; break; @@ -106,7 +107,7 @@ } } else{ // destination is dir - emit askForRename( destFi.absoluteFilePath(), &newName ); + queryForRename( destFi.absoluteFilePath(), &newName ); if( newName.isEmpty() ) { ret = FmErrCancel; break; @@ -155,7 +156,7 @@ *mErrString = source; ret = FmErrCannotCopy; } else { - IncreaseProgress( fileSize ); + increaseProgress( fileSize ); } } else if (fi.isDir()) { ret = copyDirInsideContent( source, newName ); @@ -171,18 +172,21 @@ int FmOperationCopy::copyDirInsideContent( const QString &srcPath, const QString &destPath ) { - if( destPath.contains( srcPath, Qt::CaseInsensitive ) ) { + QFileInfo srcInfo( srcPath ); + QFileInfo destInfo( destPath ); + + QString destUpPath = FmUtils::fillPathWithSplash( destInfo.absolutePath() ); + if( destUpPath.contains( srcPath, Qt::CaseInsensitive ) ) { *mErrString = destPath; return FmErrCopyDestToSubFolderInSrc; } - QFileInfo srcInfo( srcPath ); + if( !srcInfo.isDir() || !srcInfo.exists() ) { *mErrString = srcPath; return FmErrSrcPathDoNotExist; } - - QFileInfo destInfo( destPath ); + if( !destInfo.exists() ) { if( !destInfo.dir().mkdir( destInfo.absoluteFilePath() ) ) { *mErrString = destPath; @@ -210,7 +214,7 @@ *mErrString = fileInfo.absoluteFilePath(); return FmErrCannotCopy; } - IncreaseProgress( fileInfo.size() ); + increaseProgress( fileInfo.size() ); } else if( fileInfo.isDir() ) { //makedir QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() ); @@ -235,7 +239,7 @@ return FmErrNone; } -void FmOperationCopy::IncreaseProgress( quint64 size ) +void FmOperationCopy::increaseProgress( quint64 size ) { if( mTotalSize <=0 ) { return; @@ -247,3 +251,8 @@ emit notifyProgress( mCurrentStep ); } } + +void FmOperationCopy::queryForRename( const QString &srcFile, QString *destFile ) +{ + emit askForRename( srcFile, destFile ); +} diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationcopy.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationcopy.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopy.h Thu May 27 12:45:43 2010 +0300 @@ -36,6 +36,7 @@ signals: void askForRename( const QString &srcFile, QString *destFile ); void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); + void showNote( const char *note ); void notifyPreparing( bool cancelable ); void notifyStart( bool cancelable, int maxSteps ); void notifyProgress( int currentStep ); @@ -43,7 +44,8 @@ private: int copy( const QString &source, const QString &targetPath, const QString &newTargetName = QString() ); int copyDirInsideContent( const QString &srcPath, const QString &destPath ); - void IncreaseProgress( quint64 size ); + void increaseProgress( quint64 size ); + void queryForRename( const QString &srcFile, QString *destFile ); private: QStringList mSourceList; diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationmove.cpp Thu May 27 12:45:43 2010 +0300 @@ -95,7 +95,7 @@ } destFi.setFile( destFi.absoluteFilePath() ); } else { - emit askForRename( destFi.absoluteFilePath(), &newName ); + queryForRename( destFi.absoluteFilePath(), &newName ); if( newName.isEmpty() ) { ret = FmErrCancel; break; @@ -105,7 +105,7 @@ } } else{ // destination is dir - emit askForRename( destFi.absoluteFilePath(), &newName ); + queryForRename( destFi.absoluteFilePath(), &newName ); if( newName.isEmpty() ) { ret = FmErrCancel; break; @@ -155,7 +155,7 @@ *mErrString = source; ret = FmErrCannotRemove; } - IncreaseProgress( fileSize ); + increaseProgress( fileSize ); } else if (fi.isDir()) { if( FmUtils::isDefaultFolder( source ) ){ ret = FmErrRemoveDefaultFolder; @@ -180,18 +180,20 @@ } int FmOperationMove::moveDirInsideContent( const QString &srcPath, const QString &destPath ) { - if( destPath.contains( srcPath, Qt::CaseInsensitive ) ) { + QFileInfo srcInfo( srcPath ); + QFileInfo destInfo( destPath ); + + QString destUpPath = FmUtils::fillPathWithSplash( destInfo.absolutePath() ); + if( destUpPath.contains( srcPath, Qt::CaseInsensitive ) ) { *mErrString = destPath; return FmErrMoveDestToSubFolderInSrc; } - - QFileInfo srcInfo( srcPath ); + if( !srcInfo.isDir() || !srcInfo.exists() ) { *mErrString = srcPath; return FmErrSrcPathDoNotExist; } - - QFileInfo destInfo( destPath ); + if( !destInfo.exists() ) { if( !destInfo.dir().mkdir( destInfo.absoluteFilePath() ) ) { *mErrString = destPath; @@ -223,7 +225,7 @@ *mErrString = fileInfo.absoluteFilePath(); return FmErrCannotRemove; } - IncreaseProgress( fileSize ); + increaseProgress( fileSize ); } else if( fileInfo.isDir() ) { //makedir QString newDirPath = destPath + fileInfo.absoluteFilePath().mid( srcPath.length() ); @@ -256,7 +258,7 @@ return FmErrNone; } -void FmOperationMove::IncreaseProgress( quint64 size ) +void FmOperationMove::increaseProgress( quint64 size ) { if( mTotalSize <=0 ) { return; @@ -269,4 +271,7 @@ } } - +void FmOperationMove::queryForRename( const QString &srcFile, QString *destFile ) +{ + emit askForRename( srcFile, destFile ); +} diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationmove.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationmove.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationmove.h Thu May 27 12:45:43 2010 +0300 @@ -35,6 +35,7 @@ signals: void askForRename( const QString &srcFile, QString *destFile ); void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); + void showNote( const QString ¬eString ); void notifyPreparing( bool cancelable ); void notifyStart( bool cancelable, int maxSteps ); void notifyProgress( int currentStep ); @@ -42,7 +43,8 @@ private: int move( const QString &source, const QString &targetPath, const QString &newTargetName = QString() ); int moveDirInsideContent( const QString &srcPath, const QString &destPath ); - void IncreaseProgress( quint64 size ); + void increaseProgress( quint64 size ); + void queryForRename( const QString &srcFile, QString *destFile ); private: QStringList mSourceList; diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp Thu May 27 12:45:43 2010 +0300 @@ -21,10 +21,12 @@ #include "fmviewdetailsdialog.h" #include "fmdlgutils.h" #include "fmutils.h" - +#include #include #include #include +#include +#include FmOperationResultProcesser::FmOperationResultProcesser( FmOperationService *operationService ) : mOperationService( operationService ), mNote( 0 ) @@ -39,11 +41,30 @@ FmOperationBase* operationBase, const QString &srcFile, QString *destFile ) { Q_UNUSED( operationBase ); + int maxFileNameLength = FmUtils::getMaxFileNameLength(); QString questionText = QString( "file " ) + srcFile + QString( " already exist, please rename:" ); - QString value; - FmDlgUtils::showTextQuery( questionText, value, true ); + QString value; + QFileInfo fileInfo(srcFile); + while (FmDlgUtils::showTextQuery( questionText, value, true, maxFileNameLength, QString(), false )) { + 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; + } + if( !FmUtils::checkMaxPathLength( newTargetPath ) ) { + HbMessageBox::information( hbTrId( "the path you specified is too long, try again!" ) ); + continue; + } + if (newFileInfo.exists()) { + HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( value ) ); + continue; + } + break; + } *destFile = value; } @@ -62,6 +83,11 @@ } } +void FmOperationResultProcesser::onShowNote( FmOperationBase* operationBase, const char *noteString ) +{ + HbMessageBox::information(hbTrId(noteString)); +} + void FmOperationResultProcesser::onNotifyWaiting( FmOperationBase* operationBase, bool cancelable ) { QString title = tr("Operation"); @@ -238,11 +264,14 @@ case FmErrCorrupt: HbMessageBox::information( QString( hbTrId("Operation failed because target media is corrupted!") ) ); return; - case FmErrNotReady: + case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup HbMessageBox::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!") ) ); + return; case FmErrDiskFull: - HbMessageBox::information( QString( hbTrId("Not enough space. Operation cancelled.!")) ); + HbMessageBox::information( QString( hbTrId("Not enough space. Operation cancelled!")) ); return; case FmErrCopyDestToSubFolderInSrc: HbMessageBox::information( QString( hbTrId("Can not copy to sub folder!")) ); @@ -321,11 +350,15 @@ // } else { // mNote->setProgressDialogType( HbProgressDialog::WaitNote ); // } - mNote->setText( title ); - if( !cancelable ) - mNote->primaryAction()->setDisabled( true ); - else - mNote->primaryAction()->setDisabled( false ); + QList actionList = mNote->actions(); + if (actionList.size() > 0) { + QAction *cancelAction = actionList.at(0); + if (!cancelable) { + cancelAction->setDisabled( true ); + } else { + cancelAction->setDisabled( false ); + } + } mNote->open(); } @@ -351,12 +384,15 @@ mNote->setMaximum( 65535 ); mNote->setProgressValue( 0 ); mNote->setText( title ); - if( !cancelable ){ - mNote->primaryAction()->setDisabled( true ); - } - else{ - mNote->primaryAction()->setDisabled( false ); - } + QList actionList = mNote->actions(); + if (actionList.size() > 0) { + QAction *cancelAction = actionList.at(0); + if (!cancelable) { + cancelAction->setDisabled( true ); + } else { + cancelAction->setDisabled( false ); + } + } mNote->open(); } @@ -383,14 +419,15 @@ mNote->setMaximum( maxValue ); mNote->setProgressValue( 0 ); - - if( !cancelable ){ - mNote->primaryAction()->setDisabled( true ); - } - else{ - mNote->primaryAction()->setDisabled( false ); - } - + QList actionList = mNote->actions(); + if (actionList.size() > 0) { + QAction *cancelAction = actionList.at(0); + if(!cancelable) { + cancelAction->setDisabled( true ); + } else { + cancelAction->setDisabled( false ); + } + } mNote->open(); } diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.h Thu May 27 12:45:43 2010 +0300 @@ -33,6 +33,7 @@ void onAskForRename( FmOperationBase* operationBase, const QString &srcFile, QString *destFile ); void onAskForReplace( FmOperationBase* operationBase, const QString &srcFile, const QString &destFile, bool *isAccepted ); + void onShowNote( FmOperationBase* operationBase, const char *noteString ); void onNotifyWaiting( FmOperationBase* operationBase, bool cancelable ); void onNotifyPreparing( FmOperationBase* operationBase, bool cancelable ); void onNotifyStart( FmOperationBase* operationBase, bool cancelable, int maxSteps ); diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp Thu May 27 12:45:43 2010 +0300 @@ -293,6 +293,10 @@ { emit refreshModel( mCurrentOperation, path ); } +void FmOperationService::on_operationThread_showNote( const char *noteString ) +{ + mOperationResultProcesser->onShowNote( mCurrentOperation, noteString ); +} void FmOperationService::on_operationThread_notifyWaiting( bool cancelable ) { mOperationResultProcesser->onNotifyWaiting( diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationservice.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.h Thu May 27 12:45:43 2010 +0300 @@ -95,6 +95,7 @@ void on_operationThread_askForRename( const QString &srcFile, QString *destFile ); void on_operationThread_askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void on_operationThread_refreshModel( const QString &path ); + void on_operationThread_showNote( const char *noteString ); void on_operationThread_notifyWaiting( bool cancelable ); void on_operationThread_notifyPreparing( bool cancelable ); void on_operationThread_notifyStart( bool cancelable, int maxSteps ); diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp --- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.cpp Thu May 27 12:45:43 2010 +0300 @@ -51,6 +51,8 @@ this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ), this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection ); + connect( mOperationBase, SIGNAL( showNote( QString ) ), + this, SLOT( onShowNote( QString )), Qt::BlockingQueuedConnection ); start(); return FmErrNone; @@ -69,6 +71,8 @@ this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ), this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection ); + connect( mOperationBase, SIGNAL( showNote( QString ) ), + this, SLOT( onShowNote( QString )), Qt::BlockingQueuedConnection ); start(); @@ -144,6 +148,12 @@ { emit askForReplace( srcFile, destFile, isAccepted ); } + +void FmOperationThread::onShowNote( const char *noteString ) +{ + emit showNote( noteString ); +} + void FmOperationThread::on_operationElement_notifyPreparing( bool cancelable ) { emit notifyPreparing( cancelable ); @@ -167,6 +177,7 @@ { mErrString.clear(); FmOperationCopy *operationCopy = static_cast(mOperationBase); + QString refreshDestPath = QFileInfo( operationCopy->targetPath() ).dir().absolutePath(); int ret = operationCopy->start( &mStop, &mErrString ); switch( ret ) @@ -176,6 +187,7 @@ break; case FmErrNone: emit notifyFinish(); + emit refreshModel( refreshDestPath ); break; default: emit notifyError( ret, mErrString ); diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/filemanager/src/operationservice/fmoperationthread.h --- a/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/filemanager/src/operationservice/fmoperationthread.h Thu May 27 12:45:43 2010 +0300 @@ -55,6 +55,7 @@ void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); void refreshModel( const QString &path ); + void showNote( const QString ¬eString ); void notifyWaiting( bool cancelable ); void notifyPreparing( bool cancelable ); // this step could not be used if not needed. void notifyStart( bool cancelable, int maxSteps ); @@ -67,6 +68,7 @@ private slots: void onAskForRename( const QString &srcFile, QString *destFile ); void onAskForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ); + void onShowNote( const char *noteString ); void on_operationElement_notifyPreparing( bool cancelable ); void on_operationElement_notifyStart( bool cancelable, int maxSteps ); void on_operationElement_notifyProgress( int currentStep ); diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp --- a/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp Thu May 27 12:45:43 2010 +0300 @@ -435,6 +435,8 @@ return FmErrCorrupt; case KErrNotReady: return FmErrNotReady; + case KErrDisMounted: + return FmErrDisMounted; default: return FmErrUnKnown; } diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp --- a/filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp Thu May 27 12:45:43 2010 +0300 @@ -30,7 +30,7 @@ connect( d, SIGNAL( notifyStart( bool, int ) ), this, SIGNAL( notifyStart( bool, int ) ) ); connect( d, SIGNAL( notifyUpdate(int) ), this, SIGNAL( notifyUpdate(int) ) ); connect( d, SIGNAL( notifyFinish(int) ), - this, SIGNAL( notifyFinish(int) ) ); + this, SIGNAL( notifyFinish(int) ), Qt::DirectConnection ); connect( d, SIGNAL( notifyMemoryLow(int, int& ) ), this, SIGNAL( notifyMemoryLow(int, int&) ) ); connect( d, SIGNAL( notifyBackupFilesExist( bool& )), this, SIGNAL( notifyBackupFilesExist( bool&) ) ); } diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/fmfiledialog/src/fmfiledialog.cpp --- a/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/fmfiledialog/src/fmfiledialog.cpp Thu May 27 12:45:43 2010 +0300 @@ -152,3 +152,55 @@ d_ptr->setRetAction( action ); d_ptr->eventLoop().exit(); } + + +HbAction *FmFileDialog::primaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 0) { + return (HbAction *)(actionList.at(0)); + } else { + return 0; + } + +} + +void FmFileDialog::setPrimaryAction( HbAction *action ) +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + actionList.clear(); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(0); + actionList.insert(0, action); + } +} + +HbAction *FmFileDialog::secondaryAction() const +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() > 1) { + return (HbAction *)(actionList.at(1)); + } else { + return 0; + } +} + +void FmFileDialog::setSecondaryAction( HbAction *action ) +{ + QList actionList = QGraphicsWidget::actions(); + if (actionList.size() == 0) { + QGraphicsWidget::addAction(new HbAction(hbTrId("Ok"))); + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 1) { + QGraphicsWidget::addAction(action); + } else if (actionList.size() == 2) { + actionList.removeAt(1); + actionList.insert(1, action); + } + +} + diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/inc/commonutils.pri --- a/filemanager/src/inc/commonutils.pri Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/inc/commonutils.pri Thu May 27 12:45:43 2010 +0300 @@ -45,4 +45,4 @@ } HEADERS += $$INTERNAL_HEADERS -SOURCES += $$INTERNAL_SOURCES \ No newline at end of file +SOURCES += $$INTERNAL_SOURCES diff -r edd66bde63a4 -r 15299bc55001 filemanager/src/inc/fmdefine.h --- a/filemanager/src/inc/fmdefine.h Fri May 14 15:42:43 2010 +0300 +++ b/filemanager/src/inc/fmdefine.h Thu May 27 12:45:43 2010 +0300 @@ -49,6 +49,7 @@ #define FmErrRemoveDefaultFolder -28 #define FmErrLocked -29 #define FmErrCorrupt -30 +#define FmErrDisMounted -31 #define FmEstimateUpperLimit 90 // available mem/backup size*100%=90%, User selectable continuation #define FmEstimateLowerLimit 10 // available mem/backup size*100%=10%, Backup will be interrupted