|
|
@ -70,12 +70,7 @@ int Tab::restore() |
|
|
|
while (sqlite3_step(statement) == SQLITE_ROW) |
|
|
|
while (sqlite3_step(statement) == SQLITE_ROW) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const int PAGE_NUMBER = append( |
|
|
|
const int PAGE_NUMBER = append( |
|
|
|
reinterpret_cast<const char*>( |
|
|
|
_("Restore.."), |
|
|
|
sqlite3_column_text( |
|
|
|
|
|
|
|
statement, |
|
|
|
|
|
|
|
DB::SESSION::LABEL_TEXT |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
sqlite3_column_int( |
|
|
|
sqlite3_column_int( |
|
|
|
statement, |
|
|
|
statement, |
|
|
|
DB::SESSION::IS_CURRENT |
|
|
|
DB::SESSION::IS_CURRENT |
|
|
@ -83,6 +78,15 @@ int Tab::restore() |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Restore children components
|
|
|
|
// Restore children components
|
|
|
|
|
|
|
|
get_tabLabel( |
|
|
|
|
|
|
|
PAGE_NUMBER |
|
|
|
|
|
|
|
)->restore( |
|
|
|
|
|
|
|
sqlite3_column_int64( |
|
|
|
|
|
|
|
statement, |
|
|
|
|
|
|
|
DB::SESSION::ID |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
get_tabPage( |
|
|
|
get_tabPage( |
|
|
|
PAGE_NUMBER |
|
|
|
PAGE_NUMBER |
|
|
|
)->restore( |
|
|
|
)->restore( |
|
|
@ -94,11 +98,9 @@ int Tab::restore() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sqlite3_finalize( |
|
|
|
return sqlite3_finalize( |
|
|
|
statement |
|
|
|
statement |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return PREPARE_STATUS; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Tab::clean() // @TODO menu action?
|
|
|
|
void Tab::clean() // @TODO menu action?
|
|
|
@ -122,18 +124,24 @@ void Tab::save() |
|
|
|
// Save current tab session
|
|
|
|
// Save current tab session
|
|
|
|
for (int page_number = 0; page_number < get_n_pages(); page_number++) |
|
|
|
for (int page_number = 0; page_number < get_n_pages(); page_number++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Delegate save actions to child page component
|
|
|
|
// Create new session
|
|
|
|
get_tabPage( |
|
|
|
const sqlite3_int64 APP_BROWSER_MAIN_TAB__SESSION__ID = DB::SESSION::add( |
|
|
|
page_number |
|
|
|
|
|
|
|
)->save( |
|
|
|
|
|
|
|
DB::SESSION::add( |
|
|
|
|
|
|
|
db, |
|
|
|
db, |
|
|
|
page_number, |
|
|
|
page_number, |
|
|
|
page_number == get_current_page() ? 1 : 0, |
|
|
|
page_number == get_current_page() ? 1 : 0 |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Delegate save actions to children components
|
|
|
|
get_tabLabel( |
|
|
|
get_tabLabel( |
|
|
|
page_number |
|
|
|
page_number |
|
|
|
)->get_text() // @TODO use separated table for children widget
|
|
|
|
)->save( |
|
|
|
) |
|
|
|
APP_BROWSER_MAIN_TAB__SESSION__ID |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_tabPage( |
|
|
|
|
|
|
|
page_number |
|
|
|
|
|
|
|
)->save( |
|
|
|
|
|
|
|
APP_BROWSER_MAIN_TAB__SESSION__ID |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -152,7 +160,7 @@ void Tab::update( |
|
|
|
TAB_PAGE->get_title() |
|
|
|
TAB_PAGE->get_title() |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
TAB_PAGE->update(); |
|
|
|
// TAB_PAGE->update(); @TODO meant refresh?
|
|
|
|
|
|
|
|
|
|
|
|
action__tab_close_active->set_enabled( |
|
|
|
action__tab_close_active->set_enabled( |
|
|
|
get_n_pages() > 0 |
|
|
|
get_n_pages() > 0 |
|
|
@ -167,7 +175,7 @@ int Tab::append( |
|
|
|
const Glib::ustring & LABEL_TEXT, |
|
|
|
const Glib::ustring & LABEL_TEXT, |
|
|
|
const bool & IS_CURRENT |
|
|
|
const bool & IS_CURRENT |
|
|
|
) { |
|
|
|
) { |
|
|
|
const auto TAB_PAGE = new tab::Page( |
|
|
|
const auto TAB_PAGE = new tab::Page( // @TODO manage
|
|
|
|
db, |
|
|
|
db, |
|
|
|
tab::Page::MIME::UNDEFINED, |
|
|
|
tab::Page::MIME::UNDEFINED, |
|
|
|
LABEL_TEXT, |
|
|
|
LABEL_TEXT, |
|
|
@ -179,7 +187,8 @@ int Tab::append( |
|
|
|
action__tab_page_navigation_update |
|
|
|
action__tab_page_navigation_update |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const auto TAB_LABEL = new tab::Label( // @TODO managed
|
|
|
|
const auto TAB_LABEL = new tab::Label( // @TODO manage
|
|
|
|
|
|
|
|
db, |
|
|
|
action__tab_close_active |
|
|
|
action__tab_close_active |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -354,8 +363,7 @@ int Tab::DB::SESSION::init( |
|
|
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, |
|
|
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, |
|
|
|
`time` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, |
|
|
|
`time` INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, |
|
|
|
`page_number` INTEGER NOT NULL, |
|
|
|
`page_number` INTEGER NOT NULL, |
|
|
|
`is_current` INTEGER NOT NULL, |
|
|
|
`is_current` INTEGER NOT NULL |
|
|
|
`label_text` VARCHAR(1024) |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
)SQL", |
|
|
|
)SQL", |
|
|
|
nullptr, |
|
|
|
nullptr, |
|
|
@ -407,6 +415,11 @@ int Tab::DB::SESSION::clean( |
|
|
|
// Delegate children dependencies cleanup
|
|
|
|
// Delegate children dependencies cleanup
|
|
|
|
if (EXEC_STATUS == SQLITE_OK) |
|
|
|
if (EXEC_STATUS == SQLITE_OK) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
tab::Label::DB::SESSION::clean( |
|
|
|
|
|
|
|
db, |
|
|
|
|
|
|
|
APP_BROWSER_MAIN_TAB__SESSION__ID |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
tab::Page::DB::SESSION::clean( |
|
|
|
tab::Page::DB::SESSION::clean( |
|
|
|
db, |
|
|
|
db, |
|
|
|
APP_BROWSER_MAIN_TAB__SESSION__ID |
|
|
|
APP_BROWSER_MAIN_TAB__SESSION__ID |
|
|
@ -423,8 +436,7 @@ int Tab::DB::SESSION::clean( |
|
|
|
sqlite3_int64 Tab::DB::SESSION::add( |
|
|
|
sqlite3_int64 Tab::DB::SESSION::add( |
|
|
|
sqlite3 * db, |
|
|
|
sqlite3 * db, |
|
|
|
const int & PAGE_NUMBER, |
|
|
|
const int & PAGE_NUMBER, |
|
|
|
const bool & IS_CURRENT, |
|
|
|
const bool & IS_CURRENT |
|
|
|
const Glib::ustring & LABEL_TEXT |
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
char * error; // @TODO
|
|
|
|
char * error; // @TODO
|
|
|
|
|
|
|
|
|
|
|
@ -434,17 +446,14 @@ sqlite3_int64 Tab::DB::SESSION::add( |
|
|
|
R"SQL( |
|
|
|
R"SQL( |
|
|
|
INSERT INTO `app_browser_main_tab__session` ( |
|
|
|
INSERT INTO `app_browser_main_tab__session` ( |
|
|
|
`page_number`, |
|
|
|
`page_number`, |
|
|
|
`is_current`, |
|
|
|
`is_current` |
|
|
|
`label_text` |
|
|
|
|
|
|
|
) VALUES ( |
|
|
|
) VALUES ( |
|
|
|
'%d', |
|
|
|
%d, |
|
|
|
'%d', |
|
|
|
%d |
|
|
|
'%s' |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
)SQL", |
|
|
|
)SQL", |
|
|
|
PAGE_NUMBER, |
|
|
|
PAGE_NUMBER, |
|
|
|
IS_CURRENT, |
|
|
|
IS_CURRENT |
|
|
|
LABEL_TEXT |
|
|
|
|
|
|
|
).c_str(), |
|
|
|
).c_str(), |
|
|
|
nullptr, |
|
|
|
nullptr, |
|
|
|
nullptr, |
|
|
|
nullptr, |
|
|
|