#include "dolphinsettings.h"
#include "dolphinsortfilterproxymodel.h"
#include "draganddrophelper.h"
+#include "selectionmanager.h"
#include "viewproperties.h"
#include "dolphin_detailsmodesettings.h"
+#include "dolphin_generalsettings.h"
#include <kdirmodel.h>
#include <klocale.h>
DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* controller) :
QTreeView(parent),
+ m_autoResize(true),
m_controller(controller),
m_font(),
m_decorationSize(),
headerView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(headerView, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(configureColumns(const QPoint&)));
+ connect(headerView, SIGNAL(sectionResized(int, int, int)),
+ this, SLOT(slotHeaderSectionResized(int, int, int)));
+ connect(headerView, SIGNAL(sectionHandleDoubleClicked(int)),
+ this, SLOT(disableAutoResizing()));
connect(parent, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(setSortIndicatorSection(DolphinView::Sorting)));
if (KGlobalSettings::singleClick()) {
connect(this, SIGNAL(clicked(const QModelIndex&)),
this, SLOT(triggerItem(const QModelIndex&)));
+ if (DolphinSettings::instance().generalSettings()->showSelectionToggle()) {
+ SelectionManager* selManager = new SelectionManager(this);
+ connect(selManager, SIGNAL(selectionChanged()),
+ this, SLOT(requestActivation()));
+ }
} else {
connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
this, SLOT(triggerItem(const QModelIndex&)));
this, SLOT(zoomIn()));
connect(controller, SIGNAL(zoomOut()),
this, SLOT(zoomOut()));
- connect(controller->dolphinView(), SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList&)),
+ connect(controller->dolphinView(), SIGNAL(additionalInfoChanged()),
this, SLOT(updateColumnVisibility()));
// apply the details mode settings to the widget
void DolphinDetailsView::resizeEvent(QResizeEvent* event)
{
QTreeView::resizeEvent(event);
-
- // TODO: There seems to be no easy way to find out whether the resize event
- // has been triggered because of resizing the window or by adjusting the column-width
- // by a left mouse-click (the columns should only be resized automatically when the window
- // size is adjusted). The following workaround works well, but it should be
- // considered solving this in a more transparent way.
- if (!(QApplication::mouseButtons() & Qt::LeftButton)) {
+ if (m_autoResize) {
resizeColumns();
}
}
resizeColumns();
}
+void DolphinDetailsView::slotHeaderSectionResized(int logicalIndex, int oldSize, int newSize)
+{
+ Q_UNUSED(logicalIndex);
+ Q_UNUSED(oldSize);
+ Q_UNUSED(newSize);
+ if (QApplication::mouseButtons() & Qt::LeftButton) {
+ disableAutoResizing();
+ }
+}
+
+void DolphinDetailsView::disableAutoResizing()
+{
+ m_autoResize = false;
+}
+
+void DolphinDetailsView::requestActivation()
+{
+ m_controller->requestActivation();
+}
+
bool DolphinDetailsView::isZoomInPossible() const
{
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
{
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
const int iconSize = settings->iconSize();
+ setIconSize(QSize(iconSize, iconSize));
m_decorationSize = QSize(iconSize, iconSize);
m_controller->setZoomInPossible(isZoomInPossible());