void DolphinView::setSortOrder(Qt::SortOrder order) { if (sortOrder() != order) { KFileView* view = fileView(); int sorting = view->sorting(); sorting = (order == Qt::Ascending) ? (sorting & ~QDir::Reversed) : (sorting | QDir::Reversed); ViewProperties props(url()); props.setSortOrder(order); view->setSorting(static_cast<QDir::SortSpec>(sorting)); emit signalSortOrderChanged(order); } }
void DolphinView::setSorting(Sorting sorting) { if (sorting != this->sorting()) { KFileView* view = fileView(); int spec = view->sorting() & ~QDir::Name & ~QDir::Size & ~QDir::Time & ~QDir::Unsorted; switch (sorting) { case SortByName: spec = spec | QDir::Name; break; case SortBySize: spec = spec | QDir::Size; break; case SortByDate: spec = spec | QDir::Time; break; default: break; } ViewProperties props(url()); props.setSorting(sorting); view->setSorting(static_cast<QDir::SortSpec>(spec)); emit signalSortingChanged(sorting); } }