kde-workspace/plasma/generic/dataengines/favicons/favicons.cpp

66 lines
1.9 KiB
C++
Raw Normal View History

2014-11-13 19:30:51 +02:00
/*
* Copyright (C) 2007 Marco Martin <notmart@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "favicons.h"
#include "faviconprovider.h"
FaviconsEngine::FaviconsEngine(QObject* parent, const QVariantList& args)
: Plasma::DataEngine(parent, args)
{
}
FaviconsEngine::~FaviconsEngine()
{
}
bool FaviconsEngine::updateSourceEvent( const QString &identifier )
{
FaviconProvider *provider = new FaviconProvider(this, identifier);
connect(provider, SIGNAL(finished(FaviconProvider*)), this, SLOT(finished(FaviconProvider*)));
connect(provider, SIGNAL(error(FaviconProvider*)), this, SLOT(error(FaviconProvider*)));
if (provider->image() != QImage()) {
setData(provider->identifier(), "Icon", provider->image());
}
return true;
}
bool FaviconsEngine::sourceRequestEvent(const QString &identifier)
{
setData(identifier, QPixmap());
return updateSourceEvent(identifier);
}
void FaviconsEngine::finished(FaviconProvider *provider)
{
setData(provider->identifier(), "Icon", provider->image());
provider->deleteLater();
}
void FaviconsEngine::error(FaviconProvider *provider)
{
setData(provider->identifier(), QImage());
provider->deleteLater();
}
2015-02-27 09:28:46 +00:00
#include "moc_favicons.cpp"