File indexing completed on 2024-05-12 05:04:14
0001 // SPDX-FileCopyrightText: 2023 Shubham Arora <shubhamarora@protonmail.com> 0002 // SPDX-License-Identifier: GPL-3.0-only 0003 0004 #include "abstractlistmodel.h" 0005 0006 AbstractListModel::AbstractListModel(QObject *parent) 0007 : QAbstractListModel(parent) 0008 { 0009 m_manager = &AccountManager::instance(); 0010 m_account = m_manager->selectedAccount(); 0011 } 0012 0013 QString AbstractListModel::name() const 0014 { 0015 return m_listName; 0016 } 0017 0018 void AbstractListModel::setName(const QString &name) 0019 { 0020 if (m_listName == name) { 0021 return; 0022 } 0023 0024 setLoading(false); 0025 m_listName = name; 0026 Q_EMIT nameChanged(); 0027 } 0028 0029 bool AbstractListModel::loading() const 0030 { 0031 return m_loading; 0032 } 0033 0034 void AbstractListModel::setLoading(bool loading) 0035 { 0036 if (m_loading == loading) { 0037 return; 0038 } 0039 m_loading = loading; 0040 Q_EMIT loadingChanged(); 0041 } 0042 0043 bool AbstractListModel::shouldLoadMore() const 0044 { 0045 return m_shouldLoadMore; 0046 } 0047 0048 void AbstractListModel::setShouldLoadMore(bool shouldLoadMore) 0049 { 0050 if (m_shouldLoadMore == shouldLoadMore) { 0051 return; 0052 } 0053 m_shouldLoadMore = shouldLoadMore; 0054 Q_EMIT shouldLoadMoreChanged(); 0055 } 0056 0057 AbstractAccount *AbstractListModel::account() const 0058 { 0059 return m_account; 0060 } 0061 0062 #include "moc_abstractlistmodel.cpp"