File indexing completed on 2024-05-05 16:27:55

0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "BrowserPage.h"
0007 
0008 Browser::BrowserPage::BrowserPage(const DB::ImageSearchInfo &info, BrowserWidget *browser)
0009     : m_info(info)
0010     , m_browser(browser)
0011 {
0012 }
0013 
0014 /** Called when this page was active and now a different page becomes active. Makes it possible to free resources etc.
0015  * By default, does nothing.
0016  */
0017 void Browser::BrowserPage::deactivate()
0018 {
0019 }
0020 
0021 /**
0022  * \return the associated \ref BrowserWidget. This instance is needed when
0023  * the action is creating new actions for a child aciton.
0024  */
0025 Browser::BrowserWidget *Browser::BrowserPage::browser() const
0026 {
0027     return m_browser;
0028 }
0029 
0030 /**
0031  * Return a page for the item at the given model index. In case the
0032  * activation doesn't result in a new page, simply return nullptr (This is for
0033  * example the case if a search is executed, but canceled).
0034  */
0035 Browser::BrowserPage *Browser::BrowserPage::activateChild(const QModelIndex &)
0036 {
0037     return nullptr;
0038 }
0039 
0040 Browser::Viewer Browser::BrowserPage::viewer()
0041 {
0042     return ShowBrowser;
0043 }
0044 
0045 /**
0046  * When this page is active, should the search bar in the browser be
0047  * enabled?
0048  */
0049 bool Browser::BrowserPage::isSearchable() const
0050 {
0051     return true;
0052 }
0053 
0054 /**
0055  * \return whether the user should be allowed to change the view type (tree
0056  * view vs iconview
0057  */
0058 bool Browser::BrowserPage::isViewChangeable() const
0059 {
0060     return false;
0061 }
0062 
0063 /**
0064  * \return the viewtype which should be used in case this is to be shown in
0065  * the Browser.
0066  */
0067 DB::Category::ViewType Browser::BrowserPage::viewType() const
0068 {
0069     return DB::Category::IconView;
0070 }
0071 
0072 /**
0073  * \return the \ref DB::ImageSearchInfo this item was constructed with.
0074  */
0075 DB::ImageSearchInfo Browser::BrowserPage::searchInfo() const
0076 {
0077     return m_info;
0078 }
0079 
0080 /**
0081  * \return the breadcrumb to be used in the status bar for this item
0082  */
0083 Browser::Breadcrumb Browser::BrowserPage::breadcrumb() const
0084 {
0085     return Breadcrumb::empty();
0086 }
0087 
0088 /**
0089  * \return if this page should be shown when moving backward/forward
0090  * through the history of pages.
0091  */
0092 bool Browser::BrowserPage::showDuringMovement() const
0093 {
0094     return false;
0095 }
0096 // vi:expandtab:tabstop=4 shiftwidth=4:
0097 
0098 #include "moc_BrowserPage.cpp"