[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.0/kdebase/apps/dolphin/src
From: David Faure <faure () kde ! org>
Date: 2008-01-21 19:42:16
Message-ID: 1200944536.710784.10135.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 764444 by dfaure:
Make sort/descending available in dolphinpart
M +2 -7 dolphinmainwindow.cpp
M +16 -0 dolphinpart.cpp
M +3 -0 dolphinpart.h
M +15 -0 dolphinview.cpp
M +9 -0 dolphinview.h
--- branches/KDE/4.0/kdebase/apps/dolphin/src/dolphinmainwindow.cpp #764443:764444
@@ -650,11 +650,7 @@
void DolphinMainWindow::toggleSortOrder()
{
- DolphinView* view = m_activeViewContainer->view();
- const Qt::SortOrder order = (view->sortOrder() == Qt::AscendingOrder) ?
- Qt::DescendingOrder :
- Qt::AscendingOrder;
- view->setSortOrder(order);
+ m_activeViewContainer->view()->toggleSortOrder();
}
void DolphinMainWindow::toggleSortCategorization()
@@ -1126,8 +1122,7 @@
//sortGroup->addAction(sortByRating);
//sortGroup->addAction(sortByTags);
- KToggleAction* sortDescending = actionCollection()->add<KToggleAction>("descending");
- sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
+ KAction* sortDescending = DolphinView::createSortDescendingAction(actionCollection());
connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder()));
KToggleAction* showInGroups = actionCollection()->add<KToggleAction>("show_in_groups");
--- branches/KDE/4.0/kdebase/apps/dolphin/src/dolphinpart.cpp #764443:764444
@@ -93,6 +93,8 @@
this, SLOT(slotUrlChanged(KUrl)));
connect(m_view, SIGNAL(modeChanged()),
this, SLOT(updateViewActions()));
+ connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
+ this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
QClipboard* clipboard = QApplication::clipboard();
connect(clipboard, SIGNAL(dataChanged()),
@@ -144,6 +146,13 @@
propertiesAction->setShortcut(Qt::ALT+Qt::Key_Return);
connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
+ // View menu
+
+ // TODO sort_by_*
+
+ KAction* sortDescending = DolphinView::createSortDescendingAction(actionCollection());
+ connect(sortDescending, SIGNAL(triggered()), m_view, SLOT(toggleSortOrder()));
+
// Go menu
KAction* newDirAction = DolphinView::createNewDirAction(actionCollection());
@@ -431,4 +440,11 @@
KonqOperations::newDir(m_view, url());
}
+void DolphinPart::slotSortOrderChanged(Qt::SortOrder order)
+{
+ KToggleAction* descending = static_cast<KToggleAction*>(actionCollection()->action("descending"));
+ const bool sortDescending = (order == Qt::DescendingOrder);
+ descending->setChecked(sortDescending);
+}
+
#include "dolphinpart.moc"
--- branches/KDE/4.0/kdebase/apps/dolphin/src/dolphinpart.h #764443:764444
@@ -136,6 +136,9 @@
*/
void createDir();
+ /** Updates the state of the 'Sort Ascending/Descending' action. */
+ void slotSortOrderChanged(Qt::SortOrder);
+
private:
void createActions();
void createGoAction(const char* name, const char* iconName,
--- branches/KDE/4.0/kdebase/apps/dolphin/src/dolphinview.cpp #764443:764444
@@ -794,6 +794,14 @@
emit sortOrderChanged(order);
}
+void DolphinView::toggleSortOrder()
+{
+ const Qt::SortOrder order = (sortOrder() == Qt::AscendingOrder) ?
+ Qt::DescendingOrder :
+ Qt::AscendingOrder;
+ setSortOrder(order);
+}
+
void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList& info)
{
ViewProperties props(viewPropertiesUrl());
@@ -1257,4 +1265,11 @@
return newDirAction;
}
+KAction* DolphinView::createSortDescendingAction(KActionCollection* collection)
+{
+ KToggleAction* sortDescending = collection->add<KToggleAction>("descending");
+ sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
+ return sortDescending;
+}
+
#include "dolphinview.moc"
--- branches/KDE/4.0/kdebase/apps/dolphin/src/dolphinview.h #764443:764444
@@ -369,6 +369,12 @@
static KAction* createNewDirAction(KActionCollection* collection);
/**
+ * Creates the "sort descending" action.
+ * This code is here to share it between the mainwindow and the part
+ */
+ static KAction* createSortDescendingAction(KActionCollection* collection);
+
+ /**
* Returns the action name corresponding to the current view mode
*/
QString currentViewModeActionName() const;
@@ -423,6 +429,9 @@
/** Pastes the clipboard data to this view. */
void paste();
+ /** Switches between an ascending and descending sorting order. */
+ void toggleSortOrder();
+
signals:
/**
* Is emitted if the view has been activated by e. g. a mouse click.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic