const DolphinView* dolphinView = m_view->m_controller->dolphinView();
m_proxyModel->setSorting(dolphinView->sorting());
m_proxyModel->setSortOrder(dolphinView->sortOrder());
+ m_proxyModel->setSortFoldersFirst(dolphinView->sortFoldersFirst());
setModel(m_proxyModel);
m_decorationSize = size;
doItemsLayout();
if (m_previewGenerator != 0) {
- m_previewGenerator->updatePreviews();
+ m_previewGenerator->updateIcons();
}
if (m_selectionManager != 0) {
m_selectionManager->reset();
m_proxyModel->setSortOrder(order);
}
+void DolphinColumnWidget::setSortFoldersFirst(bool foldersFirst)
+{
+ m_proxyModel->setSortFoldersFirst(foldersFirst);
+}
+
void DolphinColumnWidget::setShowHiddenFiles(bool show)
{
if (show != m_dirLister->showingDotFiles()) {
{
QListView::keyPressEvent(event);
requestActivation();
- m_view->m_controller->handleKeyPressEvent(event);
+
+ DolphinController* controller = m_view->m_controller;
+ controller->handleKeyPressEvent(event);
+ switch (event->key()) {
+ case Qt::Key_Right: {
+ // Special key handling for the column: A Key_Right should
+ // open a new column for the currently selected folder.
+ const QModelIndex index = currentIndex();
+ const KFileItem item = controller->itemForIndex(index);
+ if (!item.isNull() && item.isDir()) {
+ controller->emitItemTriggered(item);
+ }
+ break;
+ }
+
+ case Qt::Key_Escape:
+ selectionModel()->setCurrentIndex(selectionModel()->currentIndex(),
+ QItemSelectionModel::Current |
+ QItemSelectionModel::Clear);
+ break;
+
+ default:
+ break;
+ }
+
if (m_toolTipManager != 0) {
m_toolTipManager->hideTip();
}
clearSelection();
}
+ if (m_toolTipManager != 0) {
+ m_toolTipManager->hideTip();
+ }
+
const QPoint pos = m_view->viewport()->mapFromGlobal(event->globalPos());
Q_ASSERT(m_view->m_controller->itemView() == this);
- m_view->m_controller->triggerContextMenuRequest(event->pos());
+ m_view->m_controller->triggerContextMenuRequest(pos);
}
void DolphinColumnWidget::wheelEvent(QWheelEvent* event)
m_view->m_controller->emitItemEntered(index);
}
+void DolphinColumnWidget::slotClicked(const QModelIndex& index)
+{
+ DolphinController* controller = m_view->m_controller;
+ if (KGlobalSettings::singleClick()) {
+ controller->triggerItem(index);
+ } else {
+ // even when using double click, a directory should be opened
+ // after the first click
+ const KFileItem item = controller->itemForIndex(index);
+ if (!item.isNull() && item.isDir()) {
+ controller->triggerItem(index);
+ }
+ }
+}
+
+void DolphinColumnWidget::slotDoubleClicked(const QModelIndex& index)
+{
+ if (!KGlobalSettings::singleClick()) {
+ m_view->m_controller->triggerItem(index);
+ }
+}
+
void DolphinColumnWidget::requestActivation()
{
m_view->m_controller->setItemView(this);
{
setFocus(Qt::OtherFocusReason);
- if (KGlobalSettings::singleClick()) {
- connect(this, SIGNAL(clicked(const QModelIndex&)),
+ connect(this, SIGNAL(clicked(const QModelIndex&)),
m_view->m_controller, SLOT(requestTab(const QModelIndex&)));
- connect(this, SIGNAL(clicked(const QModelIndex&)),
- m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
- } else {
- connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
- m_view->m_controller, SLOT(requestTab(const QModelIndex&)));
- connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
- m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
- }
+ connect(this, SIGNAL(clicked(const QModelIndex&)),
+ this, SLOT(slotClicked(const QModelIndex&)));
+ connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
+ this, SLOT(slotDoubleClicked(const QModelIndex&)));
- if (selectionModel() && selectionModel()->currentIndex().isValid())
+ if (selectionModel() && selectionModel()->currentIndex().isValid()) {
selectionModel()->setCurrentIndex(selectionModel()->currentIndex(), QItemSelectionModel::SelectCurrent);
+ }
updateBackground();
}
void DolphinColumnWidget::deactivate()
{
clearFocus();
- if (KGlobalSettings::singleClick()) {
- disconnect(this, SIGNAL(clicked(const QModelIndex&)),
- m_view->m_controller, SLOT(requestTab(const QModelIndex&)));
- disconnect(this, SIGNAL(clicked(const QModelIndex&)),
- m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
- } else {
- disconnect(this, SIGNAL(doubleClicked(const QModelIndex&)),
- m_view->m_controller, SLOT(requestTab(const QModelIndex&)));
- disconnect(this, SIGNAL(doubleClicked(const QModelIndex&)),
- m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
- }
+ disconnect(this, SIGNAL(clicked(const QModelIndex&)),
+ m_view->m_controller, SLOT(requestTab(const QModelIndex&)));
+ disconnect(this, SIGNAL(clicked(const QModelIndex&)),
+ this, SLOT(slotClicked(const QModelIndex&)));
+ disconnect(this, SIGNAL(doubleClicked(const QModelIndex&)),
+ this, SLOT(slotDoubleClicked(const QModelIndex&)));
+
const QModelIndex current = selectionModel()->currentIndex();
selectionModel()->clear();
selectionModel()->setCurrentIndex(current, QItemSelectionModel::NoUpdate);