File indexing completed on 2024-05-05 04:39:54

0001 /*
0002     SPDX-FileCopyrightText: 2012-2013 Miquel Sabaté <mikisabate@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include <ghprovidermodel.h>
0008 
0009 
0010 namespace gh
0011 {
0012 
0013 ProviderItem::ProviderItem(const Response &r)
0014     : QStandardItem(r.name), m_data(r)
0015 {
0016     if (r.kind == Private)
0017         setIcon(QIcon::fromTheme(QStringLiteral("github-private")));
0018     else if (r.kind == Fork)
0019         setIcon(QIcon::fromTheme(QStringLiteral("github-forked")));
0020     else
0021         setIcon(QIcon::fromTheme(QStringLiteral("github-repo")));
0022 }
0023 
0024 QVariant ProviderItem::data(int role) const
0025 {
0026     switch(role) {
0027         case ProviderModel::VcsLocationRole:
0028             return QVariant(m_data.url);
0029         default:
0030             return QStandardItem::data(role);
0031     }
0032 }
0033 
0034 ProviderModel::ProviderModel(QObject *parent)
0035     : QStandardItemModel(parent)
0036 {
0037     /* There's nothing to do here */
0038 }
0039 
0040 } // End of namespace gh
0041 
0042 #include "moc_ghprovidermodel.cpp"