svn path=/trunk/KDE/kdebase/apps/; revision=700054
{
DolphinViewContainer* view = m_mainWindow->activeViewContainer();
const KUrl::List urls = m_view->selectedUrls();
{
DolphinViewContainer* view = m_mainWindow->activeViewContainer();
const KUrl::List urls = m_view->selectedUrls();
+ const QList<KFileItem> items = m_view->selectedItems();
if (urls.count() > 1) {
// More than one item has been selected for renaming. Open
// a rename dialog and rename all items afterwards.
if (urls.count() > 1) {
// More than one item has been selected for renaming. Open
// a rename dialog and rename all items afterwards.
- RenameDialog dialog(urls);
+ RenameDialog dialog(urls, items);
if (dialog.exec() == QDialog::Rejected) {
return;
}
if (dialog.exec() == QDialog::Rejected) {
return;
}
// TODO: Think about using KFileItemDelegate as soon as it supports editing.
// Currently the RenameDialog is used, but I'm not sure whether inline renaming
// is a benefit for the user at all -> let's wait for some input first...
// TODO: Think about using KFileItemDelegate as soon as it supports editing.
// Currently the RenameDialog is used, but I'm not sure whether inline renaming
// is a benefit for the user at all -> let's wait for some input first...
- RenameDialog dialog(urls);
+ RenameDialog dialog(urls, items);
if (dialog.exec() == QDialog::Rejected) {
return;
}
if (dialog.exec() == QDialog::Rejected) {
return;
}
#include "renamedialog.h"
#include "renamedialog.h"
#include <klineedit.h>
#include <klocale.h>
#include <QtGui/QLabel>
#include <QtGui/QBoxLayout>
#include <klineedit.h>
#include <klocale.h>
#include <QtGui/QLabel>
#include <QtGui/QBoxLayout>
-RenameDialog::RenameDialog(const KUrl::List& items) :
+RenameDialog::RenameDialog(const KUrl::List& urls, const QList<KFileItem>& items) :
KDialog(),
m_renameOneItem(false)
{
const QSize minSize = minimumSize();
setMinimumSize(QSize(320, minSize.height()));
KDialog(),
m_renameOneItem(false)
{
const QSize minSize = minimumSize();
setMinimumSize(QSize(320, minSize.height()));
- const int itemCount = items.count();
+ const int itemCount = urls.count();
Q_ASSERT(itemCount >= 1);
m_renameOneItem = (itemCount == 1);
Q_ASSERT(itemCount >= 1);
m_renameOneItem = (itemCount == 1);
QLabel* editLabel = 0;
if (m_renameOneItem) {
QLabel* editLabel = 0;
if (m_renameOneItem) {
- const KUrl& url = items.first();
- m_newName = url.fileName();
+ m_newName = items.first().name();
editLabel = new QLabel(i18nc("@label:textbox", "Rename the item <filename>%1</filename> to:", m_newName),
page);
} else {
editLabel = new QLabel(i18nc("@label:textbox", "Rename the item <filename>%1</filename> to:", m_newName),
page);
} else {
}
m_lineEdit = new KLineEdit(page);
}
m_lineEdit = new KLineEdit(page);
- QString extension = extensionString(items[0].prettyUrl());
+ QString extension = extensionString(urls[0].prettyUrl());
if (extension.length() > 0) {
// The first item seems to have a extension (e. g. '.jpg' or '.txt'). Now
if (extension.length() > 0) {
// The first item seems to have a extension (e. g. '.jpg' or '.txt'). Now
- // check whether all other items have the same extension. If this is the
+ // check whether all other URLs have the same extension. If this is the
// case, add this extension to the name suggestion.
for (int i = 1; i < itemCount; ++i) {
// case, add this extension to the name suggestion.
for (int i = 1; i < itemCount; ++i) {
- if (!items[i].prettyUrl().contains(extension)) {
+ if (!urls[i].prettyUrl().contains(extension)) {
// at least one item does not have the same extension
extension.truncate(0);
break;
// at least one item does not have the same extension
extension.truncate(0);
break;
- explicit RenameDialog(const KUrl::List& items);
+ explicit RenameDialog(const KUrl::List& urls, const QList<KFileItem>& items);
virtual ~RenameDialog();
/**
virtual ~RenameDialog();
/**
#include "treeviewcontextmenu.h"
#include "treeviewcontextmenu.h"
#include <kiconloader.h>
#include <kio/deletejob.h>
#include <kmenu.h>
#include <kiconloader.h>
#include <kio/deletejob.h>
#include <kmenu.h>
void TreeViewContextMenu::rename()
{
const KUrl& oldUrl = m_fileInfo.url();
void TreeViewContextMenu::rename()
{
const KUrl& oldUrl = m_fileInfo.url();
- RenameDialog dialog(oldUrl);
+ QList<KFileItem> items;
+ items.append( m_fileInfo );
+ RenameDialog dialog(oldUrl, items);
if (dialog.exec() == QDialog::Accepted) {
const QString& newName = dialog.newName();
if (!newName.isEmpty()) {
if (dialog.exec() == QDialog::Accepted) {
const QString& newName = dialog.newName();
if (!newName.isEmpty()) {