#include "dolphinsortfilterproxymodel.h"
#include "dolphinsettings.h"
#include "dolphin_columnmodesettings.h"
+#include "dolphin_generalsettings.h"
#include "draganddrophelper.h"
+#include "selectionmanager.h"
#include <kcolorscheme.h>
#include <kdirlister.h>
setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setSelectionBehavior(SelectItems);
setSelectionMode(QAbstractItemView::ExtendedSelection);
setDragDropMode(QAbstractItemView::DragDrop);
m_font.setBold(settings->boldFont());
const int iconSize = settings->iconSize();
- m_decorationSize = QSize(iconSize, iconSize);
+ setDecorationSize(QSize(iconSize, iconSize));
KFileItemDelegate* delegate = new KFileItemDelegate(this);
setItemDelegate(delegate);
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
setModel(m_proxyModel);
+ const bool useSelManager = KGlobalSettings::singleClick() &&
+ DolphinSettings::instance().generalSettings()->showSelectionToggle();
+ if (useSelManager) {
+ SelectionManager* selManager = new SelectionManager(this);
+ connect(selManager, SIGNAL(selectionChanged()),
+ this, SLOT(requestActivation()));
+ connect(m_view->m_controller, SIGNAL(urlChanged(const KUrl&)),
+ selManager, SLOT(reset()));
+}
new KMimeTypeResolver(this, m_dolphinModel);
m_iconManager = new IconManager(this, m_proxyModel);
m_iconManager->setShowPreview(m_view->m_controller->dolphinView()->showPreview());
void DolphinColumnWidget::setDecorationSize(const QSize& size)
{
+ setIconSize(size);
m_decorationSize = size;
doItemsLayout();
}
void DolphinColumnWidget::setShowPreview(bool show)
{
- kDebug() << "-------------- column widget: show" << show;
m_iconManager->setShowPreview(show);
m_dirLister->stop();
void DolphinColumnWidget::mousePressEvent(QMouseEvent* event)
{
- m_view->m_controller->requestActivation();
- if (!m_active) {
- m_view->requestActivation(this);
- m_view->m_controller->triggerUrlChangeRequest(m_url);
- }
-
+ requestActivation();
QListView::mousePressEvent(event);
}
m_view->m_controller->emitItemEntered(item);
}
+void DolphinColumnWidget::requestActivation()
+{
+ m_view->m_controller->requestActivation();
+ if (!m_active) {
+ m_view->requestActivation(this);
+ m_view->m_controller->triggerUrlChangeRequest(m_url);
+ selectionModel()->clear();
+ }
+}
+
void DolphinColumnWidget::activate()
{
setFocus(Qt::OtherFocusReason);
this, SLOT(triggerItem(const QModelIndex&)));
}
- if (!m_childUrl.isEmpty()) {
- // assure that the current index is set on the index that represents
- // the child URL
- const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_childUrl);
- const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
- selectionModel()->setCurrentIndex(proxyIndex, QItemSelectionModel::Current);
- }
+ if (selectionModel() && selectionModel()->currentIndex().isValid())
+ selectionModel()->setCurrentIndex(selectionModel()->currentIndex(), QItemSelectionModel::SelectCurrent);
updateBackground();
}
this, SLOT(triggerItem(const QModelIndex&)));
}
+ const QModelIndex current = selectionModel()->currentIndex();
selectionModel()->clear();
+ selectionModel()->setCurrentIndex(current, QItemSelectionModel::NoUpdate);
updateBackground();
}