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

List:       kde-commits
Subject:    KDE/kdepimlibs/akonadi
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-12-20 17:29:12
Message-ID: 20101220172912.B2211AC8AA () svn ! kde ! org
[Download RAW message or body]

SVN commit 1208104 by vkrause:

Implement drop handling in the favorites model. Now I just need to get
the view to actually use this...


 M  +19 -0     favoritecollectionsmodel.cpp  
 M  +1 -0      favoritecollectionsmodel.h  


--- trunk/KDE/kdepimlibs/akonadi/favoritecollectionsmodel.cpp #1208103:1208104
@@ -21,6 +21,7 @@
 #include "favoritecollectionsmodel.h"
 
 #include <QtGui/QItemSelectionModel>
+#include <QtCore/QMimeData>
 
 #include <kconfiggroup.h>
 #include <klocale.h>
@@ -240,4 +241,22 @@
   }
 }
 
+bool FavoriteCollectionsModel::dropMimeData(const QMimeData* data, Qt::DropAction \
action, int row, int column, const QModelIndex& parent) +{
+  Q_UNUSED( action );
+  Q_UNUSED( row );
+  Q_UNUSED( column );
+  Q_UNUSED( parent );
+  if ( data->hasFormat( QLatin1String( "text/uri-list" ) ) ) {
+    const KUrl::List urls = KUrl::List::fromMimeData( data );
+    foreach ( const KUrl &url, urls ) {
+      const Collection col = Collection::fromUrl( url );
+      if ( col.isValid() )
+        addCollection( col );
+    }
+    return true;
+  }
+  return false;
+}
+
 #include "favoritecollectionsmodel.moc"
--- trunk/KDE/kdepimlibs/akonadi/favoritecollectionsmodel.h #1208103:1208104
@@ -120,6 +120,7 @@
     virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) \
                const;
     virtual bool setData(const QModelIndex& index, const QVariant& value, int role = \
                Qt::EditRole);
     virtual QVariant headerData( int section, Qt::Orientation orientation, int role \
= Qt::DisplayRole ) const; +    virtual bool dropMimeData(const QMimeData* data, \
Qt::DropAction action, int row, int column, const QModelIndex& parent);  
   public Q_SLOTS:
     /**


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

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