┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinpart.cpp
diff options
context:
space:
mode:
authorDavid Faure <[email protected]>2008-01-28 11:33:49 +0000
committerDavid Faure <[email protected]>2008-01-28 11:33:49 +0000
commitcdc40d4398510878e5ff5926be3f87e6ac5108c9 (patch)
tree43f331acaabd4bdf7f61c5c9261d91ba935b352a /src/dolphinpart.cpp
parent83f2397774dc110f7e006f450777088810908b12 (diff)
Centralize three more actions so that they are available in DolphinPart: 'Show preview' 'Show hidden files' 'Categorized sorting'
Found a way of sharing the actions with even less code duplication, discussed it with Peter, but this will be for after 4.0.1 svn path=/branches/KDE/4.0/kdebase/apps/; revision=767566
Diffstat (limited to 'src/dolphinpart.cpp')
-rw-r--r--src/dolphinpart.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index f144109cb..4d2eebcc6 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -93,6 +93,13 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringLi
this, SLOT(slotUrlChanged(KUrl)));
connect(m_view, SIGNAL(modeChanged()),
this, SLOT(updateViewActions()));
+ connect(m_view, SIGNAL(showPreviewChanged()),
+ this, SLOT(slotShowPreviewChanged()));
+ connect(m_view, SIGNAL(showHiddenFilesChanged()),
+ this, SLOT(slotShowHiddenFilesChanged()));
+ connect(m_view, SIGNAL(categorizedSortingChanged()),
+ this, SLOT(slotCategorizedSortingChanged()));
+ // TODO slotSortingChanged
connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
connect(m_view, SIGNAL(additionalInfoChanged()),
@@ -110,7 +117,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringLi
// [Q_PROPERTY introspection?]
// TODO sort_by_* actions
- // TODO show_*_info actions
// TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
// (sort of spacial navigation)
@@ -158,6 +164,15 @@ void DolphinPart::createActions()
QActionGroup* showInformationActionGroup = DolphinView::createAdditionalInformationActionGroup(actionCollection());
connect(showInformationActionGroup, SIGNAL(triggered(QAction*)), m_view, SLOT(toggleAdditionalInfo(QAction*)));
+ KAction* showPreview = DolphinView::createShowPreviewAction(actionCollection());
+ connect(showPreview, SIGNAL(triggered(bool)), m_view, SLOT(setShowPreview(bool)));
+
+ KAction* showInGroups = DolphinView::createShowInGroupsAction(actionCollection());
+ connect(showInGroups, SIGNAL(triggered(bool)), m_view, SLOT(setCategorizedSorting(bool)));
+
+ KAction* showHiddenFiles = DolphinView::createShowHiddenFilesAction(actionCollection());
+ connect(showHiddenFiles, SIGNAL(triggered(bool)), m_view, SLOT(setShowHiddenFiles(bool)));
+
// Go menu
KAction* newDirAction = DolphinView::createNewDirAction(actionCollection());
@@ -457,4 +472,25 @@ void DolphinPart::slotAdditionalInfoChanged()
m_view->updateAdditionalInfoActions(actionCollection());
}
+void DolphinPart::slotShowPreviewChanged()
+{
+ updateViewActions(); // see DolphinMainWindow
+}
+
+void DolphinPart::slotShowHiddenFilesChanged()
+{
+ QAction* showHiddenFilesAction = actionCollection()->action("show_hidden_files");
+ showHiddenFilesAction->setChecked(m_view->showHiddenFiles());
+}
+
+void DolphinPart::slotCategorizedSortingChanged()
+{
+ // Duplicated from DolphinMainWindow too.
+ QAction* showInGroupsAction = actionCollection()->action("show_in_groups");
+ showInGroupsAction->setChecked(m_view->categorizedSorting());
+ showInGroupsAction->setEnabled(m_view->supportsCategorizedSorting());
+}
+
+// TODO a DolphinViewActionHandler for reducing the duplication in the action handling
+
#include "dolphinpart.moc"