svn path=/trunk/playground/graphics/okular/mobipocket/; revision=882597remotes/origin/mobipocket
parent
9260931bbd
commit
4361d56b2b
9 changed files with 117 additions and 14 deletions
@ -0,0 +1,37 @@ |
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Jakub Stachowski <qbast@go2.pl> * |
||||
* * |
||||
* This program is free software; you can redistribute it and/or modify * |
||||
* it under the terms of the GNU General Public License as published by * |
||||
* the Free Software Foundation; either version 2 of the License, or * |
||||
* (at your option) any later version. * |
||||
***************************************************************************/ |
||||
|
||||
#include "mobithumbnail.h" |
||||
#include "mobipocket.h" |
||||
|
||||
#include <QtCore/QFile> |
||||
|
||||
extern "C" |
||||
{ |
||||
KDE_EXPORT ThumbCreator *new_creator() |
||||
{ |
||||
return new MobiThumbnail; |
||||
} |
||||
} |
||||
|
||||
bool MobiThumbnail::create(const QString &path, int width, int height, QImage &img) |
||||
{ |
||||
QFile f(path); |
||||
f.open(QIODevice::ReadOnly); |
||||
Mobipocket::Document doc(&f); |
||||
if (!doc.isValid()) return false; |
||||
img=doc.thumbnail(); |
||||
return !img.isNull(); |
||||
} |
||||
|
||||
ThumbCreator::Flags MobiThumbnail::flags() const |
||||
{ |
||||
return static_cast<Flags>(None); |
||||
} |
||||
|
||||
@ -0,0 +1,8 @@ |
||||
[Desktop Entry] |
||||
Type=Service |
||||
Name=Mobipocket thumbnailer |
||||
X-KDE-ServiceTypes=ThumbCreator |
||||
MimeType=application/x-mobipocket; |
||||
X-KDE-Library=mobithumbnail |
||||
CacheThumbnail=true |
||||
|
||||
@ -0,0 +1,23 @@ |
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Jakub Stachowski <qbast@go2.pl> * |
||||
* * |
||||
* This program is free software; you can redistribute it and/or modify * |
||||
* it under the terms of the GNU General Public License as published by * |
||||
* the Free Software Foundation; either version 2 of the License, or * |
||||
* (at your option) any later version. * |
||||
***************************************************************************/ |
||||
|
||||
#ifndef MOBITHUMBNAIL_H |
||||
#define MOBITHUMBNAIL_H |
||||
|
||||
#include <kio/thumbcreator.h> |
||||
|
||||
class MobiThumbnail : public ThumbCreator |
||||
{ |
||||
public: |
||||
MobiThumbnail() {} |
||||
virtual bool create(const QString &path, int, int, QImage &img); |
||||
virtual Flags flags() const; |
||||
}; |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue