┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphincolumnwidget.cpp13
-rw-r--r--src/dolphincolumnwidget.h3
-rw-r--r--src/dolphindetailsview.cpp17
-rw-r--r--src/dolphindetailsview.h3
-rw-r--r--src/dolphiniconsview.cpp21
-rw-r--r--src/dolphiniconsview.h5
-rw-r--r--src/draganddrophelper.cpp41
-rw-r--r--src/draganddrophelper.h7
-rw-r--r--src/sidebartreeview.cpp21
-rw-r--r--src/sidebartreeview.h4
10 files changed, 7 insertions, 128 deletions
diff --git a/src/dolphincolumnwidget.cpp b/src/dolphincolumnwidget.cpp
index f0656808d..bbaa5f793 100644
--- a/src/dolphincolumnwidget.cpp
+++ b/src/dolphincolumnwidget.cpp
@@ -60,7 +60,6 @@ DolphinColumnWidget::DolphinColumnWidget(QWidget* parent,
m_dolphinModel(0),
m_proxyModel(0),
m_iconManager(0),
- m_dragging(false),
m_dropRect()
{
setMouseTracking(true);
@@ -251,16 +250,11 @@ void DolphinColumnWidget::dragEnterEvent(QDragEnterEvent* event)
if (event->mimeData()->hasUrls()) {
event->acceptProposedAction();
}
-
- m_dragging = true;
}
void DolphinColumnWidget::dragLeaveEvent(QDragLeaveEvent* event)
{
QListView::dragLeaveEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- m_dragging = false;
setDirtyRegion(m_dropRect);
}
@@ -301,7 +295,6 @@ void DolphinColumnWidget::dropEvent(QDropEvent* event)
event->acceptProposedAction();
}
QListView::dropEvent(event);
- m_dragging = false;
}
void DolphinColumnWidget::paintEvent(QPaintEvent* event)
@@ -326,12 +319,6 @@ void DolphinColumnWidget::paintEvent(QPaintEvent* event)
}
QListView::paintEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- if (m_dragging) {
- const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
- DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
- }
}
void DolphinColumnWidget::mousePressEvent(QMouseEvent* event)
diff --git a/src/dolphincolumnwidget.h b/src/dolphincolumnwidget.h
index b8113cd6f..3472f95d8 100644
--- a/src/dolphincolumnwidget.h
+++ b/src/dolphincolumnwidget.h
@@ -139,8 +139,7 @@ private:
IconManager* m_iconManager;
- bool m_dragging; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
- QRect m_dropRect; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
+ QRect m_dropRect;
};
inline bool DolphinColumnWidget::isActive() const
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index 11b993849..2eb631a64 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -49,7 +49,6 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
m_controller(controller),
m_font(),
m_decorationSize(),
- m_dragging(false),
m_showElasticBand(false),
m_elasticBandOrigin(),
m_elasticBandDestination()
@@ -261,15 +260,11 @@ void DolphinDetailsView::dragEnterEvent(QDragEnterEvent* event)
updateElasticBand();
m_showElasticBand = false;
}
- m_dragging = true;
}
void DolphinDetailsView::dragLeaveEvent(QDragLeaveEvent* event)
{
QTreeView::dragLeaveEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- m_dragging = false;
setDirtyRegion(m_dropRect);
}
@@ -280,10 +275,7 @@ void DolphinDetailsView::dragMoveEvent(QDragMoveEvent* event)
// TODO: remove this code when the issue #160611 is solved in Qt 4.4
setDirtyRegion(m_dropRect);
const QModelIndex index = indexAt(event->pos());
- if (!index.isValid() || (index.column() != DolphinModel::Name)) {
- m_dragging = false;
- } else {
- m_dragging = true;
+ if (index.isValid() && (index.column() == DolphinModel::Name)) {
const KFileItem item = m_controller->itemForIndex(index);
if (!item.isNull() && item.isDir()) {
m_dropRect = visualRect(index);
@@ -314,7 +306,6 @@ void DolphinDetailsView::dropEvent(QDropEvent* event)
item);
}
QTreeView::dropEvent(event);
- m_dragging = false;
}
void DolphinDetailsView::paintEvent(QPaintEvent* event)
@@ -335,12 +326,6 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
style()->drawControl(QStyle::CE_RubberBand, &opt, &painter);
painter.restore();
}
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- if (m_dragging) {
- const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
- DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
- }
}
void DolphinDetailsView::keyPressEvent(QKeyEvent* event)
diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h
index 295936258..88471746d 100644
--- a/src/dolphindetailsview.h
+++ b/src/dolphindetailsview.h
@@ -161,8 +161,7 @@ private:
QFont m_font;
QSize m_decorationSize;
- bool m_dragging; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
- QRect m_dropRect; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
+ QRect m_dropRect;
bool m_showElasticBand;
QPoint m_elasticBandOrigin;
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp
index e92d8ba3b..dda538e16 100644
--- a/src/dolphiniconsview.cpp
+++ b/src/dolphiniconsview.cpp
@@ -46,7 +46,6 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
m_decorationPosition(QStyleOptionViewItem::Top),
m_displayAlignment(Qt::AlignHCenter),
m_itemSize(),
- m_dragging(false),
m_dropRect()
{
Q_ASSERT(controller != 0);
@@ -57,9 +56,6 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
setDragEnabled(true);
viewport()->setAcceptDrops(true);
- setMouseTracking(true);
- viewport()->setAttribute(Qt::WA_Hover);
-
// TODO: Connecting to the signal 'activated()' is not possible, as kstyle
// does not forward the single vs. doubleclick to it yet (KDE 4.1?). Hence it is
// necessary connecting the signal 'singleClick()' or 'doubleClick' and to handle the
@@ -221,15 +217,11 @@ void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event)
if (event->mimeData()->hasUrls()) {
event->acceptProposedAction();
}
- m_dragging = true;
}
void DolphinIconsView::dragLeaveEvent(QDragLeaveEvent* event)
{
KCategorizedView::dragLeaveEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- m_dragging = false;
setDirtyRegion(m_dropRect);
}
@@ -273,19 +265,6 @@ void DolphinIconsView::dropEvent(QDropEvent* event)
}
KCategorizedView::dropEvent(event);
-
- m_dragging = false;
-}
-
-void DolphinIconsView::paintEvent(QPaintEvent* event)
-{
- KCategorizedView::paintEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- if (m_dragging) {
- const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
- DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
- }
}
void DolphinIconsView::keyPressEvent(QKeyEvent* event)
diff --git a/src/dolphiniconsview.h b/src/dolphiniconsview.h
index 20d41051a..d96d7c7e9 100644
--- a/src/dolphiniconsview.h
+++ b/src/dolphiniconsview.h
@@ -60,7 +60,6 @@ protected:
virtual void dragLeaveEvent(QDragLeaveEvent* event);
virtual void dragMoveEvent(QDragMoveEvent* event);
virtual void dropEvent(QDropEvent* event);
- virtual void paintEvent(QPaintEvent* event);
virtual void keyPressEvent(QKeyEvent* event);
virtual void wheelEvent(QWheelEvent* event);
@@ -104,9 +103,7 @@ private:
Qt::Alignment m_displayAlignment;
QSize m_itemSize;
-
- bool m_dragging; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
- QRect m_dropRect; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
+ QRect m_dropRect;
};
#endif
diff --git a/src/draganddrophelper.cpp b/src/draganddrophelper.cpp
index 7095346bc..ab674cd5c 100644
--- a/src/draganddrophelper.cpp
+++ b/src/draganddrophelper.cpp
@@ -25,11 +25,7 @@
#include <QAbstractItemView>
#include <QAbstractProxyModel>
-#include <QBrush>
#include <QDrag>
-#include <QPainter>
-#include <QRect>
-#include <QWidget>
void DragAndDropHelper::startDrag(QAbstractItemView* itemView, Qt::DropActions supportedActions)
{
@@ -57,40 +53,3 @@ void DragAndDropHelper::startDrag(QAbstractItemView* itemView, Qt::DropActions s
drag->exec(supportedActions, Qt::IgnoreAction);
}
}
-
-void DragAndDropHelper::drawHoverIndication(QAbstractItemView* itemView,
- const QRect& bounds,
- const QBrush& brush)
-{
- if (bounds.isEmpty()) {
- return;
- }
-
- QWidget* widget = itemView->viewport();
-
- QPainter painter(widget);
- painter.save();
- QBrush blendedBrush(brush);
- QColor color = blendedBrush.color();
- color.setAlpha(64);
- blendedBrush.setColor(color);
-
- if (dynamic_cast<DolphinIconsView*>(itemView)) {
- const int radius = 10;
- QPainterPath path(QPointF(bounds.left(), bounds.top() + radius));
- path.quadTo(bounds.left(), bounds.top(), bounds.left() + radius, bounds.top());
- path.lineTo(bounds.right() - radius, bounds.top());
- path.quadTo(bounds.right(), bounds.top(), bounds.right(), bounds.top() + radius);
- path.lineTo(bounds.right(), bounds.bottom() - radius);
- path.quadTo(bounds.right(), bounds.bottom(), bounds.right() - radius, bounds.bottom());
- path.lineTo(bounds.left() + radius, bounds.bottom());
- path.quadTo(bounds.left(), bounds.bottom(), bounds.left(), bounds.bottom() - radius);
- path.closeSubpath();
-
- painter.setRenderHint(QPainter::Antialiasing);
- painter.fillPath(path, blendedBrush);
- } else {
- painter.fillRect(bounds, blendedBrush);
- }
- painter.restore();
-}
diff --git a/src/draganddrophelper.h b/src/draganddrophelper.h
index 8e1e4531f..93f9ddd12 100644
--- a/src/draganddrophelper.h
+++ b/src/draganddrophelper.h
@@ -28,7 +28,7 @@ class QRect;
class QWidget;
/**
- * @brief Helper class to bypass some drag & drop limitations in Qt.
+ * @brief Helper class for having a common drag and drop behavior.
*
* The class is used by DolphinIconsView, DolphinDetailsView,
* DolphinColumnView and SidebarTreeView to have a consistent
@@ -42,11 +42,6 @@ public:
* Creates a drag object for the view \a itemView for all selected items.
*/
static void startDrag(QAbstractItemView* itemView, Qt::DropActions supportedActions);
-
- // TODO: remove this method when the issue #160611 is solved in Qt 4.4
- static void drawHoverIndication(QAbstractItemView* itemView,
- const QRect& bounds,
- const QBrush& brush);
};
#endif
diff --git a/src/sidebartreeview.cpp b/src/sidebartreeview.cpp
index 5ac3b0cbf..f14ddbacb 100644
--- a/src/sidebartreeview.cpp
+++ b/src/sidebartreeview.cpp
@@ -30,8 +30,7 @@
#include <QScrollBar>
SidebarTreeView::SidebarTreeView(QWidget* parent) :
- QTreeView(parent),
- m_dragging(false)
+ QTreeView(parent)
{
setAcceptDrops(true);
setUniformRowHeights(true);
@@ -95,20 +94,14 @@ void SidebarTreeView::startDrag(Qt::DropActions supportedActions)
void SidebarTreeView::dragEnterEvent(QDragEnterEvent* event)
{
QTreeView::dragEnterEvent(event);
-
if (event->mimeData()->hasUrls()) {
event->acceptProposedAction();
}
-
- m_dragging = true;
}
void SidebarTreeView::dragLeaveEvent(QDragLeaveEvent* event)
{
QTreeView::dragLeaveEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- m_dragging = false;
setDirtyRegion(m_dropRect);
}
@@ -140,18 +133,6 @@ void SidebarTreeView::dropEvent(QDropEvent* event)
emit urlsDropped(urls, index);
}
}
- m_dragging = false;
-}
-
-void SidebarTreeView::paintEvent(QPaintEvent* event)
-{
- QTreeView::paintEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- if (m_dragging) {
- const QBrush& brush = palette().brush(QPalette::Normal, QPalette::Highlight);
- DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
- }
}
#include "sidebartreeview.moc"
diff --git a/src/sidebartreeview.h b/src/sidebartreeview.h
index b2e42e24f..a181290f2 100644
--- a/src/sidebartreeview.h
+++ b/src/sidebartreeview.h
@@ -51,11 +51,9 @@ protected:
virtual void dragLeaveEvent(QDragLeaveEvent* event);
virtual void dragMoveEvent(QDragMoveEvent* event);
virtual void dropEvent(QDropEvent* event);
- virtual void paintEvent(QPaintEvent* event);
private:
- bool m_dragging; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
- QRect m_dropRect; // TODO: remove this property when the issue #160611 is solved in Qt 4.4
+ QRect m_dropRect;
};
#endif