#include "dolphin_iconsmodesettings.h"
+#include <kdialog.h>
+
#include <QAbstractProxyModel>
#include <QApplication>
#include <QPainter>
Q_ASSERT(controller != 0);
setViewMode(QListView::IconMode);
setResizeMode(QListView::Adjust);
-
+ setSpacing(KDialog::spacingHint());
setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
controller, SLOT(triggerItem(const QModelIndex&)));
}
- connect(this, SIGNAL(activated(const QModelIndex&)),
- controller, SLOT(triggerItem(const QModelIndex&)));
connect(this, SIGNAL(entered(const QModelIndex&)),
controller, SLOT(emitItemEntered(const QModelIndex&)));
connect(this, SIGNAL(viewportEntered()),
void DolphinIconsView::dropEvent(QDropEvent* event)
{
- const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
- if (!urls.isEmpty()) {
- m_controller->indicateDroppedUrls(urls,
- indexAt(event->pos()),
- event->source());
- event->acceptProposedAction();
+ if (!selectionModel()->isSelected(indexAt(event->pos()))) {
+ const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
+ if (!urls.isEmpty()) {
+ m_controller->indicateDroppedUrls(urls,
+ indexAt(event->pos()),
+ event->source());
+ event->acceptProposedAction();
+ }
}
KListView::dropEvent(event);
m_dragging = false;
{
KListView::paintEvent(event);
+ // TODO: remove this code when the issue #160611 is solved in Qt 4.4
if (m_dragging) {
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- QPainter painter(viewport());
- painter.save();
- QBrush brush(m_viewOptions.palette.brush(QPalette::Normal, QPalette::Highlight));
- QColor color = brush.color();
- color.setAlpha(64);
- brush.setColor(color);
- painter.fillRect(m_dropRect, brush);
- painter.restore();
+ const QBrush& brush = m_viewOptions.palette.brush(QPalette::Normal, QPalette::Highlight);
+ DolphinController::drawHoverIndication(viewport(), m_dropRect, brush);
}
}