#include "dolphin_generalsettings.h"
#include "draganddrophelper.h"
#include "selectionmanager.h"
+#include "tooltipmanager.h"
#include <kcolorscheme.h>
#include <kdirlister.h>
m_dolphinModel(0),
m_proxyModel(0),
m_iconManager(0),
- m_dragging(false),
m_dropRect()
{
setMouseTracking(true);
- viewport()->setAttribute(Qt::WA_Hover);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setSelectionBehavior(SelectItems);
setDragDropMode(QAbstractItemView::DragDrop);
setDropIndicatorShown(false);
setSelectionRectVisible(true);
+ setEditTriggers(QAbstractItemView::NoEditTriggers);
setVerticalScrollMode(QListView::ScrollPerPixel);
setHorizontalScrollMode(QListView::ScrollPerPixel);
m_iconManager = new IconManager(this, m_proxyModel);
m_iconManager->setShowPreview(m_view->m_controller->dolphinView()->showPreview());
+ if (DolphinSettings::instance().generalSettings()->showToolTips()) {
+ new ToolTipManager(this, m_proxyModel);
+ }
+
m_dirLister->openUrl(url, KDirLister::NoFlags);
connect(KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()),
setIconSize(size);
m_decorationSize = size;
doItemsLayout();
+ if (m_iconManager != 0) {
+ m_iconManager->updatePreviews();
+ }
}
void DolphinColumnWidget::setActive(bool active)
m_proxyModel->setFilterRegExp(nameFilter);
}
+void DolphinColumnWidget::editItem(const KFileItem& item)
+{
+ const QModelIndex dirIndex = m_dolphinModel->indexForItem(item);
+ const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ if (proxyIndex.isValid()) {
+ edit(proxyIndex);
+ }
+}
QStyleOptionViewItem DolphinColumnWidget::viewOptions() const
{
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);
}
event->acceptProposedAction();
}
QListView::dropEvent(event);
- m_dragging = false;
}
void DolphinColumnWidget::paintEvent(QPaintEvent* event)
if (proxyIndex.isValid() && !selectionModel()->isSelected(proxyIndex)) {
const QRect itemRect = visualRect(proxyIndex);
QPainter painter(viewport());
- painter.save();
-
QColor color = KColorScheme(QPalette::Active, KColorScheme::View).foreground().color();
color.setAlpha(32);
painter.setPen(Qt::NoPen);
painter.setBrush(color);
painter.drawRect(itemRect);
-
- painter.restore();
}
}
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)
// necessary connecting the signal 'singleClick()' or 'doubleClick'.
if (KGlobalSettings::singleClick()) {
disconnect(this, SIGNAL(clicked(const QModelIndex&)),
- this, SLOT(triggerItem(const QModelIndex&)));
+ m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
} else {
disconnect(this, SIGNAL(doubleClicked(const QModelIndex&)),
- this, SLOT(triggerItem(const QModelIndex&)));
+ m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
}
const QModelIndex current = selectionModel()->currentIndex();