File indexing completed on 2024-05-05 04:49:16
0001 /**************************************************************************************** 0002 * Copyright (c) 2010 Nikolaj Hald Nielsen <nhn@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #include "ServiceCapabilities.h" 0018 #include "ServiceMetaBase.h" 0019 0020 0021 ServiceBookmarkThisCapability::ServiceBookmarkThisCapability( BookmarkThisProvider * provider ) 0022 : Capabilities::BookmarkThisCapability(nullptr) 0023 , m_provider( provider ) 0024 { 0025 } 0026 0027 0028 ServiceBookmarkThisCapability::~ServiceBookmarkThisCapability() 0029 { 0030 } 0031 0032 bool ServiceBookmarkThisCapability::isBookmarkable() 0033 { 0034 return m_provider->isBookmarkable(); 0035 } 0036 0037 QString ServiceBookmarkThisCapability::browserName() 0038 { 0039 return m_provider->browserName(); 0040 } 0041 0042 QString ServiceBookmarkThisCapability::collectionName() 0043 { 0044 return m_provider->collectionName(); 0045 } 0046 0047 bool ServiceBookmarkThisCapability::simpleFiltering() 0048 { 0049 return m_provider->simpleFiltering(); 0050 } 0051 0052 QAction * ServiceBookmarkThisCapability::bookmarkAction() const 0053 { 0054 return m_provider->bookmarkAction(); 0055 } 0056 0057 /////////////////////////////////////////////////////// 0058 0059 0060 ServiceActionsCapability::ServiceActionsCapability(ActionsProvider * actionsProvider) 0061 : Capabilities::ActionsCapability( ) 0062 , m_actionsProvider( actionsProvider ) 0063 { 0064 } 0065 0066 ServiceActionsCapability::~ServiceActionsCapability() 0067 { 0068 } 0069 0070 QList< QAction * > ServiceActionsCapability::actions() const 0071 { 0072 return m_actionsProvider->actions(); 0073 } 0074 0075 /////////////////////////////////////////////////////// 0076 0077 0078 ServiceSourceInfoCapability::ServiceSourceInfoCapability(SourceInfoProvider * sourceInfoProvider) 0079 : SourceInfoCapability() 0080 { 0081 m_sourceInfoProvider = sourceInfoProvider; 0082 } 0083 0084 ServiceSourceInfoCapability::~ServiceSourceInfoCapability() 0085 { 0086 } 0087 0088 QString 0089 ServiceSourceInfoCapability::sourceName() 0090 { 0091 return m_sourceInfoProvider->sourceName(); 0092 } 0093 0094 QString 0095 ServiceSourceInfoCapability::sourceDescription() 0096 { 0097 return m_sourceInfoProvider->sourceDescription(); 0098 } 0099 0100 QPixmap 0101 ServiceSourceInfoCapability::emblem() 0102 { 0103 return m_sourceInfoProvider->emblem(); 0104 } 0105 0106 0107 QString 0108 ServiceSourceInfoCapability::scalableEmblem() 0109 { 0110 return m_sourceInfoProvider->scalableEmblem(); 0111 } 0112 0113 0114 //////////////////////////////////////////////////////////// 0115 0116 0117 ServiceFindInSourceCapability::ServiceFindInSourceCapability( Meta::ServiceTrack *track ) 0118 : Capabilities::FindInSourceCapability() 0119 , m_track( track ) 0120 {} 0121 0122 void ServiceFindInSourceCapability::findInSource( QFlags<TargetTag> tag ) 0123 { 0124 Q_UNUSED( tag ) 0125 DEBUG_BLOCK 0126 if( m_track->artist() && m_track->album() && !m_track->collectionName().isEmpty() ) 0127 { 0128 QString collection =m_track->collectionName(); 0129 QString artist = m_track->artist()->prettyName(); 0130 QString album = m_track->album()->prettyName(); 0131 0132 AmarokUrl url; 0133 url.setCommand( QStringLiteral("navigate") ); 0134 url.setPath( "internet/" + collection ); 0135 if( !m_track->simpleFiltering() ) 0136 { 0137 url.setArg( QStringLiteral("filter"), "artist:\"" + artist + "\" AND album:\"" + album + "\"" ); 0138 url.setArg( QStringLiteral("levels"), QStringLiteral("artist-album") ); 0139 debug() << "running url: " << url.url(); 0140 url.run(); 0141 } 0142 0143 0144 } 0145 }