filemanager/src/filemanager/src/fmfilebrowsewidget.cpp
changeset 16 ada7962b4308
parent 14 1957042d8c7e
child 18 edd66bde63a4
child 25 b7bfdea70ca2
child 37 15bc28c9dd51
equal deleted inserted replaced
14:1957042d8c7e 16:ada7962b4308
    35 #include <hbtreeview.h>
    35 #include <hbtreeview.h>
    36 #include <hbabstractviewitem.h>
    36 #include <hbabstractviewitem.h>
    37 #include <hbaction.h>
    37 #include <hbaction.h>
    38 #include <hbsearchpanel.h>
    38 #include <hbsearchpanel.h>
    39 #include <hbmessagebox.h>
    39 #include <hbmessagebox.h>
       
    40 #include <hblabel.h>
    40 
    41 
    41 FmFileBrowseWidget::FmFileBrowseWidget( HbWidget *parent, FmFileBrowseWidget::Style style )
    42 FmFileBrowseWidget::FmFileBrowseWidget( HbWidget *parent, FmFileBrowseWidget::Style style )
    42     : HbWidget( parent ),
    43     : HbWidget( parent ),
    43       mTreeView( 0 ),
    44       mTreeView( 0 ),
    44       mListView( 0 ),
    45       mListView( 0 ),
    45       mLayout( 0 ),
    46       mLayout( 0 ),
    46       mModel( 0 ),
    47       mModel( 0 ),
    47       mSelectable( false ), 
    48       mSelectable( false ), 
    48       mStyle( NoStyle ), 
    49       mStyle( NoStyle ), 
       
    50       mFileBrowseStyle( style ),
    49       mCurrentItem( 0 ),
    51       mCurrentItem( 0 ),
    50       mOperationService( 0 ),
    52       mOperationService( 0 ),
    51       mSearchPanel( 0 )
    53       mSearchPanel( 0 )
    52 
       
    53 {
    54 {
    54     initFileModel();
    55     initFileModel();
    55     initListView();
    56     initListView();
    56     initTreeView();
    57     initTreeView();
    57     initSearchPanel();
    58     initSearchPanel();
       
    59     initEmptyTipsLabel();
    58     initLayout();
    60     initLayout();
    59     
    61     
    60     mOperationService = FmViewManager::viewManager()->operationService();
    62     mOperationService = FmViewManager::viewManager()->operationService();
    61     setStyle( style );
    63     setStyle( style );
    62 }
    64 }
    66     //take the model out from view and delete it.
    68     //take the model out from view and delete it.
    67     //so that the model could be destroy earlier
    69     //so that the model could be destroy earlier
    68     //since there is a thread running in background
    70     //since there is a thread running in background
    69     //if the model destroy later, the thread might not quit properly.
    71     //if the model destroy later, the thread might not quit properly.
    70 
    72 
    71     QFileInfo oldFileInfo = mModel->fileInfo( mListView->rootIndex() );
    73     if( mStyle == ListStyle || mStyle == TreeStyle ) {
    72     FmViewManager *viewManager = FmViewManager::viewManager();
    74         QFileInfo oldFileInfo = mModel->fileInfo( mListView->rootIndex() );
    73     if( viewManager ) {
    75         if( oldFileInfo.exists() ) {
    74         viewManager->removeWatchPath( oldFileInfo.absoluteFilePath() );
    76             FmViewManager *viewManager = FmViewManager::viewManager();
       
    77             if( viewManager ) {
       
    78                 viewManager->removeWatchPath( oldFileInfo.absoluteFilePath() );
       
    79             }   
       
    80         }
    75     }
    81     }
    76 
    82 
    77     mTreeView->setModel( 0 );
    83     mTreeView->setModel( 0 );
    78     mListView->setModel( 0 );
    84     mListView->setModel( 0 );
    79     delete mModel;
    85     delete mModel;
   115 void FmFileBrowseWidget::setRootPath( const QString &pathName )
   121 void FmFileBrowseWidget::setRootPath( const QString &pathName )
   116 {
   122 {
   117     QString logString = "FmFileBrowseWidget::setRootPath(" + pathName + ')';
   123     QString logString = "FmFileBrowseWidget::setRootPath(" + pathName + ')';
   118     FmLogger::log( logString );
   124     FmLogger::log( logString );
   119 
   125 
   120     QModelIndex modelIndex = mModel->index( pathName );
   126     if( checkPathAndSetStyle( pathName ) ) {
   121     bool i = QFileInfo(pathName).exists();
   127         mListView->setModel(0);
   122     QString string2; 
   128         mTreeView->setModel(0);
   123     if( i )
   129         delete mModel;
   124         {
   130         mModel = new QDirModel(this);
   125         string2 = QString( "true" ) ;
   131         mListView->setModel(mModel);
   126         }
   132         mTreeView->setModel(mModel);
   127     else
   133         
   128         {
   134         mListView->setRootIndex( mModel->index( pathName ) );
   129         string2 = QString( "false" ) ;
   135         mTreeView->setRootIndex( mModel->index( pathName ) );
   130         }
   136         FmViewManager::viewManager()->addWatchPath( pathName );
   131 
   137     }
   132     logString = "FmFileBrowseWidget::setRootPath exists(" + string2 + ')';
   138     mCurrentDrive = pathName.left( 3 );
   133     FmLogger::log( logString );
       
   134 
       
   135     mModel->refresh(modelIndex);
       
   136     QString string = mModel->fileName( modelIndex );
       
   137     logString = "FmFileBrowseWidget::setRootPath:filename(" + string + ')';
       
   138     FmLogger::log( logString );
       
   139 
       
   140     string  = mModel->filePath( modelIndex );
       
   141     logString = "FmFileBrowseWidget::setRootPath:filepath(" + string + ')';
       
   142     FmLogger::log( logString );
       
   143 
       
   144 
       
   145     FmViewManager::viewManager()->addWatchPath( pathName );
       
   146 
       
   147     mListView->setRootIndex( mModel->index( pathName ) );
       
   148     mTreeView->setRootIndex( mModel->index( pathName ) );
       
   149 }
   139 }
   150 
   140 
   151 void FmFileBrowseWidget::setStyle( FmFileBrowseWidget::Style style )
   141 void FmFileBrowseWidget::setStyle( FmFileBrowseWidget::Style style )
   152 {
   142 {
   153     if ( mStyle == style ) {
   143     if ( mStyle == style ) {
   158         mLayout->removeItem( mListView );
   148         mLayout->removeItem( mListView );
   159         mListView->hide();
   149         mListView->hide();
   160     } else if ( mStyle == TreeStyle ) {
   150     } else if ( mStyle == TreeStyle ) {
   161         mLayout->removeItem( mTreeView );
   151         mLayout->removeItem( mTreeView );
   162         mTreeView->hide();
   152         mTreeView->hide();
   163     } 
   153     } else if( mStyle == LabelStyle ){
       
   154         mLayout->removeItem( mEmptyTipLabel );
       
   155         mEmptyTipLabel->hide();
       
   156     }
   164 
   157 
   165     if ( style == ListStyle ) {
   158     if ( style == ListStyle ) {
   166         mLayout->addItem( mListView );
   159         mLayout->addItem( mListView );
   167         mListView->show();
   160         mListView->show();
       
   161         mFileBrowseStyle = ListStyle;
   168     } else if ( style == TreeStyle ) {
   162     } else if ( style == TreeStyle ) {
   169         mLayout->addItem( mTreeView );
   163         mLayout->addItem( mTreeView );
   170         mTreeView->show();
   164         mTreeView->show();
       
   165         mFileBrowseStyle = TreeStyle;
       
   166     } else if ( style == LabelStyle ){
       
   167         mLayout->addItem( mEmptyTipLabel );
       
   168         mEmptyTipLabel->show();
   171     }
   169     }
   172     
   170     
   173     mStyle = style;
   171     mStyle = style;
   174 }
   172 }
   175 
   173 
   197         selectionModel = mListView->selectionModel();
   195         selectionModel = mListView->selectionModel();
   198     } else if (mStyle == TreeStyle) {
   196     } else if (mStyle == TreeStyle) {
   199         selectionModel = mTreeView->selectionModel();
   197         selectionModel = mTreeView->selectionModel();
   200     }
   198     }
   201 
   199 
   202     selectionModel->clear();
   200     if( selectionModel ){
       
   201         selectionModel->clear();
       
   202     }
       
   203 
   203 }
   204 }
   204 
   205 
   205 
   206 
   206 bool FmFileBrowseWidget::rename( const QString &oldName, const QString &newName )
   207 bool FmFileBrowseWidget::rename( const QString &oldName, const QString &newName )
   207 {
   208 {
   260     HbMenu *contextMenu = new HbMenu();
   261     HbMenu *contextMenu = new HbMenu();
   261     mCurrentItem = item;
   262     mCurrentItem = item;
   262     
   263     
   263     HbAction *viewAction = new HbAction();
   264     HbAction *viewAction = new HbAction();
   264     viewAction->setObjectName( "viewAction" );
   265     viewAction->setObjectName( "viewAction" );
   265     viewAction->setText( tr( "View details" ) );
   266     viewAction->setText( hbTrId( "txt_fmgr_menu_view_details_file" ) );
   266     contextMenu->addAction( viewAction );
   267     contextMenu->addAction( viewAction );
   267 
   268 
   268     connect( viewAction, SIGNAL( triggered() ),
   269     connect( viewAction, SIGNAL( triggered() ),
   269     this, SLOT( on_viewAction_triggered() ) );
   270     this, SLOT( on_viewAction_triggered() ) );
   270 
   271 
   271     //copy
   272     //copy
   272     HbAction *copyAction = new HbAction();
   273     HbAction *copyAction = new HbAction();
   273     copyAction->setObjectName( "copyAction" );
   274     copyAction->setObjectName( "copyAction" );
   274     copyAction->setText( tr( "Copy" ) );
   275     copyAction->setText( hbTrId( "txt_fmgr_menu_copy" ) );
   275     contextMenu->addAction( copyAction );
   276     contextMenu->addAction( copyAction );
   276 
   277 
   277     connect( copyAction, SIGNAL( triggered() ),
   278     connect( copyAction, SIGNAL( triggered() ),
   278     this, SLOT( on_copyAction_triggered() ) );
   279     this, SLOT( on_copyAction_triggered() ) );
   279 
   280 
   280     //Move
   281     
   281     HbAction *moveAction = new HbAction();
   282     QString filePath( mModel->filePath( item->modelIndex() ) );
   282     moveAction->setObjectName( "moveAction" );
   283     QString formatFilePath( FmUtils::formatPath( filePath ) );
   283     moveAction->setText( tr( "Move" ) );
   284     QFileInfo fileInfo( filePath );
   284     contextMenu->addAction( moveAction );
   285     
   285 
   286     if( ( fileInfo.isFile() ) || ( fileInfo.isDir() && !( FmUtils::isDefaultFolder( formatFilePath ) ) ) ){
   286     connect( moveAction, SIGNAL( triggered() ),
   287         //Move
   287     this, SLOT( on_moveAction_triggered() ) );
   288         HbAction *moveAction = new HbAction();
   288 
   289         moveAction->setObjectName( "moveAction" );
   289     //Delete
   290         moveAction->setText( hbTrId( "txt_fmgr_menu_move" ) );
   290     HbAction *deleteAction = new HbAction();
   291         contextMenu->addAction( moveAction );
   291     deleteAction->setObjectName( "deleteAction" );
   292     
   292     deleteAction->setText( tr( "Delete" ) );
   293         connect( moveAction, SIGNAL( triggered() ),
   293     contextMenu->addAction( deleteAction );
   294         this, SLOT( on_moveAction_triggered() ) );
   294 
   295     
   295     connect( deleteAction, SIGNAL( triggered() ),
   296         //Delete
   296     this, SLOT( on_deleteAction_triggered() ) );
   297         HbAction *deleteAction = new HbAction();
   297 
   298         deleteAction->setObjectName( "deleteAction" );
   298     //rename
   299         deleteAction->setText( hbTrId( "txt_fmgr_menu_delete" ) );
   299     HbAction *renameAction = new HbAction();
   300         contextMenu->addAction( deleteAction );
   300     renameAction->setObjectName( "renameAction" );
   301     
   301     renameAction->setText( tr( "Rename" ) );
   302         connect( deleteAction, SIGNAL( triggered() ),
   302     contextMenu->addAction( renameAction );
   303         this, SLOT( on_deleteAction_triggered() ) );
   303 
   304     
   304     connect( renameAction, SIGNAL( triggered() ),
   305         //rename
   305     this, SLOT( on_renameAction_triggered() ) );
   306         HbAction *renameAction = new HbAction();
   306     
   307         renameAction->setObjectName( "renameAction" );
   307 //remove send action as it can not be used
   308         renameAction->setText( hbTrId( "txt_fmgr_menu_rename" ) );
   308 //    HbAction *sendAction = new HbAction();
   309         contextMenu->addAction( renameAction );
   309 //    sendAction->setObjectName( "sendAction" );
   310     
   310 //    sendAction->setText( tr( "Send" ) );
   311         connect( renameAction, SIGNAL( triggered() ),
   311 //    contextMenu->addAction( sendAction );
   312         this, SLOT( on_renameAction_triggered() ) );
   312 //    
   313     }
   313 //    connect( sendAction, SIGNAL( triggered() ),
   314     
   314 //    this, SLOT( on_sendAction_triggered() ) );
   315 //    if( fileInfo.isFile() ){
       
   316 //        HbAction *sendAction = new HbAction();
       
   317 //        sendAction->setObjectName( "sendAction" );
       
   318 //        sendAction->setText( hbTrId( "txt_fmgr_menu_send" ) );
       
   319 //        contextMenu->addAction( sendAction );
       
   320 //        
       
   321 //        connect( sendAction, SIGNAL( triggered() ),
       
   322 //        this, SLOT( on_sendAction_triggered() ) );
       
   323 //    }
   315     
   324     
   316     contextMenu->exec( coords );     
   325     contextMenu->exec( coords );     
   317 }
   326 }
   318 
   327 
   319 void FmFileBrowseWidget::on_tree_longPressed( HbAbstractViewItem *item, const QPointF &coords )
   328 void FmFileBrowseWidget::on_tree_longPressed( HbAbstractViewItem *item, const QPointF &coords )
   395     
   404     
   396     connect( mSearchPanel, SIGNAL( exitClicked() ),
   405     connect( mSearchPanel, SIGNAL( exitClicked() ),
   397         this, SLOT( on_searchPanel_exitClicked() ) );
   406         this, SLOT( on_searchPanel_exitClicked() ) );
   398 }
   407 }
   399 
   408 
       
   409 void FmFileBrowseWidget::initEmptyTipsLabel()
       
   410 {
       
   411     mEmptyTipLabel = new HbLabel( this );
       
   412     mEmptyTipLabel->setObjectName( "searchPanel" );
       
   413     mEmptyTipLabel->hide();
       
   414 }
       
   415 
   400 
   416 
   401 void FmFileBrowseWidget::changeRootIndex( const QModelIndex &index )
   417 void FmFileBrowseWidget::changeRootIndex( const QModelIndex &index )
   402 {
   418 {
   403     QFileInfo oldFileInfo = mModel->fileInfo( mListView->rootIndex() );
   419     QFileInfo oldFileInfo = mModel->fileInfo( mListView->rootIndex() );
   404     FmViewManager::viewManager()->removeWatchPath( oldFileInfo.absoluteFilePath() );
   420     FmViewManager::viewManager()->removeWatchPath( oldFileInfo.absoluteFilePath() );
   435     mModel->setFilter( filters );
   451     mModel->setFilter( filters );
   436 }
   452 }
   437 
   453 
   438 void FmFileBrowseWidget::refreshModel( const QString& path )
   454 void FmFileBrowseWidget::refreshModel( const QString& path )
   439 {
   455 {
   440     if( !path.isEmpty() ) {
   456     QString currPath( currentPath().absoluteFilePath() );
   441         mModel->refresh( mModel->index( path ) );
   457     QString refreshPath( path );
   442     }
   458     
       
   459     if( !currPath.isEmpty() ) {
       
   460         if( refreshPath.isEmpty() ) {
       
   461             refreshPath = currPath;
       
   462         }
       
   463         if(  !FmUtils::isPathEqual( refreshPath, currPath ) ) {
       
   464             // no need refresh other path
       
   465             return;
       
   466         }
       
   467         if( checkPathAndSetStyle( refreshPath ) ) {               
       
   468             mModel->refresh( mModel->index( refreshPath ) );
       
   469         } else {
       
   470             FmViewManager *viewManager = FmViewManager::viewManager();
       
   471             if( viewManager ) {
       
   472                 viewManager->removeWatchPath( currentPath().absoluteFilePath() );
       
   473             } 
       
   474         }
       
   475     } else {
       
   476         // current path is empty, so change root path to Drive root.
       
   477         refreshPath = mCurrentDrive;
       
   478         setRootPath( refreshPath );
       
   479         emit setTitle( FmUtils::fillDriveVolume( mCurrentDrive, true ) );
       
   480     }
       
   481 }
       
   482 
       
   483 bool FmFileBrowseWidget::checkPathAndSetStyle( const QString& path )
       
   484 {
       
   485     if( !FmUtils::isPathAccessabel( path ) ){
       
   486         QString driveName = FmUtils::getDriveNameFromPath( path );
       
   487         FmDriverInfo::DriveState state = FmUtils::queryDriverInfo( driveName ).driveState();
       
   488         
       
   489         if( state & FmDriverInfo::EDriveLocked ) {
       
   490             mEmptyTipLabel->setPlainText( hbTrId( "Memory Card is locked" ) );       
       
   491         } else if( state & FmDriverInfo::EDriveNotPresent ) {
       
   492             mEmptyTipLabel->setPlainText( hbTrId( "Memory Card is not present" ) );
       
   493         } else if( state & FmDriverInfo::EDriveCorrupted ) {
       
   494             mEmptyTipLabel->setPlainText( hbTrId( "Drive is Corrupted" ) );
       
   495         } else {
       
   496             mEmptyTipLabel->setPlainText( hbTrId( "Drive can not be opened " ) );
       
   497         }
       
   498         setStyle( LabelStyle );
       
   499         emit setEmptyMenu( true );
       
   500         return false;
       
   501     } else {
       
   502         setStyle( mFileBrowseStyle );
       
   503         emit setEmptyMenu( false );
       
   504         return true;
       
   505     }
       
   506     
   443 }
   507 }
   444 
   508 
   445 void FmFileBrowseWidget::sortFiles( TSortType sortType )
   509 void FmFileBrowseWidget::sortFiles( TSortType sortType )
   446 {
   510 {
   447     switch( sortType ){
   511     switch( sortType ){
   456         case ESortBySize:{
   520         case ESortBySize:{
   457             mModel->setSorting( QDir::Size );
   521             mModel->setSorting( QDir::Size );
   458         }
   522         }
   459             break;
   523             break;
   460         case ESortByType:{
   524         case ESortByType:{
   461             mModel->setSorting( QDir::Type );
   525             mModel->setSorting( QDir::Type | QDir::DirsFirst );
   462         }
   526         }
   463             break;
   527             break;
   464         default:
   528         default:
   465             break;
   529             break;
   466     }
   530     }
   473     mSearchPanel->show();
   537     mSearchPanel->show();
   474 }
   538 }
   475 
   539 
   476 void FmFileBrowseWidget::on_searchPanel_searchOptionsClicked()
   540 void FmFileBrowseWidget::on_searchPanel_searchOptionsClicked()
   477 {
   541 {
   478     mFindTargetPath = FmFileDialog::getExistingDirectory( 0, tr( "Look in:" ), QString(""),
   542     mFindTargetPath = FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""),
   479         QStringList() );
   543         QStringList() );
   480 }
   544 }
   481 
   545 
   482 void FmFileBrowseWidget::on_searchPanel_criteriaChanged( const QString &criteria )
   546 void FmFileBrowseWidget::on_searchPanel_criteriaChanged( const QString &criteria )
   483 {
   547 {
   497 }
   561 }
   498 
   562 
   499 void FmFileBrowseWidget::on_sendAction_triggered()
   563 void FmFileBrowseWidget::on_sendAction_triggered()
   500 {
   564 {
   501     QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
   565     QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
   502     QList<QVariant> list;
   566     QStringList list;
   503     list.append( QVariant(filePath ) );
   567     list.append( filePath );
   504     FmUtils::sendFiles( list );
   568     FmUtils::sendFiles( list );
   505 }
   569 }
   506 
   570 
   507 void FmFileBrowseWidget::on_viewAction_triggered()
   571 void FmFileBrowseWidget::on_viewAction_triggered()
   508 {
   572 {
   511     
   575     
   512     if( fileInfo.isDir() ){
   576     if( fileInfo.isDir() ){
   513         mOperationService->asyncViewFolderDetails( filePath );  
   577         mOperationService->asyncViewFolderDetails( filePath );  
   514     }
   578     }
   515     else if( fileInfo.isFile() ){
   579     else if( fileInfo.isFile() ){
   516         FmViewDetailsDialog::showFileViewDetailsDialog( filePath );
   580 		FmViewDetailsDialog::showFileViewDetailsDialog( filePath, FmUtils::getDriveLetterFromPath( filePath ) );
   517     } 
   581     } 
   518 }
   582 }
   519 
   583 
   520 void FmFileBrowseWidget::on_deleteAction_triggered()
   584 void FmFileBrowseWidget::on_deleteAction_triggered()
   521 {
   585 {
   522     QStringList fileList;
   586     QStringList fileList;
   523     fileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) );
   587     fileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) );
   524     if ( HbMessageBox::question( tr("Confirm Deletion?" ) )) {
   588     if ( HbMessageBox::question( hbTrId("Confirm Deletion?" ) )) {
   525         int ret = mOperationService->asyncRemove( fileList );
   589         int ret = mOperationService->asyncRemove( fileList );
   526         switch( ret ) {
   590         switch( ret ) {
   527             case FmErrNone:
   591             case FmErrNone:
   528                 // no error, do not show note to user
   592                 // no error, do not show note to user
   529                 break;
   593                 break;
   530             case FmErrAlreadyStarted:
   594             case FmErrAlreadyStarted:
   531                 // last operation have not finished
   595                 // last operation have not finished
   532                 HbMessageBox::information( tr( "Operatin already started!" ) );
   596                 HbMessageBox::information( hbTrId( "Operatin already started!" ) );
   533                 break;
   597                 break;
   534             case FmErrWrongParam:
   598             case FmErrWrongParam:
   535                 HbMessageBox::information( tr( "Wrong parameters!" ) );
   599                 HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
   536                 break;
   600                 break;
   537             default:
   601             default:
   538                 HbMessageBox::information( tr( "Operation fail to start!" ) );
   602                 HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
   539         }
   603         }
   540     }
   604     }
   541 }
   605 }
   542 
   606 
   543 void FmFileBrowseWidget::on_copyAction_triggered()
   607 void FmFileBrowseWidget::on_copyAction_triggered()
   544 {
   608 {
   545     QStringList srcFileList;
   609     QStringList srcFileList;
   546     srcFileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) );
   610     srcFileList.push_back( mModel->filePath( mCurrentItem->modelIndex() ) );
   547 
   611 
   548     QString targetPathName = FmFileDialog::getExistingDirectory( 0, tr( "copy to" ),
   612     QString targetPathName = FmFileDialog::getExistingDirectory( 0, hbTrId( "copy to" ),
   549     QString(""), QStringList() );
   613     QString(""), QStringList() );
   550     if( !targetPathName.isEmpty() ) {
   614     if( !targetPathName.isEmpty() ) {
   551         targetPathName = FmUtils::fillPathWithSplash( targetPathName );
   615         targetPathName = FmUtils::fillPathWithSplash( targetPathName );
   552 
   616 
   553         int ret = mOperationService->asyncCopy(
   617         int ret = mOperationService->asyncCopy(
   556             case FmErrNone:
   620             case FmErrNone:
   557                 // no error, do not show note to user
   621                 // no error, do not show note to user
   558                 break;
   622                 break;
   559             case FmErrAlreadyStarted:
   623             case FmErrAlreadyStarted:
   560                 // last operation have not finished
   624                 // last operation have not finished
   561                 HbMessageBox::information( tr( "Operatin already started!" ) );
   625                 HbMessageBox::information( hbTrId( "Operatin already started!" ) );
   562                 break;
   626                 break;
   563             case FmErrWrongParam:
   627             case FmErrWrongParam:
   564                 HbMessageBox::information( tr( "Wrong parameters!" ) );
   628                 HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
   565                 break;
   629                 break;
   566             default:
   630             default:
   567                 HbMessageBox::information( tr( "Operation fail to start!" ) );
   631                 HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
   568         }
   632         }
   569     }
   633     }
   570 
   634 
   571 }
   635 }
   572  
   636  
   586             case FmErrNone:
   650             case FmErrNone:
   587                 // no error, do not show note to user
   651                 // no error, do not show note to user
   588                 break;
   652                 break;
   589             case FmErrAlreadyStarted:
   653             case FmErrAlreadyStarted:
   590                 // last operation have not finished
   654                 // last operation have not finished
   591                 HbMessageBox::information( tr( "Operatin already started!" ) );
   655                 HbMessageBox::information( hbTrId( "Operatin already started!" ) );
   592                 break;
   656                 break;
   593             case FmErrWrongParam:
   657             case FmErrWrongParam:
   594                 HbMessageBox::information( tr( "Wrong parameters!" ) );
   658                 HbMessageBox::information( hbTrId( "Wrong parameters!" ) );
   595                 break;
   659                 break;
   596             default:
   660             default:
   597                 HbMessageBox::information( tr( "Operation fail to start!" ) );
   661                 HbMessageBox::information( hbTrId( "Operation fail to start!" ) );
   598         }
   662         }
   599     }
   663     }
   600 }
   664 }
   601 
   665 
   602 
   666 
   605     QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
   669     QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
   606     QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() );
   670     QFileInfo fileInfo = mModel->fileInfo( mCurrentItem->modelIndex() );
   607 
   671 
   608     QString newName( fileInfo.fileName() );
   672     QString newName( fileInfo.fileName() );
   609     
   673     
   610     while( FmDlgUtils::showTextQuery( tr( "Enter new name for %1" ).arg( newName ), newName ) ){
   674     while( FmDlgUtils::showTextQuery( hbTrId( "Enter new name for %1" ).arg( newName ), newName, true ) ){
   611         QString newTargetPath = FmUtils::fillPathWithSplash(
   675         QString newTargetPath = FmUtils::fillPathWithSplash(
   612             fileInfo.absolutePath() ) + newName;
   676             fileInfo.absolutePath() ) + newName;
   613         QFileInfo newFileInfo( newTargetPath );
   677         QFileInfo newFileInfo( newTargetPath );
   614         if( newFileInfo.exists() ) {
   678         if( newFileInfo.exists() ) {
   615             HbMessageBox::information( tr( "%1 already exist!" ).arg( newName ) );
   679             HbMessageBox::information( hbTrId( "%1 already exist!" ).arg( newName ) );
   616             continue;
   680             continue;
   617         }
   681         }
   618 
   682 
   619         if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) {
   683         if( !rename( fileInfo.absoluteFilePath(), newTargetPath ) ) {
   620             HbMessageBox::information( tr("Rename failed!") );
   684             HbMessageBox::information( hbTrId("Rename failed!") );
   621         }
   685         }
   622         break;
   686         break;
   623     }
   687     }   
   624     
   688 }
   625    
       
   626 }