Saturday 26 May 2012

KDE Ubuntu One Dolphin Plugin

So a while ago I switched to KDE because Unity wasn't really for me. While I've tried Unity again since and its much improved. I'm really liking KDE so I see no point in going back. However there were a few issues to overcome with my transition from Gnome 2 to KDE. Chief among them were the keyboard shortcuts and Ubuntu One Integration. Obviously the key board shortcuts were not a major issue because KDE is easily configurable but in terms of Ubuntu One it was a bit more of a struggle. There is a client out there  made by apachelogger but its old and still in alpha and the PPA didn't work for me. So I decided to use the Gnome client under KDE. Which worked but with a few issues.
  • KDE's file manager didn't have a plugin for Ubuntu One, like Nautilus does, so I had to use u1sdtool on the command line or the web interface to publish files and do other operations. 
  • It used the Gnome Keyring to store the token and I had to enter the password to it every time I logged in. 
  • The Control Panel was written in python and GTK and was ugly and slow under KDE.
As of 12.04 the Control Panel is now written in QT. So that issue is fixed. Also I learned that if I switch my login manger to lightdm it with automatically unlock gnome keyring if it has the same password as my login. So that was 2 issues down especially considering I like lightdm better than the kdm anyway.

That only  leaves the dolphin integration. Unfortunately the dolphin plugin was actually the only part of apache logger's Ubuntu One for KDE project that he didn't really like. He says it is no where near production quality. I therefore decided to roll up my sleeves and write my own.

First I decided to add some context context menus so I would be able to carry out common Ubuntu One operations without the need to use the console. So created a few .desktop files to configure them and created a ruby script to run the necessary commands.


require "open3"

class UbuntuOne
  def unsync_folder input
    streams =  Open3.popen3 "u1sdtool --info="+input
    info = ""
    while(info != nil && !(info.include? "share_id"))
      info = streams[1].gets
    if(info != nil)
      info["  share_id: "] = ""
      share_id = info.chomp
      exec "u1sdtool --delete-folder="+share_id

  def publish_file input
    streams =  Open3.popen3 "u1sdtool --publish-file="+input
    url = streams[1].gets
    puts url
    url["File is published at "] = ""
    streams.each do |i|
    exec "qdbus org.kde.klipper 
/klipper org.kde.klipper.klipper.setClipboardContents "+url

#arg0 is the function to call
#arg1 is the file
input = ""
ARGV[1].each_char do |c| #put the spaces back
  if(c != " ")
    input += c
    input += "\\ "

puts ARGV[0]+" "+input
if(ARGV[0] == "unsync_folder") input
elsif ARGV[0] == "publish_file" input
  puts "Something went wrong :("

Note the ruby script only contains methods for the commands that needed some logic.

At the moment the menu for files support :
  • Publish and Copy Weblink 
  • Stop Publishing
And the menu for folders support:
  • Synchronize 
  • Stop Synchronizing
Honestly these context menus do nearly everything nautilus does except for showing you which files are in sync. Which means, I no longer have to drop to the command line to share files which is awesome.

To install the menu plugin just extract this tar ball into "home/yourusername/.kde/share/kde4/services/ServiceMenus/UbuntuOne/" and yes the tar ball was published with the plugin :)

If you have any issues or questions don't hesitate to ask.

