X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/baed5a65d40d122bef4e87f64a1de00dbfb11687..3c1efcb738e7ee6a00030f521138f81625e84b96:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index d26f14061..e7c919ad8 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -93,6 +93,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringLi 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,16 +146,18 @@ void DolphinPart::createActions() propertiesAction->setShortcut(Qt::ALT+Qt::Key_Return); connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties())); - // This action doesn't appear in the GUI, it's for the shortcut only. - // KNewMenu takes care of the GUI stuff. - KAction* newDirAction = actionCollection()->addAction( "create_dir" ); - newDirAction->setText( i18n("Create Folder..." ) ); - connect(newDirAction, SIGNAL(triggered()), SLOT(slotNewDir())); - newDirAction->setShortcut(Qt::Key_F10); - widget()->addAction(newDirAction); + // 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()); + connect(newDirAction, SIGNAL(triggered()), SLOT(createDir())); + QActionGroup* goActionGroup = new QActionGroup(this); connect(goActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotGoTriggered(QAction*))); @@ -414,11 +418,6 @@ void DolphinPart::slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers mod m_view->trashSelectedItems(); } -void DolphinPart::slotNewDir() -{ - KonqOperations::newDir(widget(), url()); -} - void DolphinPart::slotEditMimeType() { const KFileItemList items = m_view->selectedItems(); @@ -436,4 +435,16 @@ void DolphinPart::slotProperties() } } +void DolphinPart::createDir() +{ + KonqOperations::newDir(m_view, url()); +} + +void DolphinPart::slotSortOrderChanged(Qt::SortOrder order) +{ + KToggleAction* descending = static_cast(actionCollection()->action("descending")); + const bool sortDescending = (order == Qt::DescendingOrder); + descending->setChecked(sortDescending); +} + #include "dolphinpart.moc"