Index: pics/plasma_comic_sinfest.png
===================================================================
Kann nicht anzeigen: Dateityp ist als binär angegeben.
svn:mime-type = application/octet-stream

Eigenschaftsänderungen: pics/plasma_comic_sinfest.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: sinfestprovider.desktop
===================================================================
--- sinfestprovider.desktop	(Revision 0)
+++ sinfestprovider.desktop	(Revision 0)
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Service
+X-KDE-ServiceTypes=PlasmaComic/Plugin
+X-KDE-Library=plasma_comic_sinfestprovider
+X-KDE-PlasmaComicProvider-SuffixType=Date
+X-KDE-PlasmaComicProvider-Identifier=sinfest
+Icon=plasma_comic_sinfest
+
+Name=Sinfest
+Comment=Sinfest
Index: sinfestprovider.h
===================================================================
--- sinfestprovider.h	(Revision 0)
+++ sinfestprovider.h	(Revision 0)
@@ -0,0 +1,74 @@
+/*
+ *   Copyright (C) 2008 Mathias Kraus <k.matze@gmx.net>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License version 2 as
+ *   published by the Free Software Foundation
+ *
+ *   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.
+ */
+
+#ifndef SINFESTPROVIDER_H
+#define SINFESTPROVIDER_H
+
+#include "comicprovider.h"
+
+/**
+ * This class provides the comic strip image for sinfest.net.
+ */
+class SinfestProvider : public ComicProvider
+{
+    Q_OBJECT
+
+    public:
+        /**
+         * Creates a new sinfest provider.
+         *
+         * @param parent The parent object.
+         */
+        SinfestProvider( QObject *parent, const QVariantList& );
+
+        /**
+         * Destroys the sinfest provider.
+         */
+        ~SinfestProvider();
+
+        /**
+         * Returns the identifier type.
+         */
+        IdentifierType identifierType() const;
+
+        /**
+         * Returns the requested image.
+         *
+         * Note: This method returns only a valid image after the
+         *       finished() signal has been emitted.
+         */
+        virtual QImage image() const;
+
+        /**
+         * Returns the identifier of the comic request (name + date).
+         */
+        virtual QString identifier() const;
+
+        /**
+         * Returns the website of the comic.
+         */
+        virtual KUrl websiteUrl() const;
+
+    private:
+      class Private;
+      Private* const d;
+
+      Q_PRIVATE_SLOT( d, void imageRequestFinished( bool ) )
+};
+
+#endif
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(Revision 838079)
+++ CMakeLists.txt	(Arbeitskopie)
@@ -108,3 +108,15 @@
 install( TARGETS plasma_comic_phdprovider DESTINATION ${PLUGIN_INSTALL_DIR} )
 install( FILES phdprovider.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
 install( FILES pics/plasma_comic_phd.png DESTINATION ${DATA_INSTALL_DIR}/plasma-comic )
+
+#### next ####
+
+set( comic_sinfest_provider_SRCS
+     sinfestprovider.cpp
+)
+
+kde4_add_plugin( plasma_comic_sinfestprovider ${comic_sinfest_provider_SRCS} )
+target_link_libraries( plasma_comic_sinfestprovider plasmacomicprovidercore ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY})
+install( TARGETS plasma_comic_sinfestprovider DESTINATION ${PLUGIN_INSTALL_DIR} )
+install( FILES sinfestprovider.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+install( FILES pics/plasma_comic_sinfest.png DESTINATION ${DATA_INSTALL_DIR}/plasma-comic )
Index: sinfestprovider.cpp
===================================================================
--- sinfestprovider.cpp	(Revision 0)
+++ sinfestprovider.cpp	(Revision 0)
@@ -0,0 +1,93 @@
+/*
+ *   Copyright (C) 2008 Mathias Kraus <k.matze@gmx.net>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License version 2 as
+ *   published by the Free Software Foundation
+ *
+ *   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 <QtCore/QDate>
+#include <QtCore/QRegExp>
+#include <QtGui/QImage>
+#include <QtNetwork/QHttp>
+
+#include <KUrl>
+
+#include "sinfestprovider.h"
+
+COMICPROVIDER_EXPORT_PLUGIN( SinfestProvider, "SinfestProvider", "" )
+
+class SinfestProvider::Private
+{
+    public:
+        Private( SinfestProvider *parent )
+          : mParent( parent )
+        {
+            mHttp = new QHttp( "sinfest.net", 80, mParent );
+            connect( mHttp, SIGNAL( done( bool ) ), mParent, SLOT( imageRequestFinished( bool ) ) );
+        }
+
+        void imageRequestFinished( bool );
+
+        SinfestProvider *mParent;
+        QImage mImage;
+
+        QHttp *mHttp;
+};
+
+void SinfestProvider::Private::imageRequestFinished( bool error )
+{
+    if ( error ) {
+        emit mParent->error( mParent );
+        return;
+    }
+
+    mImage = QImage::fromData( mHttp->readAll() );
+    emit mParent->finished( mParent );
+}
+
+SinfestProvider::SinfestProvider( QObject *parent, const QVariantList &args )
+    : ComicProvider( parent, args ), d( new Private( this ) )
+{
+    KUrl url( QString( "http://www.sinfest.net/comikaze/comics/%1.gif" ).arg( requestedDate().toString( "yyyy-MM-dd" ) ) );
+
+    d->mHttp->setHost( url.host() );
+    d->mHttp->get( url.path() );
+}
+
+SinfestProvider::~SinfestProvider()
+{
+    delete d;
+}
+
+ComicProvider::IdentifierType SinfestProvider::identifierType() const
+{
+    return DateIdentifier;
+}
+
+QImage SinfestProvider::image() const
+{
+    return d->mImage;
+}
+
+QString SinfestProvider::identifier() const
+{
+    return QString( "sinfest:%1" ).arg( requestedDate().toString( Qt::ISODate ) );
+}
+
+KUrl SinfestProvider::websiteUrl() const
+{
+    return QString( "http://www.sinfest.net/archive_page.php?comicID=%1" ).arg( 2309 - requestedDate().daysTo( QDate( 2007, 1, 1 ) ) );
+}
+
+#include "sinfestprovider.moc"
