Bug Fixes in Utilities
Use a different D-Bus object path for each Ark::Part.
So far, all Ark::Part instances used the same D-Bus object path,
"/DndExtract", to receive drag'n'drop notifications.
This does not work correctly ever since we started supporting using Ark as
an embedded KPart (for previewing archived inside Konqueror or Rekonq, for
example). In this case, the object path is added to the embedder (the
`konqueror-5654' service, for example). If one previews multiple archives in
different tabs, multiple calls to QDBusConnection::registerObject() will be
made and only the first one will succeed, since we are always trying to
register the same path.
Fixing this involves touching separate parts of the code:
o Use a different object path for each KPart instance, just like
KateDocument or nsplugin do. We do this by keeping a static counter that
is incremented each time a KPart is created and is part of the path name.
o Use other, more specific mime types for the data we send when dragging
out of Ark. So far we used "application/x-kde-dndextract" and passed the
D-Bus service as its value. We now pass this value in the newly-created
"application/x-kde-ark-dndextract-service" mime type, and the object
path, which is now passed to ArchiveModel, in
o Also use a more specific interface name in the XML file. While here,
generate the .cpp and .h files with CMake instead of keeping these
auto-generated files around for no purpose.
o ArchiveModel::mimeTypes() has been adjusted to indicate the mime types we
actually use on drag'n'drop. The previous list was mostly bogus, as we
only use the mime types indicated above.
As it can be seen, applications which support drag'n'drop from Ark also need
to be adjusted to use the new D-Bus interface. Currently, the applications
are Dolphin, the Folderview plasmoid and a Stack Folder plasmoid in
playground. They are all going to be updated accordingly in tandem with this
commit to both KDE/4.9 and master. Users using SVN/git directly might
experience some trouble if they update one part but not the other, but there
is not much we can do in this case.