]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Remove unnecessary parameter.
authorJeff Mitchell <mitchell@kde.org>
Thu, 16 Aug 2007 13:22:18 +0000 (13:22 +0000)
committerJeff Mitchell <mitchell@kde.org>
Thu, 16 Aug 2007 13:22:18 +0000 (13:22 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=700798

src/dolphinviewcontainer.cpp
src/renamedialog.cpp
src/renamedialog.h
src/treeviewcontextmenu.cpp

index 59c2e5e3cd87c6477ddacc1044ff07f58c6ec395..dad35463e4595a1a506200730346b36f367129df 100644 (file)
@@ -189,12 +189,11 @@ bool DolphinViewContainer::isActive() const
 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) {
+    if (items.count() > 1) {
         // More than one item has been selected for renaming. Open
         // a rename dialog and rename all items afterwards.
-        RenameDialog dialog(urls, items);
+        RenameDialog dialog(items);
         if (dialog.exec() == QDialog::Rejected) {
             return;
         }
@@ -213,10 +212,10 @@ void DolphinViewContainer::renameSelectedItems()
             Q_ASSERT(replaceIndex >= 0);
             int index = 1;
 
-            KUrl::List::const_iterator it = urls.begin();
-            KUrl::List::const_iterator end = urls.end();
+            QList<KFileItem>::const_iterator it = items.begin();
+            QList<KFileItem>::const_iterator end = items.end();
             while (it != end) {
-                const KUrl& oldUrl = *it;
+                const KUrl& oldUrl = (*it).url();
                 QString number;
                 number.setNum(index++);
 
@@ -234,12 +233,12 @@ void DolphinViewContainer::renameSelectedItems()
     } else {
         // Only one item has been selected for renaming. Use the custom
         // renaming mechanism from the views.
-        Q_ASSERT(urls.count() == 1);
+        Q_ASSERT(items.count() == 1);
 
         // 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, items);
+        RenameDialog dialog(items);
         if (dialog.exec() == QDialog::Rejected) {
             return;
         }
@@ -249,7 +248,7 @@ void DolphinViewContainer::renameSelectedItems()
             view->statusBar()->setMessage(dialog.errorString(),
                                           DolphinStatusBar::Error);
         } else {
-            const KUrl& oldUrl = urls.first();
+            const KUrl& oldUrl = items.first().url();
             KUrl newUrl = oldUrl;
             newUrl.setFileName(newName);
             m_mainWindow->rename(oldUrl, newUrl);
index 6f08f175ec55e3b70903884a88bf35f075f67831..d4d9e16d1dd35468c79a802dc744068d83ecfe59 100644 (file)
 #include <QtGui/QLabel>
 #include <QtGui/QBoxLayout>
 
-RenameDialog::RenameDialog(const KUrl::List& urls, const QList<KFileItem>& items) :
+RenameDialog::RenameDialog(const QList<KFileItem>& items) :
     KDialog(),
     m_renameOneItem(false)
 {
     const QSize minSize = minimumSize();
     setMinimumSize(QSize(320, minSize.height()));
 
-    const int itemCount = urls.count();
+    const int itemCount = items.count();
     Q_ASSERT(itemCount >= 1);
     m_renameOneItem = (itemCount == 1);
 
@@ -65,13 +65,13 @@ RenameDialog::RenameDialog(const KUrl::List& urls, const QList<KFileItem>& items
     }
 
     m_lineEdit = new KLineEdit(page);
-    QString extension = extensionString(urls[0].prettyUrl());
+    QString extension = extensionString(items[0].url().prettyUrl());
     if (extension.length() > 0) {
         // The first item seems to have a extension (e. g. '.jpg' or '.txt'). Now
         // 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 (!urls[i].prettyUrl().contains(extension)) {
+            if (!items[i].url().prettyUrl().contains(extension)) {
                 // at least one item does not have the same extension
                 extension.truncate(0);
                 break;
index 3aa2ff72ddd85a2ad57673a487d35eb576c6879b..516411b3c0c8e5594093d4f7b754b2dcaf29bb29 100644 (file)
@@ -52,7 +52,7 @@ class LIBDOLPHINPRIVATE_EXPORT RenameDialog : public KDialog
     Q_OBJECT
 
 public:
-    explicit RenameDialog(const KUrl::List& urls, const QList<KFileItem>& items);
+    explicit RenameDialog(const QList<KFileItem>& items);
     virtual ~RenameDialog();
 
     /**
index 6437c11a4417834009b2522e2a24082f99cb0bd5..834456e02c09e0dbe7c4bbc081565882821a30f7 100644 (file)
@@ -140,16 +140,15 @@ void TreeViewContextMenu::paste()
 
 void TreeViewContextMenu::rename()
 {
-    const KUrl& oldUrl = m_fileInfo.url();
-    QList<KFileItem> items;
-    items.append(m_fileInfo);
-    RenameDialog dialog(oldUrl, items);
+    QList<KFileItem> item;
+    item.append(m_fileInfo);
+    RenameDialog dialog(item);
     if (dialog.exec() == QDialog::Accepted) {
         const QString& newName = dialog.newName();
         if (!newName.isEmpty()) {
-            KUrl newUrl = oldUrl;
+            KUrl newUrl = m_fileInfo.url();
             newUrl.setFileName(newName);
-            KonqOperations::rename(m_parent, oldUrl, newUrl);
+            KonqOperations::rename(m_parent, m_fileInfo.url(), newUrl);
         }
     }
 }