X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/8677eafd24e2d40cc14a9e6dcb9069d183877df8..11289b4fc3efbc074b668d4516cd896f8ade9761:/src/dolphincontroller.cpp diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index b00ca7160..8493d877f 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -18,6 +18,7 @@ ***************************************************************************/ #include "dolphincontroller.h" +#include "zoomlevelinfo.h" #include #include @@ -27,8 +28,7 @@ DolphinController::DolphinController(DolphinView* dolphinView) : QObject(dolphinView), - m_zoomInPossible(false), - m_zoomOutPossible(false), + m_zoomLevel(0), m_openTab(false), m_url(), m_dolphinView(dolphinView), @@ -57,9 +57,13 @@ void DolphinController::setItemView(QAbstractItemView* view) 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) @@ -80,11 +84,11 @@ void DolphinController::requestActivation() emit activated(); } -void DolphinController::indicateDroppedUrls(const KUrl::List& urls, +void DolphinController::indicateDroppedUrls(const KFileItem& destItem, const KUrl& destPath, - const KFileItem& destItem) + QDropEvent* event) { - emit urlsDropped(urls, destPath, destItem); + emit urlsDropped(destItem, destPath, event); } @@ -108,14 +112,14 @@ void DolphinController::indicateActivationChange(bool active) 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) @@ -149,6 +153,11 @@ void DolphinController::replaceUrlByClipboard() } } +void DolphinController::emitHideToolTip() +{ + emit hideToolTip(); +} + KFileItem DolphinController::itemForIndex(const QModelIndex& index) const { Q_ASSERT(m_itemView != 0);