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 "Breadcrumb.h"
0007 
0008 #include <KLocalizedString>
0009 
0010 int Browser::Breadcrumb::s_count = 0;
0011 
0012 Browser::Breadcrumb::Breadcrumb(const QString &text, bool isBeginning)
0013     : m_index(++s_count)
0014     , m_isBeginning(isBeginning)
0015     , m_isView(false)
0016     , m_text(text)
0017 {
0018 }
0019 
0020 Browser::Breadcrumb Browser::Breadcrumb::empty()
0021 {
0022     return Breadcrumb(QString());
0023 }
0024 
0025 Browser::Breadcrumb Browser::Breadcrumb::home()
0026 {
0027     return Breadcrumb(i18nc("As in 'all pictures'.", "All"), true);
0028 }
0029 
0030 QString Browser::Breadcrumb::text() const
0031 {
0032     return m_text;
0033 }
0034 
0035 bool Browser::Breadcrumb::isBeginning() const
0036 {
0037     return m_isBeginning;
0038 }
0039 
0040 bool Browser::Breadcrumb::operator==(const Breadcrumb &other) const
0041 {
0042     return other.m_index == m_index;
0043 }
0044 
0045 bool Browser::Breadcrumb::operator!=(const Breadcrumb &other) const
0046 {
0047     return !(other == *this);
0048 }
0049 
0050 Browser::Breadcrumb Browser::Breadcrumb::view()
0051 {
0052     Breadcrumb res(QString(), false);
0053     res.m_isView = true;
0054     return res;
0055 }
0056 
0057 bool Browser::Breadcrumb::isView() const
0058 {
0059     return m_isView;
0060 }
0061 // vi:expandtab:tabstop=4 shiftwidth=4: