File indexing completed on 2024-05-12 05:09:31
0001 /**************************************************************************** 0002 Copyright (C) 2001-2009 Robby Stephenson <robby@periapsis.org> 0003 ***************************************************************************/ 0004 0005 /*************************************************************************** 0006 * * 0007 * This program is free software; you can redistribute it and/or * 0008 * modify it under the terms of the GNU General Public License as * 0009 * published by the Free Software Foundation; either version 2 of * 0010 * the License or (at your option) version 3 or any later version * 0011 * accepted by the membership of KDE e.V. (or its successor approved * 0012 * by the membership of KDE e.V.), which shall act as a proxy * 0013 * defined in Section 14 of version 3 of the license. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, * 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0018 * GNU General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0022 * * 0023 ***************************************************************************/ 0024 0025 #include "fetcherinfolistitem.h" 0026 #include "fetchmanager.h" 0027 0028 using Tellico::FetcherInfoListItem; 0029 0030 FetcherInfoListItem::FetcherInfoListItem(QListWidget* parent_, const Tellico::Fetch::FetcherInfo& info_) 0031 : QListWidgetItem(parent_) 0032 , m_info(info_) 0033 , m_newSource(true) 0034 , m_fetcher(nullptr) { 0035 setData(Qt::DisplayRole, m_info.name); 0036 QPixmap pix = Fetch::Manager::fetcherIcon(m_info.type); 0037 if(!pix.isNull()) { 0038 setData(Qt::DecorationRole, pix); 0039 } 0040 } 0041 0042 void FetcherInfoListItem::setConfigGroup(const KConfigGroup& group_) { 0043 m_configGroup = group_; 0044 if(m_fetcher) { 0045 m_fetcher->setConfigGroup(m_configGroup); 0046 } 0047 } 0048 0049 Tellico::Fetch::Type FetcherInfoListItem::fetchType() const { 0050 return m_info.type; 0051 } 0052 0053 void FetcherInfoListItem::setUpdateOverwrite(bool b) { 0054 m_info.updateOverwrite = b; 0055 } 0056 0057 bool FetcherInfoListItem::updateOverwrite() const { 0058 return m_info.updateOverwrite; 0059 } 0060 0061 void FetcherInfoListItem::setNewSource(bool b) { 0062 m_newSource = b; 0063 } 0064 0065 bool FetcherInfoListItem::isNewSource() const { 0066 return m_newSource; 0067 } 0068 0069 QString FetcherInfoListItem::uuid() const { 0070 return m_info.uuid; 0071 } 0072 0073 void FetcherInfoListItem::setFetcher(Tellico::Fetch::Fetcher* fetcher_) { 0074 Q_ASSERT(fetcher_); 0075 m_fetcher = fetcher_; 0076 QPixmap pix = Fetch::Manager::fetcherIcon(fetcher_); 0077 if(!pix.isNull()) { 0078 setData(Qt::DecorationRole, pix); 0079 } 0080 } 0081 0082 Tellico::Fetch::Fetcher* FetcherInfoListItem::fetcher() const { 0083 return m_fetcher; 0084 }