Commits

Shlomi Fish  committed aafda22

Drag and drop worked on the first file.

Yay! \o/.

  • Participants
  • Parent commits 89f08c9

Comments (0)

Files changed (1)

File LMN-File-Manager/lib/App/LMN/FileBrowserWidget.pm

 
 use URI::file;
 
+use Sys::Hostname qw(hostname);
+
 use QtCore4;
 use QtGui4;
 
 
 sub mimeTypes
 {
-    return ['text/uri-list', 'text-xdnd-username'];
+    return ['text/uri-list', 'text/xdnd-username'];
 }
 
 sub mimeData
 
     my $mime_data = Qt::MimeData();
 
-    my $encoded_data_uris = Qt::ByteArray();
     my $encoded_data_users = Qt::ByteArray();
     my $data_stream_users = Qt::DataStream($encoded_data_users, Qt::IODevice::WriteOnly());
-    my $data_stream_uris = Qt::DataStream($encoded_data_uris, Qt::IODevice::WriteOnly());
 
     my $username = getpwuid($<);
 
-    foreach my $item (@$indexes)
+    my @urls;
+
     {
         # For the << operator.
         no warnings 'void';
+        $data_stream_users << $username;
+        foreach my $item (@$indexes)
+        {
 
-        $data_stream_users << $username;
 
-        $data_stream_uris <<
-            (URI::file->new(
+            push @urls, Qt::Url::fromLocalFile(
                 File::Spec->catfile(
                     $dir_pathname,
-                    $item->data(0, Qt::DisplayRole()),
+                    $item->data(0, Qt::DisplayRole())->toString(),
                 )
-            )->as_string());
+            );
+        }
     }
 
-    $mime_data->setData('text/uri-list', $encoded_data_uris);
-    $mime_data->setData('text-xdnd-username', $encoded_data_users);
+    $mime_data->setUrls(\@urls);
+    $mime_data->setData('text/xdnd-username', $encoded_data_users);
 
     return $mime_data;
 }