ganeswidgets/src/hgwidgets_p.cpp
changeset 13 8bf920201dea
parent 9 dde80bf4a8c7
child 16 0e550c9259fd
--- a/ganeswidgets/src/hgwidgets_p.cpp	Tue Jul 06 15:29:26 2010 +0300
+++ b/ganeswidgets/src/hgwidgets_p.cpp	Wed Aug 18 10:52:49 2010 +0300
@@ -16,7 +16,8 @@
 */
 
 #include <QApplication>
-#include <hbscrollbar_p.h>
+#include <HbScrollbar>
+#include <HbTheme>
 #include <hgwidgets/hgwidgets.h>
 
 #include "hgwidgets_p.h"
@@ -82,7 +83,10 @@
     q->connect(mContainer, SIGNAL(scrollingStarted()), q, SIGNAL(scrollingStarted()));
     q->connect(mContainer, SIGNAL(scrollingEnded()), q, SIGNAL(scrollingEnded()));
     q->connect(mScrollBarHideTimer, SIGNAL(timeout()), q, SLOT(_q_hideScrollBars()));
-
+    q->connect( HbTheme::instance(), SIGNAL(changed()), q, SLOT(_q_themeChanged()));
+    
+    mContainer->setHandleLongPress(mHandleLongPress);
+    
 //    mIndexFeedback = new HgIndexFeedback(q);
 //    mIndexFeedback->setWidget(q);
 
@@ -676,27 +680,12 @@
 
 void HgWidgetPrivate::lostForeground()
 {
-    if( !mForeground ) return;
-
     mForeground = false;
-    QList<HgWidgetItem*> list = mContainer->items();
-    foreach(HgWidgetItem* item, list){
-        item->releaseItemData();
-    }
 }
 
 void HgWidgetPrivate::gainedForeground()
 {
-    if( mForeground ) return;
-
     mForeground = true;
-    QList<HgWidgetItem*> list = mContainer->items();
-    int bufferStart = 0;
-    int bufferEnd = 0;
-    mBufferManager->currentBuffer(bufferStart,bufferEnd);
-    for(;bufferStart<=bufferEnd;bufferStart++){
-        list.at(bufferStart)->updateItemData();
-    }
 }
 
 void HgWidgetPrivate::updateCurrentItem(const QModelIndex &currentItem)
@@ -719,8 +708,8 @@
 void HgWidgetPrivate::orientationChanged(Qt::Orientation orientation)
 {
     Q_Q(HgWidget);
-    if (mContainer->orientation() != orientation) {
-        mContainer->setOrientation(orientation, q->isVisible());
+    if (mContainer->orientation() != orientation) {    
+        mContainer->setOrientation(orientation, q->isVisible() && q->isActive());
         if (!mStaticScrollDirection) {
             createScrollBar(orientation);
         }
@@ -864,4 +853,28 @@
     mBufferManager->resetBuffer(0, itemCount);
 }
 
+void HgWidgetPrivate::setHandleLongPress(bool handleLongPress)
+{
+    if (mHandleLongPress != handleLongPress) {
+        mHandleLongPress = handleLongPress;
+        mContainer->setHandleLongPress(mHandleLongPress);
+    }
+}
+
+bool HgWidgetPrivate::handleLongPress() const
+{
+    return mHandleLongPress;
+}
+
+void HgWidgetPrivate::_q_themeChanged()
+{
+    handleThemeChanged();
+}
+
+void HgWidgetPrivate::handleThemeChanged()
+{
+    // TODO, add graphics updates here if required.    
+}
+
+
 #include "moc_hgwidgets.cpp"