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

List:       kde-commits
Subject:    KDE/kdebase/konqueror/keditbookmarks
From:       Daniel Teske <teske () squorn ! de>
Date:       2005-10-06 18:33:26
Message-ID: 1128623606.420389.1226.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 467892 by teske:

Some porting to the new drag and drop api.


 M  +1 -3      bookmarklistview.cpp  
 M  +12 -11    bookmarkmodel.cpp  


--- trunk/KDE/kdebase/konqueror/keditbookmarks/bookmarklistview.cpp #467891:467892
@@ -64,7 +64,7 @@
 
 void BookmarkView::dragEnterEvent(QDragEnterEvent *event)
 {
-    //FIMXE add code
+    //FIXME add code
     QAbstractItemView::dragEnterEvent(event);
 }
 
@@ -74,8 +74,6 @@
     QAbstractItemView::dragMoveEvent(event);
 }
 
-
-
 void BookmarkView::rowsMoved(const QModelIndex &, int, int, const QModelIndex &, \
int)  {
     if(moveOldParent.isValid())
--- trunk/KDE/kdebase/konqueror/keditbookmarks/bookmarkmodel.cpp #467891:467892
@@ -325,37 +325,38 @@
 QMimeData * BookmarkModel::mimeData( const QModelIndexList & indexes ) const
 {
     QMimeData *mimeData = new QMimeData;
-    //FIXME use KBookmark::addToMimeData (or whatever KBookmarkDrag is ported to.)
-    //FIXME for now insert bogus things
-    mimeData->setData("application/x-xbel", "XXXX");
+    KBookmark::List bookmarks;
+    QModelIndexList::const_iterator it, end;
+    end = indexes.constEnd();
+    for( it = indexes.constBegin(); it!= end; ++it)
+        bookmarks.push_back( static_cast<TreeItem \
*>((*it).internalPointer())->bookmark()); +    bookmarks.populateMimeData(mimeData);
     return mimeData;
 }
 
 Qt::DropActions BookmarkModel::supportedDropActions () const
 {
-    //FIXME should return Qt::MoveAction | Qt::CopyAction
+    //FIXME check if that actually works
     return Qt::CopyAction | Qt::MoveAction;
 }
 
 QStringList BookmarkModel::mimeTypes () const
 {
-    //FIXME reuse KBookmark::mimeTypes (or something like that)
-    QStringList list;
-    list.append("application/x-xbel");
-    list.append("text/uri-list");
-    list.append("text/plain");
-    return list;
+    return KBookmark::List::mimeDataTypes();
 }
 
 bool BookmarkModel::dropMimeData(const QMimeData * data, Qt::DropAction action, int \
row, int column, const QModelIndex & parent)  {
+    //FIXME this only works for internal drag and drops
+
     QModelIndex idx;
     // idx is the index on which the data was dropped
     // work around stupid design of the qt api:
-    if(row == -1)   
+    if(row == -1)
         idx = parent;
     else
         idx = index(row, column, parent);
+
     KBookmark bk = static_cast<TreeItem *>(idx.internalPointer())->bookmark();
     QString addr = bk.address();
     if(bk.isGroup())


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

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