mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
respect the inline-renaming setting also for the Folder Panel (= treeview)
svn path=/trunk/KDE/kdebase/apps/; revision=824946
This commit is contained in:
parent
71634554cf
commit
f067201e9f
|
@ -31,7 +31,6 @@
|
|||
#include <klocale.h>
|
||||
#include <kpropertiesdialog.h>
|
||||
|
||||
#include "renamedialog.h"
|
||||
#include "treeviewsidebarpage.h"
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
|
@ -152,17 +151,7 @@ void TreeViewContextMenu::paste()
|
|||
|
||||
void TreeViewContextMenu::rename()
|
||||
{
|
||||
KFileItemList item;
|
||||
item.append(m_fileInfo);
|
||||
RenameDialog dialog(m_parent, item);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
const QString& newName = dialog.newName();
|
||||
if (!newName.isEmpty()) {
|
||||
KUrl newUrl = m_fileInfo.url();
|
||||
newUrl.setFileName(newName);
|
||||
KonqOperations::rename(m_parent, m_fileInfo.url(), newUrl);
|
||||
}
|
||||
}
|
||||
m_parent->rename(m_fileInfo);
|
||||
}
|
||||
|
||||
void TreeViewContextMenu::moveToTrash()
|
||||
|
|
|
@ -24,12 +24,15 @@
|
|||
#include "dolphinview.h"
|
||||
#include "dolphinsettings.h"
|
||||
#include "dolphin_folderspanelsettings.h"
|
||||
#include "dolphin_generalsettings.h"
|
||||
#include "renamedialog.h"
|
||||
#include "sidebartreeview.h"
|
||||
#include "treeviewcontextmenu.h"
|
||||
|
||||
#include <kfileplacesmodel.h>
|
||||
#include <kdirlister.h>
|
||||
#include <kfileitem.h>
|
||||
#include <konq_operations.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QItemSelection>
|
||||
|
@ -81,6 +84,28 @@ bool TreeViewSidebarPage::showHiddenFiles() const
|
|||
return FoldersPanelSettings::showHiddenFiles();
|
||||
}
|
||||
|
||||
|
||||
void TreeViewSidebarPage::rename(const KFileItem& item)
|
||||
{
|
||||
if (DolphinSettings::instance().generalSettings()->renameInline()) {
|
||||
const QModelIndex dirIndex = m_dolphinModel->indexForItem(item);
|
||||
const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
|
||||
m_treeView->edit(proxyIndex);
|
||||
} else {
|
||||
KFileItemList items;
|
||||
items.append(item);
|
||||
RenameDialog dialog(this, items);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
const QString& newName = dialog.newName();
|
||||
if (!newName.isEmpty()) {
|
||||
KUrl newUrl = item.url();
|
||||
newUrl.setFileName(newName);
|
||||
KonqOperations::rename(this, item.url(), newUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TreeViewSidebarPage::setUrl(const KUrl& url)
|
||||
{
|
||||
if (!url.isValid() || (url == SidebarPage::url())) {
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
void setShowHiddenFiles(bool show);
|
||||
bool showHiddenFiles() const;
|
||||
|
||||
void rename(const KFileItem& item);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* Is emitted if the an URL change is requested.
|
||||
|
|
Loading…
Reference in a new issue