From 92a5daa103a54c2c4253d45cc882da1990bfbd03 Mon Sep 17 00:00:00 2001 From: matgic78 Date: Wed, 14 Oct 2009 16:45:18 +0200 Subject: 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) --- src/homepage.cpp | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'src/homepage.cpp') 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 += "
"; speed += ""; + speed += ""; + speed += ""; speed += ""; speed += "
"; speed += "" + text + "
"; @@ -133,35 +134,17 @@ QString HomePage::lastVisitedSites() HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); QString last; - int sites = 0; - int i = 0; - do + QList 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 += "
"; - last += ""; - last += ""; - last += "
"; - last += "" + text + "
"; - sites++; - } - } - i++; + HistoryItem it = history.at(i); + last += "
"; + last += ""; + last += ""; + last += "
"; + last += "" + it.url + "
"; } - while( sites<8 || model->hasIndex( i , 0 , QModelIndex() ) ); return last; -- cgit v1.2.1