From: Olaf Wintermann Date: Wed, 29 Jul 2026 18:54:48 +0000 (+0200) Subject: add trash collection type X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=f4a50d2e88d7b681c25422222566a4591cdeabf2;p=note.git add trash collection type --- diff --git a/application/backend/src/backend.rs b/application/backend/src/backend.rs index 9179d12..2a984dc 100644 --- a/application/backend/src/backend.rs +++ b/application/backend/src/backend.rs @@ -226,6 +226,17 @@ impl Backend { }; insert_notebooks.insert(db).await?; + let insert_trash = collection::ActiveModel { + profile_id: Set(inserted.id), + repository_id: Set(repo.repository_id), + name: Set("Trash".to_string()), + parent: Set("".to_string()), + kind: Set(CollectionType::Trash), + + ..Default::default() + }; + insert_trash.insert(db).await?; + let insert_notes = collection::ActiveModel { profile_id: Set(inserted.id), repository_id: Set(repo.repository_id), diff --git a/application/note/src/window.rs b/application/note/src/window.rs index 95b6513..9607ebf 100644 --- a/application/note/src/window.rs +++ b/application/note/src/window.rs @@ -31,7 +31,7 @@ use backend::backend::{BackendHandle, BroadcastMessage, NoteId}; use ui_rs::{action, button, grid, hbox, imageviewer, label, sourcelist, tableview, tabview, textarea, textfield, ui_actions, UiModel}; use ui_rs::ui::*; use crate::{App, AppStates}; -use entity::collection::{Model as Collection, Node}; +use entity::collection::{CollectionType, Model as Collection, Node}; use crate::newnotebook::new_notebook_dialog; use crate::notebook::{notelist_getvalue, Notebook, NotebookItem}; @@ -167,6 +167,11 @@ impl MainWindow { self.groups.clear(); for elm in nodes.iter() { + if elm.collection.kind == CollectionType::Trash { + // TODO: add to trash list + continue; + } + self.groups.push(elm.collection.clone()); let mut notebook = SubList::new(); diff --git a/entity/src/collection.rs b/entity/src/collection.rs index 20fd647..afffff6 100644 --- a/entity/src/collection.rs +++ b/entity/src/collection.rs @@ -61,6 +61,7 @@ pub enum CollectionType { Files = 1, Feed = 2, Mail = 3, + Trash = 4, } #[derive(EnumIter, DeriveActiveEnum, Clone, Debug, PartialEq)]