summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-10-15 00:45:10 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-10-15 00:45:10 +0200
commit04da2debaea50b8339404280daba2290961203c6 (patch)
treeacd15729c9a568dacfdb2b2444d6f8e6db29fcdc /src
parentMerge commit 'refs/merge-requests/1805' of git://gitorious.org/rekonq/mainlin... (diff)
downloadrekonq-04da2debaea50b8339404280daba2290961203c6.tar.xz
Fixing code of PluginFactory + PreviewImage.
In this way, we don't need to pass *ALL* the QStringList(s)..
Diffstat (limited to 'src')
-rw-r--r--src/previewimage.cpp22
-rw-r--r--src/previewimage.h4
-rw-r--r--src/webpluginfactory.cpp18
3 files changed, 18 insertions, 26 deletions
diff --git a/src/previewimage.cpp b/src/previewimage.cpp
index 0d246bf3..d6579959 100644
--- a/src/previewimage.cpp
+++ b/src/previewimage.cpp
@@ -48,26 +48,14 @@
#include <QHBoxLayout>
-PreviewImage::PreviewImage(const QUrl &url,
- const QStringList &argumentNames,
- const QStringList &argumentValues)
+PreviewImage::PreviewImage(const QUrl &url, int index, bool isFavorite)
: QLabel()
, ws(0)
, m_url(0)
- , m_isFavorite(false)
- , m_index(-1)
+ , m_isFavorite(isFavorite)
+ , m_index(index)
, m_button(0)
{
- int i;
-
- i = argumentNames.indexOf(QRegExp(QString("isFavorite"), Qt::CaseInsensitive, QRegExp::FixedString));
- if(i > -1 && argumentValues.at(i) == "true")
- m_isFavorite = true;
-
- i = argumentNames.indexOf(QRegExp(QString("index"), Qt::CaseInsensitive, QRegExp::FixedString));
- if(i > -1)
- m_index = argumentValues.at(i).toInt();
-
setUrl(url);
}
@@ -274,10 +262,8 @@ void PreviewImage::setUrlFromAction()
layout()->deleteLater();
m_button->menu()->deleteLater();
m_button->deleteLater();
- }
-
+ }
setUrl(url);
-
}
diff --git a/src/previewimage.h b/src/previewimage.h
index 3d2e9411..0abbe479 100644
--- a/src/previewimage.h
+++ b/src/previewimage.h
@@ -44,9 +44,7 @@ class PreviewImage : public QLabel
Q_OBJECT
public:
- PreviewImage(const QUrl &url,
- const QStringList &argumentNames = QStringList(),
- const QStringList &argumentValues = QStringList());
+ PreviewImage(const QUrl &url, int index, bool isFavorite);
~PreviewImage();
QString guessNameFromUrl(QUrl url);
diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp
index 834cba95..b9d50697 100644
--- a/src/webpluginfactory.cpp
+++ b/src/webpluginfactory.cpp
@@ -53,14 +53,22 @@ QObject *WebPluginFactory::create(const QString &mimeType,
const QStringList &argumentNames,
const QStringList &argumentValues) const
{
- Q_UNUSED(argumentNames)
- Q_UNUSED(argumentValues)
-
kDebug() << "loading mimeType: " << mimeType;
if(mimeType == QString("application/image-preview") )
- {
- return new PreviewImage(url, argumentNames, argumentValues);
+ {
+ int number = -1;
+ bool isFavorite = false;
+
+ int i;
+ i = argumentNames.indexOf( QString("isFavorite") );
+ if(i > -1)
+ isFavorite = true;
+ i = argumentNames.indexOf( QString("index") );
+ if(i > -1)
+ number = argumentValues.at(i).toInt();
+
+ return new PreviewImage(url, number, isFavorite);
}
// this let QtWebKit using builtin plugins