X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/86ce0d761da4897b66d61fbda04bc02256db0618..50eaec7a81faaeccc5dbcc2f47cbd982a7dd7207:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 986ecfaf8..233c7007a 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -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 @@ -619,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); @@ -760,6 +767,14 @@ void DolphinView::slotItemsActivated(const QSet& 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()); @@ -1315,10 +1330,16 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList& 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 data; + data.insert(role, value); + m_model->setData(index, data); + + KonqOperations::rename(this, oldUrl, newName); } } } @@ -1459,7 +1480,7 @@ KUrl::List DolphinView::simplifiedSelectedUrls() const KUrl::List urls; const KFileItemList items = selectedItems(); - foreach (const KFileItem &item, items) { + foreach (const KFileItem& item, items) { urls.append(item.url()); } @@ -1484,7 +1505,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);