X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/3d4e6938f57fcf010b4fda7255384098327eb67d..51cbeaf512da9ebaefb0bfcaa21cca0f47d1b79d:/src/dolphindetailsview.cpp diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index df5246bed..75481fb36 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -54,17 +54,19 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr m_elasticBandOrigin(), m_elasticBandDestination() { + const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); + Q_ASSERT(settings != 0); Q_ASSERT(controller != 0); setAcceptDrops(true); - setRootIsDecorated(false); setSortingEnabled(true); setUniformRowHeights(true); setSelectionBehavior(SelectItems); setDragDropMode(QAbstractItemView::DragDrop); setDropIndicatorShown(false); setAlternatingRowColors(true); - setItemsExpandable(false); + setRootIsDecorated(settings->expandableFolders()); + setItemsExpandable(settings->expandableFolders()); setMouseTracking(true); viewport()->setAttribute(Qt::WA_Hover); @@ -118,11 +120,14 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr connect(controller->dolphinView(), SIGNAL(additionalInfoChanged()), this, SLOT(updateColumnVisibility())); - // apply the details mode settings to the widget - const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); - Q_ASSERT(settings != 0); - - m_font = QFont(settings->fontFamily(), settings->fontSize()); + if (settings->useSystemFont()) { + m_font = KGlobalSettings::generalFont(); + } else { + m_font = QFont(settings->fontFamily(), + settings->fontSize(), + settings->fontWeight(), + settings->italicFont()); + } // TODO: Remove this check when 4.3.2 is released and KDE requires it... this // check avoids a division by zero happening on versions before 4.3.1. @@ -136,6 +141,9 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr updateDecorationSize(); setFocus(); + + connect(KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), + this, SLOT(updateFont())); } DolphinDetailsView::~DolphinDetailsView() @@ -229,11 +237,30 @@ void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event) setSelection(selRect, QItemSelectionModel::Select); } - QTreeView::mouseMoveEvent(event); + // TODO: see comment at end of method + // QTreeView::mouseMoveEvent(event); + QAbstractItemView::mouseMoveEvent(event); updateElasticBand(); } else { - QTreeView::mouseMoveEvent(event); + // TODO: see comment at end of method + //QTreeView::mouseMoveEvent(event); + QAbstractItemView::mouseMoveEvent(event); } + + // The original implementation of QTreeView::mouseMoveEvent() looks like this (Qt4.4): + // + // void QTreeView::mouseMoveEvent(QMouseEvent *event) + // { + // Q_D(QTreeView); + // if (d->itemDecorationAt(event->pos()) == -1) // ### what about expanding/collapsing state ? + // QAbstractItemView::mouseMoveEvent(event); + // } + // + // This prevents that the signal 'entered()' is emitted when the mouse is above a decoration, + // although the hovered item has changed. The SelectionManager is connected to 'entered()' + // and assumes that the old item is selected. This is currently bypassed by skipping + // the base implementation and invoking QAbstractItemView::mouseMoveEvent() directly. + // Submitted a bug report to Trolltech, bug ID is still pending. } void DolphinDetailsView::mouseReleaseEvent(QMouseEvent* event) @@ -532,6 +559,16 @@ void DolphinDetailsView::requestActivation() m_controller->requestActivation(); } +void DolphinDetailsView::updateFont() +{ + const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); + Q_ASSERT(settings != 0); + + if (settings->useSystemFont()) { + m_font = KGlobalSettings::generalFont(); + } +} + bool DolphinDetailsView::isZoomInPossible() const { DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();