-void BufferViewFilter::enterDrag() {
- connect(sourceModel(), SIGNAL(addBuffer(const uint &, const QString &)),
- this, SLOT(addBuffer(const uint &, const QString &)));
+void BufferViewFilter::dropEvent(QDropEvent *event) {
+ const QMimeData *data = event->mimeData();
+ if(!(mode & FullCustom))
+ return; // only custom buffers can be customized... obviously... :)
+
+ if(!(data->hasFormat("application/Quassel/BufferItem/row")
+ && data->hasFormat("application/Quassel/BufferItem/network")
+ && data->hasFormat("application/Quassel/BufferItem/bufferId")))
+ return; // whatever the drop is... it's not a buffer...
+
+ event->accept();
+ uint bufferuid = data->data("application/Quassel/BufferItem/bufferId").toUInt();
+ QString networkname = QString::fromUtf8("application/Quassel/BufferItem/network");
+
+ for(int rowid = 0; rowid < rowCount(); rowid++) {
+ QModelIndex networkindex = index(rowid, 0);
+ if(networkindex.data(Qt::DisplayRole) == networkname) {
+ addBuffer(bufferuid);
+ return;
+ }
+ }
+ beginInsertRows(QModelIndex(), rowCount(), rowCount());
+ addBuffer(bufferuid);
+ endInsertRows();