Bug 100607 - 3.4rc1: cannot rename "network folders"
Summary: 3.4rc1: cannot rename "network folders"
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: remote (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Kevin Ottens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-02 00:53 UTC by Jens
Modified: 2006-03-24 03:57 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens 2005-03-02 00:53:48 UTC
Version:            (using KDE 3.4.0 Level "a" , SUSE 9.2 UNSUPPORTED)
Compiler:          gcc version 3.3.4 (pre 3.3.5 20040809)
OS:                Linux (i686) release 2.6.8-24.11-default

How to reproduce:
- create a "network share" via remote:/ protocol.
- Try to rename this via F2 or properties dialog.

This does not work - plus, KDE tells me "Creating symlinks is not supported with protocol remote", which is a bit confusing.

Please disable the properties dialog for network folders if those operations are not (yet) possible.

Thank you!

Jens
Comment 1 Kevin Ottens 2005-03-02 21:39:38 UTC
CVS commit by ervin: 

We now allow to rename a Network Folder.
I simply forgot to do it earlier. :-)

BUGS:100607


  M +17 -0     kio_remote.cpp   1.8
  M +1 -0      kio_remote.h   1.6
  M +29 -0     remoteimpl.cpp   1.4
  M +2 -0      remoteimpl.h   1.3


--- kdebase/kioslave/remote/kio_remote.cpp  #1.7:1.8
@@ -193,3 +193,20 @@ void RemoteProtocol::get(const KURL &url
 }
 
+void RemoteProtocol::rename(const KURL &src, const KURL &dest,
+                            bool overwrite)
+{
+        if (src.protocol()!="remote" || dest.protocol()!="remote"
+         || m_impl.isWizardURL(src) || m_impl.isWizardURL(dest))
+        {
+                error(KIO::ERR_UNSUPPORTED_ACTION, src.prettyURL());
+                return;
+        }
 
+        if (m_impl.renameFolders(src.fileName(), dest.fileName(), overwrite))
+        {
+                finished();
+                return;
+        }
+
+        error(KIO::ERR_CANNOT_RENAME, src.prettyURL());
+}

--- kdebase/kioslave/remote/kio_remote.h  #1.5:1.6
@@ -35,4 +35,5 @@ public:
         virtual void del(const KURL &url, bool isFile);
         virtual void get(const KURL &url);
+        virtual void rename(const KURL &src, const KURL &dest, bool overwrite);
 
 private:

--- kdebase/kioslave/remote/remoteimpl.cpp  #1.3:1.4
@@ -270,2 +270,31 @@ bool RemoteImpl::deleteNetworkFolder(con
 }
 
+bool RemoteImpl::renameFolders(const QString &src, const QString &dest,
+                               bool overwrite) const
+{
+        kdDebug() << "RemoteImpl::renameFolders: "
+                  << src << ", " << dest << endl;
+
+        QString directory;
+        if (findDirectory(src+".desktop", directory))
+        {
+                if (!overwrite && QFile::exists(directory+dest+".desktop"))
+                {
+                        return false;
+                }
+                
+                kdDebug() << "Renaming " << directory << src << ".desktop"<< endl;
+                QDir dir(directory);
+                bool res = dir.rename(src+".desktop", dest+".desktop");
+                if (res)
+                {
+                        KDesktopFile desktop(directory+dest+".desktop");
+                        desktop.writeEntry("Name", dest);
+                }
+                return res;
+        }
+
+        return false;
+}
+
+

--- kdebase/kioslave/remote/remoteimpl.h  #1.2:1.3
@@ -43,4 +43,6 @@ public:
         
         bool deleteNetworkFolder(const QString &filename) const;
+        bool renameFolders(const QString &src, const QString &dest,
+                           bool overwrite) const;
 
 private:


Comment 2 Jens 2005-03-03 10:26:04 UTC
Great (and fast)! Thank you! :-D
Comment 3 Yuriy Kozlov 2006-03-24 03:57:03 UTC
The rename functionality has been added with F2, but there is no rename option in the right-click menu, as reported here: https://launchpad.net/distros/ubuntu/+source/kubuntu-meta/+bug/35580