From 2e68daf1a6c8da0a2c49bcdae9a97588ced95444 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 2 Oct 2009 00:31:32 +0200 Subject: Changing page layout (more to come..) --- src/homepage.cpp | 56 +++++++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 35 deletions(-) (limited to 'src/homepage.cpp') diff --git a/src/homepage.cpp b/src/homepage.cpp index 9a3c8ca9..58e1e849 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -99,27 +99,22 @@ QString HomePage::fillPreferred() QStringList names = ReKonfig::previewNames(); QStringList urls = ReKonfig::previewUrls(); - QString speed = ""; - for(int i=0; i<4; ++i) + QString speed = ""; + for(int i=0; i<8; ++i) { - speed += ""; - } - speed += ""; - for(int i=4; i<8; ++i) - { - speed += ""; + speed += "" + text + ""; } - speed += "
"; - speed += ""; - speed += ""; - speed += "

"; - speed += "" + names.at(i) + "
"; + QString text = names.at(i); + if(text.length() > 20) + { + text.truncate(17); + text += "..."; + } + speed += "
"; speed += ""; speed += ""; speed += "

"; - speed += "" + names.at(i) + "
"; return speed; } @@ -129,37 +124,29 @@ QString HomePage::lastVisitedSites() { HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); - QString last = ""; + QString last = ""; int i = 0; do { QModelIndex index = model->index(i, 0, QModelIndex() ); if(model->hasChildren(index)) { - for(int j=0; j< model->rowCount(index) && j<4; ++j) + for(int j=0; j< model->rowCount(index) && j<8; ++j) { QModelIndex son = model->index(j, 0, index ); - - last += ""; - - i++; - } - last += ""; - for(int j=4; j< model->rowCount(index) && j<8; ++j) - { - QModelIndex son = model->index(j, 0, index ); - - last += ""; + last += "" + text + ""; i++; } @@ -168,7 +155,6 @@ QString HomePage::lastVisitedSites() } while( i<8 || model->hasIndex( i , 0 , QModelIndex() ) ); - last += "
"; + + QString text = son.data().toString(); + if(text.length() > 20) + { + text.truncate(17); + text += "..."; + } + last += "
"; last += ""; last += ""; last += "

"; - last += "" + son.data().toString() + "
"; - last += ""; - last += ""; - last += "

"; - last += "" + son.data().toString() + "
"; return last; } -- cgit v1.2.1