]> uap-core.de Git - note.git/commitdiff
add trash collection type
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 29 Jul 2026 18:54:48 +0000 (20:54 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 29 Jul 2026 18:54:48 +0000 (20:54 +0200)
application/backend/src/backend.rs
application/note/src/window.rs
entity/src/collection.rs

index 9179d12e097d491de828534abbe8d71fed6f118e..2a984dccb1dc41aab791f4b5e2e57658e0ac341a 100644 (file)
@@ -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),
index 95b65138c229ded7d1a0b552d9f4dc3e9a7af73e..9607ebfc32c5793393ff9502be9b284f8ca6260e 100644 (file)
@@ -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();
index 20fd647dd41964653021f31cbb5036ca9dd2e91a..afffff612f1e445bf3d3c6a1f0f743be2a860265 100644 (file)
@@ -61,6 +61,7 @@ pub enum CollectionType {
     Files = 1,
     Feed = 2,
     Mail = 3,
+    Trash = 4,
 }
 
 #[derive(EnumIter, DeriveActiveEnum, Clone, Debug, PartialEq)]