***************************************************************************/
#include "dolphincontroller.h"
+#include "zoomlevelinfo.h"
#include <kdirmodel.h>
#include <QAbstractProxyModel>
DolphinController::DolphinController(DolphinView* dolphinView) :
QObject(dolphinView),
- m_zoomInPossible(false),
- m_zoomOutPossible(false),
+ m_zoomLevel(0),
m_openTab(false),
m_url(),
m_dolphinView(dolphinView),
m_itemView = view;
- // TODO: this is a workaround until Qt-issue 176832 has been fixed
- connect(m_itemView, SIGNAL(pressed(const QModelIndex&)),
- this, SLOT(updateOpenTabState()));
+ if (m_itemView != 0) {
+ m_zoomLevel = ZoomLevelInfo::zoomLevelForIconSize(m_itemView->iconSize());
+
+ // TODO: this is a workaround until Qt-issue 176832 has been fixed
+ connect(m_itemView, SIGNAL(pressed(const QModelIndex&)),
+ this, SLOT(updateOpenTabState()));
+ }
}
void DolphinController::triggerUrlChangeRequest(const KUrl& url)
emit activationChanged(active);
}
-void DolphinController::triggerZoomIn()
-{
- emit zoomIn();
-}
-
-void DolphinController::triggerZoomOut()
+void DolphinController::setZoomLevel(int level)
{
- emit zoomOut();
+ Q_ASSERT(level >= ZoomLevelInfo::minimumLevel());
+ Q_ASSERT(level <= ZoomLevelInfo::maximumLevel());
+ if (level != m_zoomLevel) {
+ m_zoomLevel = level;
+ emit zoomLevelChanged(m_zoomLevel);
+ }
}
void DolphinController::handleKeyPressEvent(QKeyEvent* event)