summaryrefslogtreecommitdiff
path: root/src/homepage.cpp
diff options
context:
space:
mode:
authormatgic78 <matgic78@gmail.com>2009-10-14 16:45:18 +0200
committermatgic78 <matgic78@gmail.com>2009-10-14 16:45:18 +0200
commit92a5daa103a54c2c4253d45cc882da1990bfbd03 (patch)
tree3f021abbc1843b9415b1d573870994da29ceed63 /src/homepage.cpp
parentHUGE COMMIT (diff)
downloadrekonq-92a5daa103a54c2c4253d45cc882da1990bfbd03.tar.xz
favorites management
-right click menu to set the preview url by selecting one of the 15 last history entries -abitlity to remove previews and manage empty previews (show a toolbutton to set the url) -contextmenu->add to favorites now adds preview in an empty space when there is one -modified the loop used in HomePage::lastVisited because I encountered an infinite loop with it. (and because it is simpler this way)
Diffstat (limited to 'src/homepage.cpp')
-rw-r--r--src/homepage.cpp39
1 files changed, 11 insertions, 28 deletions
diff --git a/src/homepage.cpp b/src/homepage.cpp
index 3cc908a9..2749fe58 100644
--- a/src/homepage.cpp
+++ b/src/homepage.cpp
@@ -70,7 +70,6 @@ QString HomePage::rekonqHomePage(const KUrl &url)
kWarning() << "Couldn't open the home.html file";
return QString("");
}
-
QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics");
QString menu = homePageMenu(url);
@@ -119,6 +118,8 @@ QString HomePage::fillFavorites()
speed += "<div class=\"thumbnail\">";
speed += "<object type=\"application/image-preview\" data=\"";
speed += urls.at(i) + "\" width=\"200\">";
+ speed += "<param name=\"index\" value=\"" + QString::number(i) + "\" />";
+ speed += "<param name=\"isFavorite\" value=\"true\" />";
speed += "</object>";
speed += "<br />";
speed += "<a href=\"" + urls.at(i) + "\">" + text + "</a></div>";
@@ -133,35 +134,17 @@ QString HomePage::lastVisitedSites()
HistoryTreeModel *model = Application::historyManager()->historyTreeModel();
QString last;
- int sites = 0;
- int i = 0;
- do
+ QList<HistoryItem> history = Application::historyManager()->history();
+ for (int i = 0; i < 8 && i < history.size(); ++i)
{
- QModelIndex index = model->index(i, 0, QModelIndex() );
- if(model->hasChildren(index))
- {
- for(int j=0; j< model->rowCount(index) && sites<8; ++j)
- {
- QModelIndex son = model->index(j, 0, index );
-
- QString text = son.data().toString();
- if(text.length() > 20)
- {
- text.truncate(17);
- text += "...";
- }
- last += "<div class=\"thumbnail\">";
- last += "<object type=\"application/image-preview\" data=\"" + son.data(HistoryModel::UrlStringRole).toString();
- last += "\" width=\"200\">";
- last += "</object>";
- last += "<br />";
- last += "<a href=\"" + son.data(HistoryModel::UrlStringRole).toString() + "\">" + text + "</a></div>";
- sites++;
- }
- }
- i++;
+ HistoryItem it = history.at(i);
+ last += "<div class=\"thumbnail\">";
+ last += "<object type=\"application/image-preview\" data=\"" + it.url;
+ last += "\" width=\"200\">";
+ last += "</object>";
+ last += "<br />";
+ last += "<a href=\"" + it.url + "\">" + it.url + "</a></div>";
}
- while( sites<8 || model->hasIndex( i , 0 , QModelIndex() ) );
return last;