You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
13 years ago
|
/*! @file
|
||
|
|
||
|
@id $Id$
|
||
|
*/
|
||
|
// 1 2 3 4 5 6 7 8
|
||
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||
|
|
||
|
#ifndef __PLUGINFACTORY_HXX__
|
||
|
#define __PLUGINFACTORY_HXX__
|
||
|
|
||
|
#include <QtWebKit/QWebPluginFactory>
|
||
13 years ago
|
#include <qbrowserlib/saveorrun.hxx>
|
||
13 years ago
|
|
||
|
#include <QtCore/QDebug>
|
||
|
#ifndef LOG
|
||
|
#define LOG qDebug()<<__PRETTY_FUNCTION__
|
||
|
#endif
|
||
|
|
||
|
class PluginFactory: public QWebPluginFactory {
|
||
|
public:
|
||
|
PluginFactory(QObject* p=0): QWebPluginFactory(p) {
|
||
|
LOG;
|
||
|
Plugin plugin;
|
||
|
plugin.name = "Show PDF-Document";
|
||
|
plugin.description = "Plugin for PDF documents";
|
||
|
MimeType mime;
|
||
|
mime.fileExtensions<<"pdf";
|
||
|
mime.name = "application/pdf";
|
||
|
mime.description = "PDF-Document";
|
||
|
plugin.mimeTypes<<mime;
|
||
|
_plugins.push_back(plugin);
|
||
|
}
|
||
|
virtual QObject* create(const QString& mimeType, const QUrl& url,
|
||
|
const QStringList& argumentNames,
|
||
|
const QStringList& argumentValues ) const {
|
||
|
LOG<<"mimeType:"<<mimeType
|
||
|
<<"url:"<<url
|
||
|
<<"argumentNames:"<<argumentNames.join(", ")
|
||
|
<<"argumentValues:"<<argumentValues.join(", ");
|
||
|
if (mimeType=="application/pdf") {
|
||
13 years ago
|
return new SaveOrRunPlugin(url, mimeType);
|
||
13 years ago
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
virtual QList<Plugin> plugins() const {
|
||
|
LOG;
|
||
|
return _plugins;
|
||
|
}
|
||
|
virtual void refreshPlugins() {
|
||
|
LOG;
|
||
|
}
|
||
|
private:
|
||
|
QList<Plugin> _plugins;
|
||
|
};
|
||
|
|
||
|
#endif
|