diff --git a/appletbrowser/customdragtreeview.cpp b/appletbrowser/customdragtreeview.cpp index 9d3aa8021..b968075c1 100644 --- a/appletbrowser/customdragtreeview.cpp +++ b/appletbrowser/customdragtreeview.cpp @@ -33,7 +33,9 @@ void CustomDragTreeView::startDrag ( Qt::DropActions supportedActions ) // TODO: calculate real size for pixmap - using the icon sizes, not fixed // like now - if (!m_view) return; + if (!m_view) { + return; + } QModelIndexList indexes = selectedIndexes(); if (indexes.count() > 0) { @@ -48,7 +50,7 @@ void CustomDragTreeView::startDrag ( Qt::DropActions supportedActions ) off = (MAX_OFFSET * MAX_COUNT) / indexes.count(); } - kDebug() << "Size: " << size << " Off: " << off << "\n"; + //kDebug() << "Size: " << size << " Off: " << off << "\n"; QPixmap pixmap(size, size); pixmap.fill(QColor(255, 255, 255, 0)); // TODO: Transparent. Now it flickers when it's transparent @@ -56,7 +58,9 @@ void CustomDragTreeView::startDrag ( Qt::DropActions supportedActions ) QRect rect(0, 0, PIX_SIZE, PIX_SIZE); foreach (const QModelIndex &index, indexes) { - if (index.column() != 0) continue; + if (index.column() != 0) { + continue; + } KCategorizedItemsViewModels::AbstractItem * item = m_view->getItemByProxyIndex(index); diff --git a/appletbrowser/plasmaappletitemmodel.cpp b/appletbrowser/plasmaappletitemmodel.cpp index b01bfb8e3..3b61cb2b3 100644 --- a/appletbrowser/plasmaappletitemmodel.cpp +++ b/appletbrowser/plasmaappletitemmodel.cpp @@ -181,12 +181,20 @@ QMimeData* PlasmaAppletItemModel::mimeData(const QModelIndexList & indexes) cons QString format = types.at(0); - PlasmaAppletItem - * selectedItem = (PlasmaAppletItem *) itemFromIndex(indexes[0]); - QByteArray appletName(selectedItem->pluginName().toUtf8()); + QByteArray appletNames; + int lastRow = -1; + foreach (const QModelIndex &index, indexes) { + if (index.row() == lastRow) { + continue; + } - data->setData(format, appletName); + lastRow = index.row(); + PlasmaAppletItem *selectedItem = (PlasmaAppletItem *) itemFromIndex(index); + appletNames += '\n' + selectedItem->pluginName().toUtf8(); + //kDebug() << selectedItem->pluginName() << index.column() << index.row(); + } + data->setData(format, appletNames); return data; } diff --git a/containment.cpp b/containment.cpp index 116e3eab3..c6806998f 100644 --- a/containment.cpp +++ b/containment.cpp @@ -716,10 +716,14 @@ void Containment::dropEvent(QGraphicsSceneDragDropEvent *event) QString mimetype(static_cast(scene())->appletMimeType()); if (event->mimeData()->hasFormat(mimetype) && scene()) { - QString plasmoidName; - plasmoidName = event->mimeData()->data(mimetype); - QRectF geom(mapFromScene(event->scenePos()), QSize(0, 0)); - addApplet(plasmoidName, QVariantList(), geom); + QString data = event->mimeData()->data(mimetype); + QStringList appletNames = data.split('\n', QString::SkipEmptyParts); + + foreach (const QString &appletName, appletNames) { + //kDebug() << "doing" << appletName; + QRectF geom(mapFromScene(event->scenePos()), QSize(0, 0)); + addApplet(appletName, QVariantList(), geom); + } event->acceptProposedAction(); } else if (KUrl::List::canDecode(event->mimeData())) { //TODO: collect the mimetypes of available script engines and offer