]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Focus-tracking for widgets in Dolphin View now works.
authorAmandeep Singh <aman.dedman@gmail.com>
Wed, 8 Aug 2012 12:55:21 +0000 (18:25 +0530)
committerAmandeep Singh <aman.dedman@gmail.com>
Tue, 14 Aug 2012 14:57:56 +0000 (20:27 +0530)
Added the calls to updateAccessibility, for DragDrop & Focus scenarios

src/kitemviews/kitemlistcontainer.cpp
src/kitemviews/kitemlistcontroller.cpp
src/kitemviews/kitemlistcontroller.h
src/kitemviews/kitemlistselectionmanager.cpp
src/kitemviews/kitemlistviewaccessible.cpp

index 9b0c39667effb71e009c13f1e83b3f20dffedd81..01a4cfd4eb14971f58f383cfa984759ca55f4d79 100644 (file)
@@ -163,6 +163,7 @@ void KItemListContainer::keyPressEvent(QKeyEvent* event)
     if (view) {
         QApplication::sendEvent(view, event);
     }
+    //QAccessible::updateAccessibility(view, 0, QAccessible::Focus);
 }
 
 void KItemListContainer::showEvent(QShowEvent* event)
index 88f5d9f7cff1614fb8595b470d46916584710a27..9856636229c7c4a5afe1116d4648b0ce0cc91917 100644 (file)
@@ -848,6 +848,8 @@ bool KItemListController::dropEvent(QGraphicsSceneDragDropEvent* event, const QT
         emit itemDropEvent(m_view->itemAt(pos), event);
     }
 
+    QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropEnd);
+
     return true;
 }
 
@@ -1095,6 +1097,7 @@ void KItemListController::startDragging()
     drag->setHotSpot(hotSpot);
 
     drag->exec(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction, Qt::CopyAction);
+    QAccessible::updateAccessibility(view(), 0, QAccessible::DragDropStart);
 }
 
 KItemListWidget* KItemListController::hoveredWidget() const
index a88152622b5c8bd1c92f9386141107f50ad48f1c..6e8e3d367142dca128149967071918aa34a184bc 100644 (file)
@@ -30,6 +30,8 @@
 #include <QPointF>
 #include <QSet>
 
+#include <QAccessible>
+
 class KItemModelBase;
 class KItemListKeyboardSearchManager;
 class KItemListSelectionManager;
index 383914df01e9964d60bf009db7af636bd52fd55e..dbeb00fc6b486d88fabd27c7af58c88e6c925c94 100644 (file)
  ***************************************************************************/
 
 #include "kitemlistselectionmanager.h"
-
+#include "kitemlistcontroller.h"
+#include "kitemlistview.h"
 #include "kitemmodelbase.h"
 #include <KDebug>
+#include <QAccessible>
 
 KItemListSelectionManager::KItemListSelectionManager(QObject* parent) :
     QObject(parent),
@@ -61,6 +63,8 @@ void KItemListSelectionManager::setCurrentItem(int current)
             }
         }
     }
+    KItemListController *controller = static_cast<KItemListController*>(parent());
+    QAccessible::updateAccessibility(controller->view(), current+1, QAccessible::Focus);
 }
 
 int KItemListSelectionManager::currentItem() const
index 9e23f2343f3d4cb770d205406553210f8e2e27b3..de6e18e80da49419d54c24abff025e588a86ee35 100644 (file)
@@ -61,7 +61,7 @@ QAccessibleTable2CellInterface *KItemListViewAccessible::cellAt(int row, int col
         return 0;
     }
     return cell(index);*/
-    return column * (row - 1) + column ;
+    return cell(column * (row - 1) + column) ;
 }
 
 QAccessibleInterface *KItemListViewAccessible::caption() const
@@ -187,6 +187,12 @@ QAccessible::Role KItemListViewAccessible::role(int child) const
 
 QAccessible::State KItemListViewAccessible::state(int child) const
 {
+    if(child){
+        QAccessibleInterface *iface;
+        navigate(Child,child,&iface);
+        if(iface)
+            return iface->state(0);
+    }
     return QAccessible::Normal | QAccessible::HasInvokeExtension;
 }
 
@@ -405,16 +411,14 @@ QAccessible::State KItemListAccessibleCell::state(int child) const
     return st;
 }
 
-//Done
 bool KItemListAccessibleCell::isExpandable() const
 {
     return false; //view->model()->hasChildren(m_index);
 }
 
-//Done
 QRect KItemListAccessibleCell::rect(int) const
 {
-    QRect r = view->itemRect(index).toRect();
+    QRect r = view->itemRect(index-1).toRect();
     if (r.isNull())
         return QRect();
     r.translate(view->mapToScene(QPointF(0.0, 0.0)).toPoint());
@@ -439,7 +443,7 @@ QString KItemListAccessibleCell::text(QAccessible::Text t, int child) const
     return QString();
 }
 
-void KItemListAccessibleCell::setText(QAccessible::Text /*t*/, int child, const QString &text)
+void KItemListAccessibleCell::setText(QAccessible::Text /*t*/, int child, const QString &/*text*/)
 {
     Q_ASSERT(child == 0);
     // FIXME - is this even allowed on the KItemListWidget?