summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/homepage.cpp41
-rw-r--r--src/previewimage.cpp6
-rw-r--r--src/previewimage.h8
-rw-r--r--src/webpluginfactory.cpp14
-rw-r--r--src/websnap.cpp4
-rw-r--r--src/websnap.h4
6 files changed, 35 insertions, 42 deletions
diff --git a/src/homepage.cpp b/src/homepage.cpp
index 5b8c9de2..e728b949 100644
--- a/src/homepage.cpp
+++ b/src/homepage.cpp
@@ -102,8 +102,8 @@ QString HomePage::fillPreferred()
for(int i=0; i<4; ++i)
{
speed += "<td><div class=\"thumbnail\">";
- speed += "<object type=\"application/image-preview\" width=\"200\">";
- speed += "<param name=\"url\" value=\"" + urls.at(i) + "\">";
+ speed += "<object type=\"application/image-preview\" data=\"";
+ speed += urls.at(i) + "\" width=\"200\">";
speed += "</object>";
speed += "<br /><br />";
speed += "<a href=\"" + urls.at(i) + "\">" + names.at(i) + "</a></div></td>";
@@ -112,8 +112,8 @@ QString HomePage::fillPreferred()
for(int i=4; i<8; ++i)
{
speed += "<td><div class=\"thumbnail\">";
- speed += "<object type=\"application/image-preview\" width=\"200\">";
- speed += "<param name=\"url\" value=\"" + urls.at(i) + "\">";
+ speed += "<object type=\"application/image-preview\" data=\"";
+ speed += urls.at(i) + "\" width=\"200\">";
speed += "</object>";
speed += "<br /><br />";
speed += "<a href=\"" + urls.at(i) + "\">" + names.at(i) + "</a></div></td>";
@@ -140,9 +140,8 @@ QString HomePage::lastVisitedSites()
QModelIndex son = model->index(j, 0, index );
last += "<td><div class=\"thumbnail\">";
- last += "<object type=\"application/image-preview\" width=\"200\">";
- last += "<param name=\"url\" value=\"" + son.data(HistoryModel::UrlStringRole).toString() + "\">";
- last += "<param name=\"position\" value=\"" + QString::number(i) + "\">";
+ last += "<object type=\"application/image-preview\" data=\"" + son.data(HistoryModel::UrlStringRole).toString();
+ last += "\" width=\"200\">";
last += "</object>";
last += "<br /><br />";
last += "<a href=\"" + son.data(HistoryModel::UrlStringRole).toString() + "\">" + son.data().toString() + "</a></div></td>";
@@ -155,9 +154,8 @@ QString HomePage::lastVisitedSites()
QModelIndex son = model->index(j, 0, index );
last += "<td><div class=\"thumbnail\">";
- last += "<object type=\"application/image-preview\" width=\"200\">";
- last += "<param name=\"url\" value=\"" + son.data(HistoryModel::UrlStringRole).toString() + "\">";
- last += "<param name=\"position\" value=\"" + QString::number(i) + "\">";
+ last += "<object type=\"application/image-preview\" data=\"" + son.data(HistoryModel::UrlStringRole).toString();
+ last += "\" width=\"200\">";
last += "</object>";
last += "<br /><br />";
last += "<a href=\"" + son.data(HistoryModel::UrlStringRole).toString() + "\">" + son.data().toString() + "</a></div></td>";
@@ -189,7 +187,7 @@ QString HomePage::homePageMenu()
QString HomePage::fillHistory()
{
- QString history = "<table>";
+ QString history = "";
HistoryTreeModel *model = Application::historyManager()->historyTreeModel();
int i = 0;
@@ -198,14 +196,15 @@ QString HomePage::fillHistory()
QModelIndex index = model->index(i, 0, QModelIndex() );
if(model->hasChildren(index))
{
- history += "<tr colspan=\"2\"><td><h3>" + index.data().toString() + "</h3></td></tr>";
+ history += "<h3>" + index.data().toString() + "</h3>";
for(int j=0; j< model->rowCount(index); ++j)
{
QModelIndex son = model->index(j, 0, index );
- history += QString("<tr><td>") + son.data().toString() + QString("</td>");
- history += QString("<td><a href=\"") + son.data(HistoryModel::UrlStringRole).toString() + QString("\">") +
- son.data(HistoryModel::UrlStringRole).toString() + QString("</a></td>");
- history += QString("<td>") + son.data(HistoryModel::DateTimeRole).toString() + QString("</td></tr>");
+ history += son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm");
+ history += " ";
+ history += QString("<a href=\"") + son.data(HistoryModel::UrlStringRole).toString() + QString("\">") +
+ son.data().toString() + QString("</a>");
+ history += "<br />";
}
}
i++;
@@ -226,14 +225,13 @@ QString HomePage::fillBookmarks()
return QString("Error retrieving bookmarks!");
}
- QString str = QString("<table>");
+ QString str = QString("");
KBookmark bookmark = bookGroup.first();
while (!bookmark.isNull())
{
str += createBookItem(bookmark);
bookmark = bookGroup.next(bookmark);
}
- str += QString("</table>");
return str;
}
@@ -245,7 +243,7 @@ QString HomePage::createBookItem(const KBookmark &bookmark)
QString result = QString("");
KBookmarkGroup group = bookmark.toGroup();
KBookmark bm = group.first();
- result += "<tr colspan=\"2\"><td><h3>" + bookmark.text() + "</h3></td></tr>";
+ result += "<h3>" + bookmark.text() + "</h3>";
while (!bm.isNull())
{
@@ -259,5 +257,8 @@ QString HomePage::createBookItem(const KBookmark &bookmark)
{
return QString("<hr />");
}
- return "<tr><td>" + bookmark.text() + "</td><td><a href=\"" + bookmark.url().prettyUrl() + "\">" + bookmark.url().prettyUrl() + "</a></td></tr>";
+
+ QString books = " ";
+ books += "<a href=\"" + bookmark.url().prettyUrl() + "\">" + bookmark.text() + "</a><br />";
+ return books;
}
diff --git a/src/previewimage.cpp b/src/previewimage.cpp
index af6e4361..44c0850a 100644
--- a/src/previewimage.cpp
+++ b/src/previewimage.cpp
@@ -36,7 +36,7 @@
#include <KDebug>
-PreviewImage::PreviewImage(const QString &url)
+PreviewImage::PreviewImage(const QUrl &url)
: QLabel()
, ws(0)
, m_url(url)
@@ -88,9 +88,9 @@ void PreviewImage::mousePressEvent(QMouseEvent *event)
}
-QString PreviewImage::guessNameFromUrl(QString url)
+QString PreviewImage::guessNameFromUrl(QUrl url)
{
- QString name = QUrl(url).toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash );
+ QString name = url.toString( QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash );
// TODO learn Regular Expressions :)
name.remove('/');
diff --git a/src/previewimage.h b/src/previewimage.h
index 11dee271..96a11c20 100644
--- a/src/previewimage.h
+++ b/src/previewimage.h
@@ -32,17 +32,17 @@
#include <QLabel>
#include <QImage>
-#include <QString>
+#include <QUrl>
class PreviewImage : public QLabel
{
Q_OBJECT
public:
- PreviewImage(const QString &url);
+ PreviewImage(const QUrl &url);
~PreviewImage();
- QString guessNameFromUrl(QString url);
+ QString guessNameFromUrl(QUrl url);
public slots:
void setSiteImage();
@@ -54,7 +54,7 @@ private:
QPixmap m_pixmap;
WebSnap *ws;
- QString m_url;
+ QUrl m_url;
QString m_savePath;
};
diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp
index 27799ca6..5d99ff6d 100644
--- a/src/webpluginfactory.cpp
+++ b/src/webpluginfactory.cpp
@@ -50,22 +50,14 @@ QObject *WebPluginFactory::create(const QString &mimeType,
const QStringList &argumentNames,
const QStringList &argumentValues) const
{
- Q_UNUSED(url)
+ Q_UNUSED(argumentNames)
+ Q_UNUSED(argumentValues)
kDebug() << "loading mimeType: " << mimeType;
if(mimeType == QString("application/image-preview") )
{
- QString imageUrl;
- for(int i = 0; i<argumentNames.count(); ++i)
- {
- if(argumentNames.at(i) == QString("url"))
- {
- imageUrl = argumentValues.at(i);
- break;
- }
- }
- return new PreviewImage(imageUrl);
+ return new PreviewImage(url);
}
// this let QtWebKit using builtin plugins
diff --git a/src/websnap.cpp b/src/websnap.cpp
index 9d747e66..d7871adc 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -43,7 +43,7 @@
#define HEIGHT 150
-WebSnap::WebSnap(const QString &url)
+WebSnap::WebSnap(const QUrl &url)
: QObject()
{
m_url = url;
@@ -57,7 +57,7 @@ WebSnap::WebSnap(const QString &url)
void WebSnap::load()
{
- m_page.mainFrame()->load( QUrl(m_url) );
+ m_page.mainFrame()->load(m_url);
}
diff --git a/src/websnap.h b/src/websnap.h
index 7feb37fb..ee513154 100644
--- a/src/websnap.h
+++ b/src/websnap.h
@@ -45,7 +45,7 @@ class WebSnap : public QObject
Q_OBJECT
public:
- WebSnap(const QString &url);
+ WebSnap(const QUrl &url);
QPixmap previewImage();
static QPixmap renderPreview(const QWebPage &page, int w, int h);
@@ -61,7 +61,7 @@ private:
QWebPage m_page;
QPixmap m_image;
- QString m_url;
+ QUrl m_url;
};
#endif // WEB_SNAP_H