filemanager/src/filemanager/src/backuprestore/fmdeletebackupwidget.cpp
changeset 46 d58987eac7e8
parent 14 1957042d8c7e
child 49 81668a704644
equal deleted inserted replaced
37:15bc28c9dd51 46:d58987eac7e8
    18 #include "fmdeletebackupwidget.h"
    18 #include "fmdeletebackupwidget.h"
    19 #include "fmrestoresettings.h"
    19 #include "fmrestoresettings.h"
    20 #include "fmrestoreviewitem.h"
    20 #include "fmrestoreviewitem.h"
    21 #include "fmoperationservice.h"
    21 #include "fmoperationservice.h"
    22 #include "fmviewmanager.h"
    22 #include "fmviewmanager.h"
    23 
       
    24 #include "fmbackupconfigloader.h"
    23 #include "fmbackupconfigloader.h"
    25 #include "fmbkupengine.h"
    24 #include "fmbkupengine.h"
    26 #include "fmbackuprestorehandler.h"
    25 #include "fmbackuprestorehandler.h"
    27 
    26 
    28 #include <QGraphicsLinearLayout>
    27 #include <QGraphicsLinearLayout>
    29 #include <QStringListModel>
    28 #include <QStringListModel>
    30 #include <QDateTime>
    29 #include <QDateTime>
    31 
       
    32 #include <hblistview.h>
    30 #include <hblistview.h>
    33 
    31 
    34 FmDeleteBackupWidget::FmDeleteBackupWidget(  HbWidget *parent )
    32 FmDeleteBackupWidget::FmDeleteBackupWidget(  HbWidget *parent )
    35 : HbWidget( parent ), mModel( 0 )
    33 : HbWidget( parent ), mModel( 0 )
    36 {
    34 {
    45 
    43 
    46 void FmDeleteBackupWidget::refresh()
    44 void FmDeleteBackupWidget::refresh()
    47 {
    45 {
    48     mListView->setModel( 0 );
    46     mListView->setModel( 0 );
    49     loadData();
    47     loadData();
    50     mListView->setModel( mModel );
    48     mListView->setModel( mModel );    
       
    49     for (int i = 0; i < mModel->rowCount(); ++i) {
       
    50         QModelIndex index = mModel->index(i);
       
    51         FmRestoreViewItem* restoreViewItem = static_cast< FmRestoreViewItem* >
       
    52                                                  (mListView->itemByIndex(index));
       
    53         connect(restoreViewItem, SIGNAL(stateChanged(int)), this, SIGNAL(stateChanged(int)));     
       
    54     }
       
    55     emit stateChanged(0);
    51 }
    56 }
       
    57 
    52 QList<int> FmDeleteBackupWidget::selectionIndexes()
    58 QList<int> FmDeleteBackupWidget::selectionIndexes()
    53 {
    59 {
    54     QList<int> selectionList;
    60     QList<int> selectionList;
    55 
    61 
    56     for ( int i=0; i<mModel->rowCount(); i++ ) {
    62     for ( int i=0; i<mModel->rowCount(); i++ ) {
    82 
    88 
    83     for ( QList< FmRestoreEntry* >::iterator it = retoreEntryList.begin(); 
    89     for ( QList< FmRestoreEntry* >::iterator it = retoreEntryList.begin(); 
    84          it != retoreEntryList.end(); ++it ){
    90          it != retoreEntryList.end(); ++it ){
    85              QString string = ( *it )->text();
    91              QString string = ( *it )->text();
    86              QDateTime datetime = ( *it )->restoreInfo().dateTime();
    92              QDateTime datetime = ( *it )->restoreInfo().dateTime();
       
    93              QString drive = ( *it )->restoreInfo().drive();
    87              string.append( '\t' );
    94              string.append( '\t' );
    88              string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") );
    95              string.append( datetime.toString( "hh:mm ap dd/MM/yyyy") );
    89              QVariant variant( string );
    96              string.append( '\t' );
    90 
    97              string.append( drive );
       
    98              QVariant variant( string );             
    91              mModel->setData( mModel->index( index ), variant, Qt::DisplayRole );
    99              mModel->setData( mModel->index( index ), variant, Qt::DisplayRole );
    92 
       
    93              ++index;
   100              ++index;
    94     }
   101     }
    95 
   102 
    96 }
   103 }
    97 
   104 
    98 void FmDeleteBackupWidget::init()
   105 void FmDeleteBackupWidget::init()
    99 {
   106 {    
   100     QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this );
   107     QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout( this );
   101     vLayout->setOrientation( Qt::Vertical );
   108     vLayout->setOrientation( Qt::Vertical );
   102 
   109 
   103     mListView = new HbListView( this );
   110     mListView = new HbListView( this );
   104     connect( mListView, SIGNAL( activated( const QModelIndex & ) ),
   111     connect( mListView, SIGNAL( activated( const QModelIndex & ) ),
   110 
   117 
   111     loadData();
   118     loadData();
   112     mListView->setModel( mModel );
   119     mListView->setModel( mModel );
   113 
   120 
   114     mListView->setItemPrototype( new FmRestoreViewItem( this ) );
   121     mListView->setItemPrototype( new FmRestoreViewItem( this ) );
       
   122    
   115 
   123 
   116 }
   124 }
   117 
   125 
   118 void FmDeleteBackupWidget::on_list_activated( const QModelIndex &index )
   126 void FmDeleteBackupWidget::on_list_activated( const QModelIndex &index )
   119 {
   127 {