┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinviewactionhandler.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-08-05 20:15:51 +0000
committerPeter Penz <[email protected]>2008-08-05 20:15:51 +0000
commit7308c7d03e182795d6b64d85a3f0725d8af32436 (patch)
tree4d7414dccbfbf6d28864ee2bb3615b3a27a59b26 /src/dolphinviewactionhandler.cpp
parent208549cefcd47b4454b8e38b2c5cb12b82189b7b (diff)
First step of refactoring to improve the zooming capabilities of views:
* Let classes that use DolphinView know about the currently used zoom level. * Provide more zoom levels for all views (the settings dialogs have not been adjusted yet). * Fixed issue that when using the wheel that the enabled state of the zoom actions has not been updated. svn path=/trunk/KDE/kdebase/apps/; revision=842715
Diffstat (limited to 'src/dolphinviewactionhandler.cpp')
-rw-r--r--src/dolphinviewactionhandler.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/dolphinviewactionhandler.cpp b/src/dolphinviewactionhandler.cpp
index cd5880c79..6d735b587 100644
--- a/src/dolphinviewactionhandler.cpp
+++ b/src/dolphinviewactionhandler.cpp
@@ -63,6 +63,8 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view)
this, SLOT(slotShowHiddenFilesChanged()));
connect(view, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(slotSortingChanged(DolphinView::Sorting)));
+ connect(view, SIGNAL(zoomLevelChanged(int)),
+ this, SLOT(slotZoomLevelChanged(int)));
}
void DolphinViewActionHandler::createActions()
@@ -341,16 +343,6 @@ void DolphinViewActionHandler::updateViewActions()
viewModeAction->setChecked(true);
}
- QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
- if (zoomInAction != 0) {
- zoomInAction->setEnabled(m_currentView->isZoomInPossible());
- }
-
- QAction* zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
- if (zoomOutAction != 0) {
- zoomOutAction->setEnabled(m_currentView->isZoomOutPossible());
- }
-
QAction* showPreviewAction = m_actionCollection->action("show_preview");
showPreviewAction->setChecked(m_currentView->showPreview());
@@ -358,6 +350,7 @@ void DolphinViewActionHandler::updateViewActions()
slotAdditionalInfoChanged();
slotCategorizedSortingChanged();
slotSortingChanged(m_currentView->sorting());
+ slotZoomLevelChanged(m_currentView->zoomLevel());
QAction* showHiddenFilesAction = m_actionCollection->action("show_hidden_files");
showHiddenFilesAction->setChecked(m_currentView->showHiddenFiles());
@@ -366,13 +359,15 @@ void DolphinViewActionHandler::updateViewActions()
void DolphinViewActionHandler::zoomIn()
{
- m_currentView->zoomIn();
+ const int level = m_currentView->zoomLevel();
+ m_currentView->setZoomLevel(level + 1);
updateViewActions();
}
void DolphinViewActionHandler::zoomOut()
{
- m_currentView->zoomOut();
+ const int level = m_currentView->zoomLevel();
+ m_currentView->setZoomLevel(level - 1);
updateViewActions();
}
@@ -496,6 +491,19 @@ void DolphinViewActionHandler::slotSortingChanged(DolphinView::Sorting sorting)
}
}
+void DolphinViewActionHandler::slotZoomLevelChanged(int level)
+{
+ QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
+ if (zoomInAction != 0) {
+ zoomInAction->setEnabled(level < m_currentView->zoomLevelMaximum());
+ }
+
+ QAction* zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
+ if (zoomOutAction != 0) {
+ zoomOutAction->setEnabled(level > m_currentView->zoomLevelMinimum());
+ }
+}
+
void DolphinViewActionHandler::slotSortTriggered(QAction* action)
{
const DolphinView::Sorting sorting = action->data().value<DolphinView::Sorting>();