controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp
changeset 24 f5dfdd5e4a1b
parent 17 4a9568303383
child 25 19394c261aa5
--- a/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp	Fri Jun 11 13:39:17 2010 +0300
+++ b/controlpanelui/src/tonefetcher/src/tonefetcherwidget.cpp	Wed Jun 23 18:13:38 2010 +0300
@@ -34,6 +34,7 @@
 #include "tonefetcherview.h"
 #include "tonefetchermodel.h"
 #include <hbmessagebox.h>
+#include <hbprogressdialog.h>
 
 ToneFetcherWidget::ToneFetcherWidget( ToneFetcherView *serviceView  ) 
     : HbWidget(this),
@@ -42,7 +43,8 @@
       mLayout(0),
       mToneModel(0),
       mServiceView(serviceView),         
-      mServiceEngine(0)
+      mServiceEngine(0),
+      mWaitNote(0)
       
 {
     mSelected = false;
@@ -60,11 +62,18 @@
            this, SLOT(previewEvent(ToneServiceEngine::TPreviewEvent, int)));
     connect( mServiceEngine, SIGNAL(notifyObjectChanged()),
             this, SLOT(onObjectChanged()));
+    connect( mServiceEngine, SIGNAL(notifyRefreshStart()),
+                this, SLOT(refreshStart()));
+    connect( mServiceEngine, SIGNAL(notifyRefreshFinish()),
+                this, SLOT(refreshFinish()));
 }
 
 ToneFetcherWidget::~ToneFetcherWidget()
 {
-    delete mToneModel;    
+    delete mToneModel;
+    mToneModel = 0;
+    delete mWaitNote;
+    mWaitNote = 0;
 }
 
 void ToneFetcherWidget::on_list_activated(const QModelIndex &index)
@@ -125,6 +134,12 @@
     
     connect(mListView, SIGNAL(activated(QModelIndex)),
         this, SLOT(on_list_activated(QModelIndex )));
+    if( !mWaitNote ){
+        mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog );
+        mWaitNote->setText( hbTrId( "Refreshing..." ) );
+        QAction *action = mWaitNote->actions().at(0);//disable Cancel buttion.
+        action->setEnabled(false);
+    }
 }
 
 void ToneFetcherWidget::mdeSessionOpened()
@@ -227,4 +242,18 @@
         mToneModel->insertInOrder(fileName, filePath);  
     }
 }
+
+void ToneFetcherWidget::refreshFinish()
+{
+    if (mWaitNote) {
+        mWaitNote->close();
+    }
+}
+
+void ToneFetcherWidget::refreshStart()
+{
+    if (mWaitNote) {
+        mWaitNote->open();
+    }
+}
 //End of File