Permalink
Browse files

DolphinQt2: Allow picking "Extract Files..." on disc/partition

DolphinWX already does this.
  • Loading branch information...
JosJuice committed May 5, 2018
1 parent 1a74de6 commit f48fac5b55fbcc422bc2e66a1df023d606fb8a72
Showing with 17 additions and 10 deletions.
  1. +17 −10 Source/Core/DolphinQt2/Config/FilesystemWidget.cpp
@@ -155,8 +155,20 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
GetPartitionFromID(item->data(ENTRY_PARTITION).toInt());
QString path = item->data(ENTRY_NAME).toString();
if ((type == EntryType::Disc && m_volume->GetPartitions().empty()) ||
type == EntryType::Partition)
const bool is_filesystem_root = (type == EntryType::Disc && m_volume->GetPartitions().empty()) ||
type == EntryType::Partition;
if (type == EntryType::Dir || is_filesystem_root)
{
AddAction(menu, tr("Extract Files..."), this, [this, partition, path] {
auto folder = SelectFolder();
if (!folder.isEmpty())
ExtractDirectory(partition, path, folder);
});
}
if (is_filesystem_root)
{
AddAction(menu, tr("Extract System Data..."), this, [this, partition] {
auto folder = SelectFolder();
@@ -203,14 +215,6 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
AddAction(menu, tr("Check Partition Integrity"), this,
[this, partition] { CheckIntegrity(partition); });
break;
case EntryType::Dir:
AddAction(menu, tr("Extract Files..."), this, [this, partition, path] {
auto folder = SelectFolder();
if (!folder.isEmpty())
ExtractDirectory(partition, path, folder);
});
break;
case EntryType::File:
AddAction(menu, tr("Extract File..."), this, [this, partition, path] {
auto dest = QFileDialog::getSaveFileName(this, tr("Save File to"));
@@ -219,6 +223,9 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
ExtractFile(partition, path, dest);
});
break;
case EntryType::Dir:
// Handled above the switch statement
break;
}
menu->exec(QCursor::pos());

0 comments on commit f48fac5

Please sign in to comment.