]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontroller.cpp
Assure that automatically expanding of a folder also works when the new folder has...
[dolphin.git] / src / dolphincontroller.cpp
index 375eb44035736f06e5394be24098efc5a9b3ba0b..8493d877fa957b63b6d55ad87145d1965d66a31b 100644 (file)
@@ -18,6 +18,7 @@
  ***************************************************************************/
 
 #include "dolphincontroller.h"
+#include "zoomlevelinfo.h"
 
 #include <kdirmodel.h>
 #include <QAbstractProxyModel>
@@ -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),
@@ -58,6 +58,8 @@ void DolphinController::setItemView(QAbstractItemView* view)
     m_itemView = view;
 
     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()));
@@ -82,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);
 }
 
 
@@ -110,14 +112,14 @@ void DolphinController::indicateActivationChange(bool active)
     emit activationChanged(active);
 }
 
-void DolphinController::triggerZoomIn()
+void DolphinController::setZoomLevel(int level)
 {
-    emit zoomIn();
-}
-
-void DolphinController::triggerZoomOut()
-{
-    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)
@@ -151,6 +153,11 @@ void DolphinController::replaceUrlByClipboard()
     }
 }
 
+void DolphinController::emitHideToolTip()
+{
+    emit hideToolTip();
+}
+
 KFileItem DolphinController::itemForIndex(const QModelIndex& index) const
 {
     Q_ASSERT(m_itemView != 0);