mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-04 17:30:55 +00:00
Use hover effect from KFileItemDelegate also for the details view and assure that only the column KDirModel::Name can be selected and edited.
svn path=/trunk/KDE/kdebase/apps/; revision=640453
This commit is contained in:
parent
3f76320691
commit
90b0e715d2
|
@ -42,6 +42,9 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
|
|||
setRootIsDecorated(false);
|
||||
setSortingEnabled(true);
|
||||
setUniformRowHeights(true);
|
||||
setSelectionBehavior(SelectItems);
|
||||
|
||||
viewport()->setAttribute(Qt::WA_Hover);
|
||||
|
||||
const ViewProperties props(controller->url());
|
||||
setSortIndicatorSection(props.sorting());
|
||||
|
|
|
@ -622,6 +622,10 @@ void DolphinView::loadDirectory(const KUrl& url)
|
|||
|
||||
void DolphinView::triggerItem(const QModelIndex& index)
|
||||
{
|
||||
if (!isValidNameIndex(index)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
|
||||
if ((modifier & Qt::ShiftModifier) || (modifier & Qt::ControlModifier)) {
|
||||
// items are selected by the user, hence don't trigger the
|
||||
|
@ -893,7 +897,7 @@ void DolphinView::openContextMenu(const QPoint& pos)
|
|||
KFileItem* item = 0;
|
||||
|
||||
const QModelIndex index = itemView()->indexAt(pos);
|
||||
if (index.isValid()) {
|
||||
if (isValidNameIndex(index)) {
|
||||
item = fileItem(index);
|
||||
}
|
||||
|
||||
|
@ -906,7 +910,7 @@ void DolphinView::dropUrls(const KUrl::List& urls,
|
|||
{
|
||||
KFileItem* directory = 0;
|
||||
const QModelIndex index = itemView()->indexAt(pos);
|
||||
if (index.isValid()) {
|
||||
if (isValidNameIndex(index)) {
|
||||
KFileItem* item = fileItem(index);
|
||||
assert(item != 0);
|
||||
if (item->isDir()) {
|
||||
|
@ -1021,4 +1025,9 @@ QAbstractItemView* DolphinView::itemView() const
|
|||
return m_iconsView;
|
||||
}
|
||||
|
||||
bool DolphinView::isValidNameIndex(const QModelIndex& index) const
|
||||
{
|
||||
return index.isValid() && (index.column() == KDirModel::Name);
|
||||
}
|
||||
|
||||
#include "dolphinview.moc"
|
||||
|
|
|
@ -516,6 +516,12 @@ private:
|
|||
*/
|
||||
QAbstractItemView* itemView() const;
|
||||
|
||||
/**
|
||||
* Returns true if the index is valid and represents
|
||||
* the column KDirModel::Name.
|
||||
*/
|
||||
bool isValidNameIndex(const QModelIndex& index) const;
|
||||
|
||||
private:
|
||||
bool m_showProgress;
|
||||
Mode m_mode;
|
||||
|
|
Loading…
Reference in New Issue
Block a user