]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Removing layouter from public, adding TableModelChanged update
authorAmandeep Singh <aman.dedman@gmail.com>
Mon, 24 Sep 2012 22:30:13 +0000 (04:00 +0530)
committerAmandeep Singh <aman.dedman@gmail.com>
Mon, 24 Sep 2012 22:31:48 +0000 (04:01 +0530)
REVIEW : 106555

src/kitemviews/kitemlistview.cpp
src/kitemviews/kitemlistview.h
src/kitemviews/kitemlistviewaccessible.cpp

index 580cf5bbe007b2553bfc90acfc4d91ad0d61f2d5..54a8cbfff186e47c53041346f565ac03dfad6023 100644 (file)
@@ -662,11 +662,6 @@ void KItemListView::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt
     }
 }
 
-KItemListViewLayouter* KItemListView::layouter() const
-{
-    return m_layouter;
-}
-
 void KItemListView::setItemSize(const QSizeF& size)
 {
     const QSizeF previousSize = m_itemSize;
@@ -1215,6 +1210,7 @@ void KItemListView::slotItemsChanged(const KItemRangeList& itemRanges,
             doLayout(NoAnimation);
         }
     }
+    QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
 }
 
 void KItemListView::slotGroupedSortingChanged(bool current)
index 2c30c6f43f18cf4a96418a41db3227e1125ec379..ca17053a3bfe4cae0e14f34ff497eeb1c3dd9fe4 100644 (file)
@@ -275,11 +275,6 @@ public:
      */
     virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
 
-    /**
-     * @return The Layouter for the view
-     */
-    KItemListViewLayouter* layouter() const;
-
 signals:
     void scrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous);
     void scrollOffsetChanged(qreal current, qreal previous);
@@ -747,6 +742,8 @@ private:
     friend class KItemListHeader;    // Accesses m_headerWidget
     friend class KItemListController;
     friend class KItemListControllerTest;
+    friend class KItemListViewAccessible;
+    friend class KItemListAccessibleCell;
 };
 
 /**
index 6ca9cc85a0a99c810b84267b00fead7b29d383e6..28a92edce74273fac9193e32740e221de146e0d5 100644 (file)
@@ -33,7 +33,6 @@ QAccessible::Role KItemListViewAccessible::cellRole() const
 
 QAccessibleTable2CellInterface* KItemListViewAccessible::cell(int index) const
 {
-    Q_ASSERT(index >= 0 && index < view()->model()->count());
     if (index < 0 || index >= view()->model()->count())
         return 0;
     return new KItemListAccessibleCell(view(), index);
@@ -62,12 +61,12 @@ QString KItemListViewAccessible::columnDescription(int) const
 
 int KItemListViewAccessible::columnCount() const
 {
-    return view()->layouter()->columnCount();
+    return view()->m_layouter->columnCount();
 }
 
 int KItemListViewAccessible::rowCount() const
 {
-    if(columnCount()<=0) {
+    if(columnCount() <= 0) {
         return 0;
     }
     int itemCount = view()->model()->count();
@@ -158,6 +157,8 @@ bool KItemListViewAccessible::unselectColumn(int)
 QAccessible2::TableModelChange KItemListViewAccessible::modelChange() const
 {
     QAccessible2::TableModelChange change;
+    change.lastRow = rowCount();
+    change.lastColumn = columnCount();
     return change;
 }
 
@@ -289,12 +290,12 @@ QList<QAccessibleInterface*> KItemListAccessibleCell::columnHeaderCells() const
 
 int KItemListAccessibleCell::columnIndex() const
 {
-    return m_view->layouter()->itemColumn(m_index);
+    return m_view->m_layouter->itemColumn(m_index);
 }
 
 int KItemListAccessibleCell::rowIndex() const
 {
-    return m_view->layouter()->itemRow(m_index);
+    return m_view->m_layouter->itemRow(m_index);
 }
 
 bool KItemListAccessibleCell::isSelected() const
@@ -304,7 +305,7 @@ bool KItemListAccessibleCell::isSelected() const
 
 void KItemListAccessibleCell::rowColumnExtents(int* row, int* column, int* rowExtents, int* columnExtents, bool* selected) const
 {
-    KItemListViewLayouter* layouter = m_view->layouter();
+    KItemListViewLayouter* layouter = m_view->m_layouter;
     *row = layouter->itemRow(m_index);
     *column = layouter->itemColumn(m_index);
     *rowExtents = 1;
@@ -342,12 +343,20 @@ QAccessible::State KItemListAccessibleCell::state(int child) const
         state |= MultiSelectable;
     }
 
+    if (m_view->model()->isExpandable(m_index)) {
+        if(m_view->model()->isExpanded(m_index)) {
+            state |= Expanded;
+        }
+        else {
+            state |= Collapsed;
+        }
+    }
     return state;
 }
 
 bool KItemListAccessibleCell::isExpandable() const
 {
-    return false;
+    return m_view->model()->isExpandable(m_index);
 }
 
 QRect KItemListAccessibleCell::rect(int) const
@@ -398,6 +407,7 @@ int KItemListAccessibleCell::childCount() const
 
 int KItemListAccessibleCell::indexOfChild(const QAccessibleInterface* child) const
 {
+    Q_UNUSED(child);
     return -1;
 }