]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
Adding license header in kitemlistviewaccessible
[dolphin.git] / src / views / dolphinview.cpp
index 08e26c5d67408db91472218549e83c78a83d18de..05849729f95b2045794259c8ca2b2c68e72f6325 100644 (file)
@@ -635,7 +635,7 @@ void DolphinView::renameSelectedItems()
          return;
      }
 
-     if (items.count() == 1) {
+     if (items.count() == 1 && GeneralSettings::renameInline()) {
          const int index = m_model->index(items.first());
          m_view->editRole(index, "text");
      } else {
@@ -753,6 +753,20 @@ void DolphinView::hideEvent(QHideEvent* event)
     QWidget::hideEvent(event);
 }
 
+bool DolphinView::event(QEvent* event)
+{
+    /* See Bug 297355
+     * Dolphin leaves file preview tooltips open even when is not visible.
+     *
+     * Hide tool-tip when Dolphin loses focus.
+     */
+    if (event->type() == QEvent::WindowDeactivate) {
+        hideToolTip();
+    }
+
+    return QWidget::event(event);
+}
+
 void DolphinView::activate()
 {
     setActive(true);
@@ -778,6 +792,14 @@ void DolphinView::slotItemsActivated(const QSet<int>& indexes)
         items.append(m_model->fileItem(index));
     }
 
+    if (items.count() > 5) {
+        QString question = QString("Are you sure you want to open %1 items?").arg(items.count());
+        const int answer = KMessageBox::warningYesNo(this, question);
+        if (answer != KMessageBox::Yes) {
+            return;
+        }
+    }
+
     foreach (const KFileItem& item, items) {
         if (item.isDir()) {
             emit tabRequested(item.url());
@@ -1321,6 +1343,10 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre
 
 void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
 {
+    if (index < 0 || index >= m_model->count()) {
+        return;
+    }
+
     if (role == "text") {
         const KFileItem oldItem = m_model->fileItem(index);
         const QString newName = value.toString();