[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/akonadi-ports
From:       Laurent Montel <montel () kde ! org>
Date:       2009-11-09 14:06:57
Message-ID: 1257775617.015947.18436.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1046700 by mlaurent:

Allow to show or not dnd menu action after a dnd
or use automatic action. (needs by kmail)


 M  +1 -1      kdepim/kmail/folderselectiontreeview.cpp  
 M  +25 -1     kdepimlibs/akonadi/dragdropmanager.cpp  
 M  +4 -1      kdepimlibs/akonadi/dragdropmanager_p.h  
 M  +11 -0     kdepimlibs/akonadi/entitytreeview.cpp  
 M  +9 -0      kdepimlibs/akonadi/entitytreeview.h  


--- branches/work/akonadi-ports/kdepim/kmail/folderselectiontreeview.cpp #1046699:1046700
@@ -196,7 +196,7 @@
   case DisplayNever:
     d->filterModel->setToolTipEnabled( false );
   }
-
+  d->collectionFolderView->askDndActionMenu( GlobalSettings::self()->showPopupAfterDnD() );
   readQuotaConfig();
 }
 
--- branches/work/akonadi-ports/kdepimlibs/akonadi/dragdropmanager.cpp #1046699:1046700
@@ -33,7 +33,7 @@
 using namespace Akonadi;
 
 DragDropManager::DragDropManager( QAbstractItemView *view )
-    : m_view( view )
+    : mAskAction( true ), m_view( view )
 {
 }
 
@@ -155,6 +155,19 @@
     return true;
   }
 
+  if ( !mAskAction ) {
+    if ( moveAllowed )
+      defaultAction = Qt::MoveAction;
+    else if ( copyAllowed )
+      defaultAction = Qt::CopyAction;
+    else if ( linkAllowed )
+      defaultAction = Qt::LinkAction;
+    else
+      return false;
+    event->setDropAction( defaultAction );
+    return true;
+  }
+
   // otherwise show up a menu to allow the user to select an action
   QMenu popup( m_view );
   QAction* moveDropAction = 0;
@@ -256,3 +269,14 @@
 
   drag->exec( supportedActions, defaultAction );
 }
+
+bool DragDropManager::isAskDndActionMenu() const
+{
+  return mAskAction;
+}
+
+void DragDropManager::askDndActionMenu( bool _b)
+{
+  mAskAction = _b;
+}
+
--- branches/work/akonadi-ports/kdepimlibs/akonadi/dragdropmanager_p.h #1046699:1046700
@@ -54,11 +54,14 @@
      */
     void startDrag( Qt::DropActions supportedActions );
 
+    bool isAskDndActionMenu() const;
+    void askDndActionMenu( bool );
+
   private:
     Collection currentDropTarget( QDropEvent* event ) const;
 
     bool hasAncestor( const QModelIndex& index, Collection::Id parentId ) const;
-
+    bool mAskAction;
     QAbstractItemView *m_view;
 };
 
--- branches/work/akonadi-ports/kdepimlibs/akonadi/entitytreeview.cpp #1046699:1046700
@@ -264,4 +264,15 @@
   d->mDragDropManager->startDrag( supportedActions );
 }
 
+
+void EntityTreeView::askDndActionMenu(bool askAction)
+{
+  d->mDragDropManager->askDndActionMenu( askAction );
+}
+
+bool EntityTreeView::isAskDndActionMenu() const
+{
+  return d->mDragDropManager->isAskDndActionMenu();
+}
+
 #include "entitytreeview.moc"
--- branches/work/akonadi-ports/kdepimlibs/akonadi/entitytreeview.h #1046699:1046700
@@ -108,6 +108,15 @@
      */
     virtual void setModel( QAbstractItemModel * model );
 
+    /**
+     * Show or not dnd menu action during dnd
+     */
+    void askDndActionMenu(bool askAction);
+
+    /**
+     * Get info about show or not menu during dnd
+     */
+    bool isAskDndActionMenu() const;
   Q_SIGNALS:
     /**
      * This signal is emitted whenever the user has clicked
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic