From 11f0d91e91d3ba46c04400d4801b9a61fa387a59 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 11 Sep 2024 06:19:44 +0300 Subject: [PATCH] implement page data restore --- src/app/browser/main/tab/page.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/app/browser/main/tab/page.cpp b/src/app/browser/main/tab/page.cpp index 122487b9..44691f32 100644 --- a/src/app/browser/main/tab/page.cpp +++ b/src/app/browser/main/tab/page.cpp @@ -89,7 +89,33 @@ int Page::restore( // Use latest record as order while (sqlite3_step(statement) == SQLITE_ROW) { - // Restore page data @TODO + // Restore page data + switch ( + sqlite3_column_int( + statement, + DB::SESSION::MIME + ) + ) { + case 0: mime = MIME::TEXT_PLAIN; break; + case 1: mime = MIME::TEXT_GEMINI; break; + case 2: mime = MIME::UNDEFINED; break; + default: + throw _("Undefined MIME type"); + } // @TODO + + title = reinterpret_cast( + sqlite3_column_text( + statement, + DB::SESSION::TITLE + ) + ); + + description = reinterpret_cast( + sqlite3_column_text( + statement, + DB::SESSION::DESCRIPTION + ) + ); // Restore children components pageNavigation->restore( @@ -122,7 +148,7 @@ int Page::save( } void Page::update( - const enum MIME & MIME, + const MIME & MIME, const Glib::ustring & TITLE, const Glib::ustring & DESCRIPTION, const double & PROGRESS_FRACTION