this, SLOT(updateSorting(DolphinView::Sorting)));
connect(m_controller, SIGNAL(sortOrderChanged(Qt::SortOrder)),
this, SLOT(updateSortOrder(Qt::SortOrder)));
+ connect(m_controller, SIGNAL(sortFoldersFirstChanged(bool)),
+ this, SLOT(updateSortFoldersFirst(bool)));
connect(m_controller, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList&)),
this, SLOT(updateAdditionalInfo(const KFileItemDelegate::InformationList&)));
connect(m_controller, SIGNAL(itemTriggered(const KFileItem&)),
QColor color = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
if (active) {
- // TODO: emitting urlChanged() is a hack, as the URL hasn't really changed. It
- // bypasses the problem when having a split view and changing the active view to
- // update the some URL dependent states. A nicer approach should be no big deal...
- emit urlChanged(url());
emit selectionChanged(selectedItems());
} else {
color.setAlpha(150);
return m_proxyModel->sortOrder();
}
+void DolphinView::setSortFoldersFirst(bool foldersFirst)
+{
+ if (sortFoldersFirst() != foldersFirst) {
+ updateSortFoldersFirst(foldersFirst);
+ }
+}
+
+bool DolphinView::sortFoldersFirst() const
+{
+ return m_proxyModel->sortFoldersFirst();
+}
+
void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info)
{
const KUrl viewPropsUrl = viewPropertiesUrl();
setSortOrder(order);
}
+void DolphinView::toggleSortFoldersFirst()
+{
+ setSortFoldersFirst(!sortFoldersFirst());
+}
+
void DolphinView::toggleAdditionalInfo(QAction* action)
{
const KFileItemDelegate::Information info =
emit sortOrderChanged(order);
}
+void DolphinView::updateSortFoldersFirst(bool foldersFirst)
+{
+ ViewProperties props(viewPropertiesUrl());
+ props.setSortFoldersFirst(foldersFirst);
+
+ m_proxyModel->setSortFoldersFirst(foldersFirst);
+
+ emit sortFoldersFirstChanged(foldersFirst);
+}
+
void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList& info)
{
ViewProperties props(viewPropertiesUrl());
void DolphinView::restoreCurrentItem()
{
- const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_currentItemUrl);
- if (dirIndex.isValid()) {
- const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
- QAbstractItemView* view = itemView();
- const bool clearSelection = !hasSelection();
- view->setCurrentIndex(proxyIndex);
- if (clearSelection) {
- view->clearSelection();
+ if (!m_currentItemUrl.isEmpty()) {
+ const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_currentItemUrl);
+ if (dirIndex.isValid()) {
+ const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ QAbstractItemView* view = itemView();
+ const bool clearSelection = !hasSelection();
+ view->setCurrentIndex(proxyIndex);
+ if (clearSelection) {
+ view->clearSelection();
+ }
}
+ m_currentItemUrl.clear();
}
}
emit sortOrderChanged(sortOrder);
}
+ const bool sortFoldersFirst = props.sortFoldersFirst();
+ if (sortFoldersFirst != m_proxyModel->sortFoldersFirst()) {
+ m_proxyModel->setSortFoldersFirst(sortFoldersFirst);
+ emit sortFoldersFirstChanged(sortFoldersFirst);
+ }
+
KFileItemDelegate::InformationList info = props.additionalInfo();
if (info != m_fileItemDelegate->showInformation()) {
m_fileItemDelegate->setShowInformation(info);
return m_iconsView;
}
-bool DolphinView::isCutItem(const KFileItem& item) const
-{
- const QMimeData* mimeData = QApplication::clipboard()->mimeData();
- const KUrl::List cutUrls = KUrl::List::fromMimeData(mimeData);
-
- const KUrl& itemUrl = item.url();
- KUrl::List::const_iterator it = cutUrls.begin();
- const KUrl::List::const_iterator end = cutUrls.end();
- while (it != end) {
- if (*it == itemUrl) {
- return true;
- }
- ++it;
- }
-
- return false;
-}
-
void DolphinView::pasteToUrl(const KUrl& url)
{
KonqOperations::doPaste(this, url);