]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
Fix regression: Open file if entering it in the URL-navigator
[dolphin.git] / src / views / dolphinview.cpp
index 6a21885e62d559f3a231a1d0eaa60249503e93e3..7cfb3fc41d258ef5af451c15eec26f8cb990b205 100644 (file)
@@ -160,6 +160,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     connect(m_model, SIGNAL(infoMessage(QString)),            this, SIGNAL(infoMessage(QString)));
     connect(m_model, SIGNAL(errorMessage(QString)),           this, SIGNAL(errorMessage(QString)));
     connect(m_model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
+    connect(m_model, SIGNAL(urlIsFileError(KUrl)),            this, SIGNAL(urlIsFileError(KUrl)));
 
     m_view->installEventFilter(this);
     connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
@@ -259,8 +260,14 @@ void DolphinView::setPreviewsShown(bool show)
     ViewProperties props(viewPropertiesUrl());
     props.setPreviewsShown(show);
 
+    const int oldZoomLevel = m_view->zoomLevel();
     m_view->setPreviewsShown(show);
     emit previewsShownChanged(show);
+
+    const int newZoomLevel = m_view->zoomLevel();
+    if (newZoomLevel != oldZoomLevel) {
+        emit zoomLevelChanged(newZoomLevel, oldZoomLevel);
+    }
 }
 
 bool DolphinView::previewsShown() const
@@ -382,6 +389,7 @@ void DolphinView::setZoomLevel(int level)
     const int oldZoomLevel = zoomLevel();
     m_view->setZoomLevel(level);
     if (zoomLevel() != oldZoomLevel) {
+        hideToolTip();
         emit zoomLevelChanged(zoomLevel(), oldZoomLevel);
     }
 }
@@ -618,7 +626,7 @@ void DolphinView::renameSelectedItems()
 
      if (items.count() == 1) {
          const int index = m_model->index(items.first());
-         m_container->controller()->view()->editRole(index, "text");
+         m_view->editRole(index, "text");
      } else {
          RenameDialog* dialog = new RenameDialog(this, items);
          dialog->setAttribute(Qt::WA_DeleteOnClose);
@@ -1314,10 +1322,16 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre
 void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
 {
     if (role == "text") {
-        const KFileItem item = m_model->fileItem(index);
+        const KFileItem oldItem = m_model->fileItem(index);
         const QString newName = value.toString();
-        if (!newName.isEmpty() && newName != item.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) {
-            KonqOperations::rename(this, item.url(), newName);
+        if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) {
+            const KUrl oldUrl = oldItem.url();
+
+            QHash<QByteArray, QVariant> data;
+            data.insert(role, value);
+            m_model->setData(index, data);
+
+            KonqOperations::rename(this, oldUrl, newName);
         }
     }
 }
@@ -1458,7 +1472,7 @@ KUrl::List DolphinView::simplifiedSelectedUrls() const
     KUrl::List urls;
 
     const KFileItemList items = selectedItems();
-    foreach (const KFileItem &item, items) {
+    foreach (const KFileItemitem, items) {
         urls.append(item.url());
     }
 
@@ -1483,7 +1497,7 @@ void DolphinView::markPastedUrlsAsSelected(const QMimeData* mimeData)
     const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData);
     KUrl::List destUrls;
     foreach (const KUrl& source, sourceUrls) {
-        KUrl destination(url().url() + "/" + source.fileName());
+        KUrl destination(url().url() + '/' + source.fileName());
         destUrls << destination;
     }
     markUrlsAsSelected(destUrls);