diff options
-rw-r--r-- | data/home.html | 12 | ||||
-rw-r--r-- | src/homepage.cpp | 56 |
2 files changed, 27 insertions, 41 deletions
diff --git a/data/home.html b/data/home.html index c0d71f21..1c9cf733 100644 --- a/data/home.html +++ b/data/home.html @@ -32,24 +32,24 @@ color: #3F7AB7; /* page sections */ #container { -width: 85%; +width: 90%; margin: auto; } #header{ -width: 95%; +/* width: 95%; */ text-align:right; } #navigation { -width: 95%; -background: #3F7AB7; +/* width: 95%; */ +/* background: #3F7AB7; */ margin: 2em 0; } #content { -width: 100%; +/* width: 100%; */ text-align: left; } @@ -70,7 +70,7 @@ padding: 0 1em; } div#navigation a{ -color:#FFF; +/* color:#FFF; */ font: normal bold 1.2em/2.5em arial,sans-serif; } 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 = "<table><tr>"; - for(int i=0; i<4; ++i) + QString speed = ""; + for(int i=0; i<8; ++i) { - speed += "<td><div class=\"thumbnail\">"; - 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>"; - } - speed += "</tr><tr>"; - for(int i=4; i<8; ++i) - { - speed += "<td><div class=\"thumbnail\">"; + QString text = names.at(i); + if(text.length() > 20) + { + text.truncate(17); + text += "..."; + } + speed += "<div class=\"thumbnail\">"; 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>"; + speed += "<a href=\"" + urls.at(i) + "\">" + text + "</a></div>"; } - speed += "</tr></table>"; return speed; } @@ -129,37 +124,29 @@ QString HomePage::lastVisitedSites() { HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); - QString last = "<table><tr>"; + 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 += "<td><div class=\"thumbnail\">"; + + 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 /><br />"; - last += "<a href=\"" + son.data(HistoryModel::UrlStringRole).toString() + "\">" + son.data().toString() + "</a></div></td>"; - - i++; - } - last += "</tr><tr>"; - for(int j=4; j< model->rowCount(index) && j<8; ++j) - { - QModelIndex son = model->index(j, 0, index ); - - last += "<td><div class=\"thumbnail\">"; - 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>"; + last += "<a href=\"" + son.data(HistoryModel::UrlStringRole).toString() + "\">" + text + "</a></div>"; i++; } @@ -168,7 +155,6 @@ QString HomePage::lastVisitedSites() } while( i<8 || model->hasIndex( i , 0 , QModelIndex() ) ); - last += "</tr></table>"; return last; } |