Added drag & drop of disk/partition paths; drag a list item to terminal, pe, etc. and release to copy the path. (ticket #8872)
Signed-off-by: Stephan Aßmus <[email protected]>
This commit is contained in:
committed by
Stephan Aßmus
parent
151b6997c0
commit
5d871e578d
@@ -224,7 +224,7 @@ PartitionListRow::PartitionListRow(BPartition* partition)
|
||||
if (partition->ContainsFileSystem())
|
||||
SetField(new BStringField(partition->Type()), kFilesystemColumn);
|
||||
else
|
||||
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
||||
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
|
||||
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ PartitionListRow::PartitionListRow(BPartition* partition)
|
||||
|
||||
delete_driver_settings(handle);
|
||||
}
|
||||
|
||||
|
||||
SetField(new BStringField(parameters), kParametersColumn);
|
||||
} else {
|
||||
SetField(new BStringField(kUnavailableString), kParametersColumn);
|
||||
@@ -281,6 +281,19 @@ PartitionListRow::PartitionListRow(partition_id parentID, partition_id id,
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PartitionListRow::DevicePath()
|
||||
{
|
||||
BBitmapStringField* stringField
|
||||
= dynamic_cast<BBitmapStringField*>(GetField(kDeviceColumn));
|
||||
|
||||
if (stringField == NULL)
|
||||
return "";
|
||||
|
||||
return stringField->String();
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - PartitionListView
|
||||
|
||||
|
||||
@@ -312,6 +325,30 @@ PartitionListView::AttachedToWindow()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PartitionListView::InitiateDrag(BPoint rowPoint, bool wasSelected)
|
||||
{
|
||||
PartitionListRow* draggedRow
|
||||
= dynamic_cast<PartitionListRow*>(RowAt(rowPoint));
|
||||
if (draggedRow != NULL) {
|
||||
BRect draggedRowRect;
|
||||
GetRowRect(draggedRow, &draggedRowRect);
|
||||
|
||||
const char* draggedPath = draggedRow->DevicePath();
|
||||
if (draggedPath != NULL) {
|
||||
BMessage *drag = new BMessage(B_MIME_DATA);
|
||||
drag->AddData("text/plain", B_MIME_TYPE, draggedPath, strlen(draggedPath));
|
||||
|
||||
DragMessage(drag, draggedRowRect, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
PartitionListRow*
|
||||
PartitionListView::FindRow(partition_id id, PartitionListRow* parent)
|
||||
{
|
||||
|
||||
@@ -77,6 +77,8 @@ public:
|
||||
{ return fOffset; }
|
||||
off_t Size() const
|
||||
{ return fSize; }
|
||||
|
||||
const char* DevicePath();
|
||||
private:
|
||||
partition_id fPartitionID;
|
||||
partition_id fParentID;
|
||||
@@ -93,6 +95,8 @@ public:
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
virtual bool InitiateDrag(BPoint rowPoint, bool wasSelected);
|
||||
|
||||
PartitionListRow* FindRow(partition_id id,
|
||||
PartitionListRow* parent = NULL);
|
||||
PartitionListRow* AddPartition(BPartition* partition);
|
||||
|
||||
Reference in New Issue
Block a user