┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphinviewcontainer.cpp5
-rw-r--r--src/renamedialog.cpp14
-rw-r--r--src/renamedialog.h3
-rw-r--r--src/treeviewcontextmenu.cpp5
4 files changed, 16 insertions, 11 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 32d5a407f..59c2e5e3c 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -190,10 +190,11 @@ void DolphinViewContainer::renameSelectedItems()
{
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.
- RenameDialog dialog(urls);
+ RenameDialog dialog(urls, items);
if (dialog.exec() == QDialog::Rejected) {
return;
}
@@ -238,7 +239,7 @@ void DolphinViewContainer::renameSelectedItems()
// 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;
}
diff --git a/src/renamedialog.cpp b/src/renamedialog.cpp
index d65330cdd..6f08f175e 100644
--- a/src/renamedialog.cpp
+++ b/src/renamedialog.cpp
@@ -19,20 +19,21 @@
#include "renamedialog.h"
+#include <kfileitem.h>
#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()));
- const int itemCount = items.count();
+ const int itemCount = urls.count();
Q_ASSERT(itemCount >= 1);
m_renameOneItem = (itemCount == 1);
@@ -52,8 +53,7 @@ RenameDialog::RenameDialog(const KUrl::List& items) :
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 {
@@ -65,13 +65,13 @@ RenameDialog::RenameDialog(const KUrl::List& items) :
}
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
- // 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) {
- 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;
diff --git a/src/renamedialog.h b/src/renamedialog.h
index d6adb6f95..3aa2ff72d 100644
--- a/src/renamedialog.h
+++ b/src/renamedialog.h
@@ -25,6 +25,7 @@
#include <kurl.h>
+class KFileItem;
class KLineEdit;
/**
@@ -51,7 +52,7 @@ class LIBDOLPHINPRIVATE_EXPORT RenameDialog : public KDialog
Q_OBJECT
public:
- explicit RenameDialog(const KUrl::List& items);
+ explicit RenameDialog(const KUrl::List& urls, const QList<KFileItem>& items);
virtual ~RenameDialog();
/**
diff --git a/src/treeviewcontextmenu.cpp b/src/treeviewcontextmenu.cpp
index f4469776b..1e6583e55 100644
--- a/src/treeviewcontextmenu.cpp
+++ b/src/treeviewcontextmenu.cpp
@@ -20,6 +20,7 @@
#include "treeviewcontextmenu.h"
+#include <kfileitem.h>
#include <kiconloader.h>
#include <kio/deletejob.h>
#include <kmenu.h>
@@ -140,7 +141,9 @@ void TreeViewContextMenu::paste()
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()) {