From 01e5c03236fa589b719544f478ea036b8b1e2ee7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 1 Oct 2009 12:02:30 +0200 Subject: Code fixes in the homepage also changed history && bookmarks layout (we need just icons there) --- src/homepage.cpp | 41 +++++++++++++++++++++-------------------- src/previewimage.cpp | 6 +++--- src/previewimage.h | 8 ++++---- src/webpluginfactory.cpp | 14 +++----------- src/websnap.cpp | 4 ++-- src/websnap.h | 4 ++-- 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 += "
"; - speed += ""; - speed += ""; + speed += ""; speed += ""; speed += "

"; speed += "" + names.at(i) + ""; @@ -112,8 +112,8 @@ QString HomePage::fillPreferred() for(int i=4; i<8; ++i) { speed += "
"; - speed += ""; - speed += ""; + speed += ""; speed += ""; speed += "

"; speed += "" + names.at(i) + ""; @@ -140,9 +140,8 @@ QString HomePage::lastVisitedSites() QModelIndex son = model->index(j, 0, index ); last += "
"; - last += ""; - last += ""; - last += ""; + last += ""; last += ""; last += "

"; last += "" + son.data().toString() + ""; @@ -155,9 +154,8 @@ QString HomePage::lastVisitedSites() QModelIndex son = model->index(j, 0, index ); last += "
"; - last += ""; - last += ""; - last += ""; + last += ""; last += ""; last += "

"; last += "" + son.data().toString() + ""; @@ -189,7 +187,7 @@ QString HomePage::homePageMenu() QString HomePage::fillHistory() { - QString history = ""; + 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 += ""; + history += "

" + index.data().toString() + "

"; for(int j=0; j< model->rowCount(index); ++j) { QModelIndex son = model->index(j, 0, index ); - history += QString(""); - history += QString(""); - history += QString(""); + history += son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm"); + history += " "; + history += QString("") + + son.data().toString() + QString(""); + history += "
"; } } i++; @@ -226,14 +225,13 @@ QString HomePage::fillBookmarks() return QString("Error retrieving bookmarks!"); } - QString str = QString("

" + index.data().toString() + "

") + son.data().toString() + QString("") + - son.data(HistoryModel::UrlStringRole).toString() + QString("") + son.data(HistoryModel::DateTimeRole).toString() + QString("
"); + QString str = QString(""); KBookmark bookmark = bookGroup.first(); while (!bookmark.isNull()) { str += createBookItem(bookmark); bookmark = bookGroup.next(bookmark); } - str += QString("
"); return str; } @@ -245,7 +243,7 @@ QString HomePage::createBookItem(const KBookmark &bookmark) QString result = QString(""); KBookmarkGroup group = bookmark.toGroup(); KBookmark bm = group.first(); - result += "

" + bookmark.text() + "

"; + result += "

" + bookmark.text() + "

"; while (!bm.isNull()) { @@ -259,5 +257,8 @@ QString HomePage::createBookItem(const KBookmark &bookmark) { return QString("
"); } - return "" + bookmark.text() + "" + bookmark.url().prettyUrl() + ""; + + QString books = " "; + books += "" + bookmark.text() + "
"; + 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 -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 #include -#include +#include 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; iload( 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 -- cgit v1.2.1