I'm now going to take a look at apachelogger's old code for the version control plugin he wrote and the code for the git and svn dolphin plugins to see about showing what files are in sync, like nautilus does. I'm starting a job on Monday so I probably won't have the time for it for a while but I'll post it here whenever I finish it. Also on a side note I'll have to do it in C++ and I don't like C++ as a language but it'll get done ;)


  1. I think the "Stop publish" icon function is inconsistent. They could use the default Ubuntu One emblem icons on all functions

    1. I'll probably change it when I get the full version out as a vcs plugin. For the moment if you want you can change the "Icon=" in the .desktop files to whatever the ubuntu one icon is in /share/icons. I think its just ubuntuone.

  2. Those "strings" which are shown like in "Stop publishing" are somehow inside "u1sdtool" or are they put there by your work?

    It could be nice to be translatable, don't you think?

    I could do myself that spanish translation, but I can't figure it out how to make it upstream.

    By the way, a very very large lots of "thankyous" to you for this awesome work.

    1. Thats a great idea. Here is a form where you can translate the strings and I'll add it to the plugin later in the week :)

  3. Hi there. This is exciting news! Thank you for developing this. I look forward to reading about further integration / enhancements.

    1. Thanks for the feed back dude, I read your article on it on the blue mint. It can now be installed from within dolphin

  4. I've cross-posted this on :)

    After I installed this (using the handy dandy 'Download New Services' button) I right clicked on a file to publish and got the error:

    Could not find the program '~/.kde/share/kde4/services/ServiceMenus/UbuntuOne/ubuntuone.rb'

    It seems that the installer creates the service menu folder as 'Ubuntu One' (with a space). Even after renaming it and removing the space I still get the ubuntuone.rb error when the file is definitely there.

    Any advice is much appreciated!

    1. Thanks for letting me know. Its pretty late here now but I promise to have a fix out sometime tomorrow on and github.

      It's a bug I didn't get when I tested it after last uploading it to but it usually takes some time for them to update the version going to dolphin so I must have missed it.

      Sorry about that.

    2. Fixed its on github now. ( It will be available through dolphin in a little while. (It takes some time for to publish new versions to the server which dolphin grabs them from)

    3. Weird. Even with your update I'm still getting the same problem. I'm hoping that it's OpenDesktop at fault and not me. :D

      When I uninstall the 2.1.2 version and install the 2.1.3 version (which now shows on the OpenDesktop site) I still get the 'Ubuntu One' folder, and if I try to publish a file I get an error:

      If I rename the folder to 'UbuntuOne' (no space) I still get the same error on trying to publish a file:

      As you can see in the screens, the ubuntuone.rb file is definitely in the folder.

    4. Sorry its seems some of the code wasn't updated properly on The version on github is the right one I'll try fix the version when I get back from work today. I'll post the tar here when I'm done so you can grab it. In case opendesktop messes up again. Otherwise if you'd like to fix it your self now.

      cd ~/.kde/share/kde4/services/ServiceMenus/
      rm -rf Ubuntu\ One/
      git clone
      mv u1-dolphin/ UbuntuOne

      In fact I may remove all the files from opendesktop and replace them with that as an install script

    5. Ah. Only thing is, most users don't have 'git' installed on their systems. Well, I don't.

      But thanks for the fixes, I'll definitely give it a try again later once you've got it all up on OpenDesktop as it seems the easiest method.

    6. Your probably right about that but most users don't have ruby and git is a much smaller dependency than that.

      Anyway I'll let you know once I have the new version up on and properly tested. I'm not very impressed with their upload it and then wait six hours before you can see if it works a approach :(

    7. I've installed 'git' anyway to give it a whirl.

      I've managed to get things going using your commands (above), but, and this may be a daft question, how do I sign in to U1? I can't fully run the U1 app as, due to a known bug, it crashes before it completes the sign-in wizard.

    8. try u1sdtool -c also have you installed ubuntuone-control-panel-qt it works much better in kde than the other version.

    9. Yep, installed ubuntuone-control-panel-qt. It does work. It loads up and it'll let me see folders etc, but as soon as I try to add/remove a device or anything of the sort it logs me out and asks me to sign in again.

      I can use the UbuntuOne folder (in the /home directory) to send files to the cloud, it's just the right click menu that doesn't seem to send anything to the cloud. Very odd.

    10. Sounds like your have some odd connection issues with the u1 backend. Sorry but I only developed a plugin for u1. I'm not a u1 dev so I don't really know how to solve your issue. Try file a bug or an issue about:

      "It loads up and it'll let me see folders etc, but as soon as I try to add/remove a device or anything of the sort it logs me out and asks me to sign in again."

      with the devs on launchpad.

    11. Cool, no worries. It is a known problem with the U1 app.

      I think I've got your script all working now, so all is good.

      I've put a post up on G+ about how I installed it (using your commands, with a link to this site) and I'll put it in this months Full Circle Magazine (that I edit: :)

      Thanks for all the help!

  5. This is great for all kde users!
    I just want to ask you something though... you wrote:

    "Also I learned that if I switch my login manger to lightdm it with automatically unlock gnome keyring if it has the same password as my login. So that was 2 issues down especially considering I like lightdm better than the kdm anyway."

    I'm using kde-wallet with kdm and having to type my password twice to open the wallet is SUCH a pain! Are you saying that if I switch to lightdm with the kde greeter it will open the wallet automatically or were u referring to gnome?

    1. I meant the gnome keyring application but now that you mention it. I don't think I have had to type in the kde-wallet password at login in a while. So that may have fixed it or maybe I justed changed it to only ask me when it needed it.

  6. I just installed this from git, and although I get a tray popup saying that a file was published, with the correct URL, I also get the window mentioned above, saying "Could not find the program '~/.kde/share/kde4/services/ServiceMenus/UbuntuOne/ubuntuone.rb'". This is running Kubuntu 12.10.
    Thanks, Martin

    1. How exactly did you install it from git? Did you run the install script? It sounds from that error like the ruby script isn't in the right place.

      Could be a genuine bug but if your could either run the install script or remove what you've done and install from inside of dolphin. I'd wager it will fix the problem.