Remove Tracker's special DnD handling. Instead, BTextView/BTextControl now

honors drag messages containing entry refs and resolves the path of the first
one contained. Will work on a more sophisticated solution that would allow
optionally extracting the file text instead via right click drag context menu 
when I have more time.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35731 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2010-03-03 00:02:02 +00:00
parent f435abb00a
commit 7c0f5738b3
2 changed files with 9 additions and 68 deletions
+8 -1
View File
@@ -32,9 +32,11 @@
#include <Bitmap.h>
#include <Clipboard.h>
#include <Debug.h>
#include <Entry.h>
#include <Input.h>
#include <LayoutUtils.h>
#include <MessageRunner.h>
#include <Path.h>
#include <PropertyInfo.h>
#include <Region.h>
#include <ScrollBar.h>
@@ -1481,7 +1483,8 @@ BTextView::AcceptsPaste(BClipboard *clipboard)
bool
BTextView::AcceptsDrop(const BMessage *inMessage)
{
if (fEditable && inMessage && inMessage->HasData("text/plain", B_MIME_TYPE))
if (fEditable && inMessage && (inMessage->HasData("text/plain", B_MIME_TYPE)
|| inMessage->HasData("refs", B_REF_TYPE)))
return true;
return false;
@@ -4808,6 +4811,7 @@ BTextView::_MessageDropped(BMessage *inMessage, BPoint where, BPoint offset)
ssize_t dataLen = 0;
const char *text = NULL;
entry_ref ref;
if (inMessage->FindData("text/plain", B_MIME_TYPE, (const void **)&text,
&dataLen) == B_OK) {
text_run_array *runArray = NULL;
@@ -4829,6 +4833,9 @@ BTextView::_MessageDropped(BMessage *inMessage, BPoint where, BPoint offset)
}
Insert(dropOffset, text, dataLen, runArray);
} else if (inMessage->FindRef("refs", &ref) == B_OK) {
BPath path(&ref);
Insert(dropOffset, path.Path(), strlen(path.Path()));
}
return true;