This forum has been archived. All content is frozen. Please use KDE Discuss instead.

FREQ DnD support on file list / Where is the file list code

Tags: None
(comma "," separated)
infinull
Registered Member
Posts
4
Karma
0
A feature that would greatly stream line my movie consumption (is this a good thing?) would be the ability to drag-n-drop from the file-selection dialog to my VLC playlist window.

Being a coder I decided to look at the code and see how reasonable this would be to implement.

I cannot even find the actual GUI code for the file list.

I can find the models, but not the code that captures UI events and things (which I need to implement drag-n-drop)

I'm a fairily experience C++ coder, but this would be my first time using Qt.

Links I'm using as reference: http://doc.trolltech.com/4.3/dnd.html

Thank you.
George
Moderator
Posts
5421
Karma
1

Sat May 02, 2009 10:10 am
Use this, most of the manual UI stuff is handled by the Model View classes :

http://doc.trolltech.com/4.4/model-view-dnd.html

As for code you need to modify :

TorrentFileListModel and TorrentFileTreeModel (libktcore/torrent/)

FileSelectDlg (ktorrent/fileselectdlg.cpp)

FileView (plugins/infowidget/fileview.cpp)
infinull
Registered Member
Posts
4
Karma
0

Done!

Sat May 02, 2009 8:49 pm
What is the proper way to submit a patch?

Known Bugs:
Directories in treeview are not supported.
They will "drag" an empty string.
infinull
Registered Member
Posts
4
Karma
0

Problems with single file torrents

Sat May 02, 2009 10:02 pm
It seems I may have spoken too soon.

For mutli-file torrents I can do

indexToFile(index)->getPathOnDisk();
But for single file torrents this returns an empty string.

Right now I am doing:
tc->getDataDir() + tc->getStats().torrent_name;

This only seems to work if the file view is set to list and not tree.
infinull
Registered Member
Posts
4
Karma
0

Never Mind

Sun May 03, 2009 4:47 am
I found the code I needed in FileView::open for directories and single file torrents.

Now the only caveat is that if you dragged a file from KTorrent to say Dolphin it would be the same as dragging a file from one Dolphin window to another. So if the user chooses "move" (the default) it will move the file to the specified location w/o updating KTorrent of the file's new location.

I'm not sure if there is a way around this.

I've already specified the action as "copy only" but apparently that only applies to the URL data itself not the data that it is pointing to.

There is also no discrimination between complete, incomplete, preview-able, etc. I'm not sure if this is desired behavior or not either. However, I am happy with it.
George
Moderator
Posts
5421
Karma
1

Re: Done!

Sun May 03, 2009 9:00 am
infinull wrote:What is the proper way to submit a patch?


Just send it by e-mail


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft