diff --git a/resources/OpenBoard.qrc b/resources/OpenBoard.qrc index 480269c1..f7008934 100644 --- a/resources/OpenBoard.qrc +++ b/resources/OpenBoard.qrc @@ -366,5 +366,12 @@ images/desc.png images/toolPalette/axesTool.png images/numbersTool.svg + images/trash-my-documents.png + images/trash-empty.png + images/trash-folder.png + images/trash-delete-document.png + images/trash-delete-folder.png + images/trash-document.png + images/trash-document-page.png diff --git a/resources/images/trash-delete-document.png b/resources/images/trash-delete-document.png new file mode 100644 index 00000000..05f9c1e1 Binary files /dev/null and b/resources/images/trash-delete-document.png differ diff --git a/resources/images/trash-delete-folder.png b/resources/images/trash-delete-folder.png new file mode 100644 index 00000000..ae920eaf Binary files /dev/null and b/resources/images/trash-delete-folder.png differ diff --git a/resources/images/trash-document-page.png b/resources/images/trash-document-page.png new file mode 100644 index 00000000..19fc4089 Binary files /dev/null and b/resources/images/trash-document-page.png differ diff --git a/resources/images/trash-document.png b/resources/images/trash-document.png new file mode 100644 index 00000000..c3fda592 Binary files /dev/null and b/resources/images/trash-document.png differ diff --git a/resources/images/trash-empty.png b/resources/images/trash-empty.png new file mode 100644 index 00000000..94447b07 Binary files /dev/null and b/resources/images/trash-empty.png differ diff --git a/resources/images/trash-folder.png b/resources/images/trash-folder.png new file mode 100644 index 00000000..9cc89e97 Binary files /dev/null and b/resources/images/trash-folder.png differ diff --git a/resources/images/trash-my-documents.png b/resources/images/trash-my-documents.png new file mode 100644 index 00000000..a602798c Binary files /dev/null and b/resources/images/trash-my-documents.png differ diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index fcde2f26..dffa1be2 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -1387,6 +1387,12 @@ void UBDocumentTreeView::hSliderRangeChanged(int min, int max) } } +void UBDocumentTreeView::mousePressEvent(QMouseEvent *event) +{ + QTreeView::mousePressEvent(event); + UBApplication::documentController->updateActions(); +} + void UBDocumentTreeView::dragEnterEvent(QDragEnterEvent *event) { QTreeView::dragEnterEvent(event); @@ -3429,20 +3435,57 @@ void UBDocumentController::updateActions() switch (static_cast(deletionForSelection)) { case MoveToTrash : + if (mSelectionType == Folder) + { + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-folder.png")); + mMainWindow->actionDelete->setText(tr("Empty")); + } + else if (mSelectionType == Document) + { + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-document.png")); + mMainWindow->actionDelete->setText(tr("Trash")); + } + else if (mSelectionType == Page) + { + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-document-page.png")); + mMainWindow->actionDelete->setText(tr("Trash")); + } + else + {//can happen ? + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash.png")); + mMainWindow->actionDelete->setText(tr("Trash")); + } + break; case DeletePage : - mMainWindow->actionDelete->setIcon(QIcon(":/images/trash.png")); + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-document-page.png")); mMainWindow->actionDelete->setText(tr("Trash")); break; case CompleteDelete : - mMainWindow->actionDelete->setIcon(QIcon(":/images/toolbar/deleteDocument.png")); - mMainWindow->actionDelete->setText(tr("Delete")); + if (mSelectionType == Folder) + { + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-delete-folder.png")); + mMainWindow->actionDelete->setText(tr("Delete")); + } + else + { + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-delete-document.png")); + mMainWindow->actionDelete->setText(tr("Delete")); + } break; case EmptyFolder : - mMainWindow->actionDelete->setIcon(QIcon(":/images/trash.png")); - mMainWindow->actionDelete->setText(tr("Empty")); + if (firstSelectedTreeIndex() == docModel->myDocumentsIndex()) + { + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-my-documents.png")); + mMainWindow->actionDelete->setText(tr("Empty")); + } + else + { + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-folder.png")); + mMainWindow->actionDelete->setText(tr("Empty")); + } break; case EmptyTrash : - mMainWindow->actionDelete->setIcon(QIcon(":/images/toolbar/deleteDocument.png")); + mMainWindow->actionDelete->setIcon(QIcon(":/images/trash-empty.png")); mMainWindow->actionDelete->setText(tr("Empty")); break; } diff --git a/src/document/UBDocumentController.h b/src/document/UBDocumentController.h index 5ee68d59..fa613d04 100644 --- a/src/document/UBDocumentController.h +++ b/src/document/UBDocumentController.h @@ -305,6 +305,7 @@ public slots: void hSliderRangeChanged(int min, int max); protected: + void mousePressEvent(QMouseEvent *event) override; void dragEnterEvent(QDragEnterEvent *event); void dragLeaveEvent(QDragLeaveEvent *event); void dragMoveEvent(QDragMoveEvent *event);