controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp
changeset 24 f5dfdd5e4a1b
parent 17 4a9568303383
child 25 19394c261aa5
equal deleted inserted replaced
17:4a9568303383 24:f5dfdd5e4a1b
    32 #include <XQUtils>
    32 #include <XQUtils>
    33 #include <hblabel.h>
    33 #include <hblabel.h>
    34 #include "tonefetcherview.h"
    34 #include "tonefetcherview.h"
    35 #include "tonefetchermodel.h"
    35 #include "tonefetchermodel.h"
    36 #include <hbmessagebox.h>
    36 #include <hbmessagebox.h>
       
    37 #include <hbprogressdialog.h>
    37 
    38 
    38 ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView  ) 
    39 ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView  ) 
    39     : HbWidget(this),
    40     : HbWidget(this),
    40       mLabel(0),
    41       mLabel(0),
    41       mListView(0),
    42       mListView(0),
    42       mLayout(0),
    43       mLayout(0),
    43       mToneModel(0),
    44       mToneModel(0),
    44       mServiceView(serviceView),         
    45       mServiceView(serviceView),         
    45       mServiceEngine(0)
    46       mServiceEngine(0),
       
    47       mWaitNote(0)
    46       
    48       
    47 {
    49 {
    48     mSelected = false;
    50     mSelected = false;
    49     init();
    51     init();
    50     connect(mServiceEngine, SIGNAL(mdeSessionOpened()), 
    52     connect(mServiceEngine, SIGNAL(mdeSessionOpened()), 
    58     connect(mServiceEngine, 
    60     connect(mServiceEngine, 
    59            SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)), 
    61            SIGNAL(notifyPreviewEvent(ToneServiceEngine::TPreviewEvent, int)), 
    60            this, SLOT(previewEvent(ToneServiceEngine::TPreviewEvent, int)));
    62            this, SLOT(previewEvent(ToneServiceEngine::TPreviewEvent, int)));
    61     connect( mServiceEngine, SIGNAL(notifyObjectChanged()),
    63     connect( mServiceEngine, SIGNAL(notifyObjectChanged()),
    62             this, SLOT(onObjectChanged()));
    64             this, SLOT(onObjectChanged()));
       
    65     connect( mServiceEngine, SIGNAL(notifyRefreshStart()),
       
    66                 this, SLOT(refreshStart()));
       
    67     connect( mServiceEngine, SIGNAL(notifyRefreshFinish()),
       
    68                 this, SLOT(refreshFinish()));
    63 }
    69 }
    64 
    70 
    65 ToneFetcherWidget::~ToneFetcherWidget()
    71 ToneFetcherWidget::~ToneFetcherWidget()
    66 {
    72 {
    67     delete mToneModel;    
    73     delete mToneModel;
       
    74     mToneModel = 0;
       
    75     delete mWaitNote;
       
    76     mWaitNote = 0;
    68 }
    77 }
    69 
    78 
    70 void ToneFetcherWidget::on_list_activated(const QModelIndex &index)
    79 void ToneFetcherWidget::on_list_activated(const QModelIndex &index)
    71 {  
    80 {  
    72     QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes();
    81     QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes();
   123     mToneModel = new ToneFetcherModel(this);
   132     mToneModel = new ToneFetcherModel(this);
   124     addRomFiles();
   133     addRomFiles();
   125     
   134     
   126     connect(mListView, SIGNAL(activated(QModelIndex)),
   135     connect(mListView, SIGNAL(activated(QModelIndex)),
   127         this, SLOT(on_list_activated(QModelIndex )));
   136         this, SLOT(on_list_activated(QModelIndex )));
       
   137     if( !mWaitNote ){
       
   138         mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog );
       
   139         mWaitNote->setText( hbTrId( "Refreshing..." ) );
       
   140         QAction *action = mWaitNote->actions().at(0);//disable Cancel buttion.
       
   141         action->setEnabled(false);
       
   142     }
   128 }
   143 }
   129 
   144 
   130 void ToneFetcherWidget::mdeSessionOpened()
   145 void ToneFetcherWidget::mdeSessionOpened()
   131 {
   146 {
   132     mServiceEngine->getTone();
   147     mServiceEngine->getTone();
   225         fileName = new QStandardItem(fileInfo.fileName());
   240         fileName = new QStandardItem(fileInfo.fileName());
   226         filePath = new QStandardItem(fileInfo.absoluteFilePath());
   241         filePath = new QStandardItem(fileInfo.absoluteFilePath());
   227         mToneModel->insertInOrder(fileName, filePath);  
   242         mToneModel->insertInOrder(fileName, filePath);  
   228     }
   243     }
   229 }
   244 }
       
   245 
       
   246 void ToneFetcherWidget::refreshFinish()
       
   247 {
       
   248     if (mWaitNote) {
       
   249         mWaitNote->close();
       
   250     }
       
   251 }
       
   252 
       
   253 void ToneFetcherWidget::refreshStart()
       
   254 {
       
   255     if (mWaitNote) {
       
   256         mWaitNote->open();
       
   257     }
       
   258 }
   230 //End of File
   259 //End of File