|
|
@ -756,7 +756,7 @@ void UBDocumentController::deleteTreeItem(QTreeWidgetItem * item, bool showConfi |
|
|
|
tr("Are you sure you want to remove the document '%1'?").arg(document->proxy()->metaData(UBSettings::documentName).toString()))) |
|
|
|
tr("Are you sure you want to remove the document '%1'?").arg(document->proxy()->metaData(UBSettings::documentName).toString()))) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!isDocumentInTrash(document)) |
|
|
|
if (!document->isInTrash()) |
|
|
|
moveDocumentToTrash(dynamic_cast<UBDocumentGroupTreeItem*>(document->parent()), document); |
|
|
|
moveDocumentToTrash(dynamic_cast<UBDocumentGroupTreeItem*>(document->parent()), document); |
|
|
|
|
|
|
|
|
|
|
|
else { |
|
|
|
else { |
|
|
@ -1157,11 +1157,6 @@ void UBDocumentController::pageSelectionChanged() |
|
|
|
selectionChanged(); |
|
|
|
selectionChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool UBDocumentController::isDocumentInTrash(UBDocumentProxyTreeItem * document) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return dynamic_cast<UBDocumentGroupTreeItem*>(document->parent())->isTrashFolder(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool UBDocumentController::isCurrentSelectionInTrash() |
|
|
|
bool UBDocumentController::isCurrentSelectionInTrash() |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool selectionIsInTrash = false; |
|
|
|
bool selectionIsInTrash = false; |
|
|
@ -1169,7 +1164,7 @@ bool UBDocumentController::isCurrentSelectionInTrash() |
|
|
|
// Find the first valid element; no need to check all of them
|
|
|
|
// Find the first valid element; no need to check all of them
|
|
|
|
UBDocumentProxyTreeItem * document = dynamic_cast<UBDocumentProxyTreeItem*>(item); |
|
|
|
UBDocumentProxyTreeItem * document = dynamic_cast<UBDocumentProxyTreeItem*>(item); |
|
|
|
if (document) { |
|
|
|
if (document) { |
|
|
|
selectionIsInTrash = isDocumentInTrash(document); |
|
|
|
selectionIsInTrash = document->isInTrash(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1220,7 +1215,7 @@ void UBDocumentController::updateCurrentSelection() |
|
|
|
UBDocumentProxyTreeItem * document = dynamic_cast<UBDocumentProxyTreeItem*>(item); |
|
|
|
UBDocumentProxyTreeItem * document = dynamic_cast<UBDocumentProxyTreeItem*>(item); |
|
|
|
if (document) { |
|
|
|
if (document) { |
|
|
|
// No mix between trashed and non-trashed items
|
|
|
|
// No mix between trashed and non-trashed items
|
|
|
|
if (isDocumentInTrash(document) != selectionIsInTrash) |
|
|
|
if (document->isInTrash() != selectionIsInTrash) |
|
|
|
addToSelection = false; |
|
|
|
addToSelection = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1234,9 +1229,15 @@ void UBDocumentController::updateCurrentSelection() |
|
|
|
if (selectionIsInTrash) |
|
|
|
if (selectionIsInTrash) |
|
|
|
addToSelection = false; |
|
|
|
addToSelection = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!folder && !document) |
|
|
|
|
|
|
|
addToSelection = false; |
|
|
|
|
|
|
|
|
|
|
|
if (addToSelection) |
|
|
|
if (addToSelection) { |
|
|
|
mCurrentSelection.append(item); |
|
|
|
if (!mCurrentSelection.contains(item)) { |
|
|
|
|
|
|
|
// the .subtract() above doesn't seem to work all the time...
|
|
|
|
|
|
|
|
mCurrentSelection.append(item); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
item->setSelected(false); |
|
|
|
item->setSelected(false); |
|
|
|
} |
|
|
|
} |
|
|
|