diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-19 17:01:34 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-19 17:01:34 +0200 |
commit | 382d988082af6cb74c128b7011c2c0c8c9c00cfc (patch) | |
tree | 2f72320b358941816271016bf6afa3d0acf807ae /src | |
parent | Fixing title changes.. (diff) | |
download | rekonq-382d988082af6cb74c128b7011c2c0c8c9c00cfc.tar.xz |
check title length fix
Diffstat (limited to 'src')
-rw-r--r-- | src/homepage.cpp | 19 | ||||
-rw-r--r-- | src/previewimage.cpp | 18 | ||||
-rw-r--r-- | src/previewimage.h | 2 |
3 files changed, 20 insertions, 19 deletions
diff --git a/src/homepage.cpp b/src/homepage.cpp index 7d93216c..1328fc8d 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -115,15 +115,9 @@ QString HomePage::fillFavorites() QString speed; for(int i=0; i<8; ++i) { - QString text = names.at(i); - if(text.length() > 23) - { - text.truncate(20); - text += "..."; - } speed += "<div class=\"thumbnail\">"; speed += "<object type=\"application/image-preview\" data=\"" + urls.at(i) + "\" >"; - speed += "<param name=\"title\" value=\"" + text + "\" />"; + speed += "<param name=\"title\" value=\"" + names.at(i) + "\" />"; speed += "<param name=\"index\" value=\"" + QString::number(i) + "\" />"; speed += "<param name=\"isFavorite\" value=\"true\" />"; speed += "</object>"; @@ -146,7 +140,7 @@ QString HomePage::lastVisitedSites() last += "<object type=\"application/image-preview\" data=\"" + it.url + "\" >"; last += "</object>"; last += "<br />"; - last += "<a href=\"" + it.url + "\">" + it.url + "</a></div>"; + last += "<a href=\"" + it.url + "\">" + it.title + "</a></div>"; } return last; @@ -282,16 +276,9 @@ QString HomePage::fillClosedTabs() Q_FOREACH( const HistoryItem &item, links) { - QString text = item.title; - if(text.length() > 20) - { - text.truncate(17); - text += "..."; - } - closed += "<div class=\"thumbnail\">"; closed += "<object type=\"application/image-preview\" data=\"" + item.url + "\" >"; - closed += "<param name=\"title\" value=\"" + text + "\" />"; + closed += "<param name=\"title\" value=\"" + item.title + "\" />"; closed += "</object>"; closed += "</div>"; } diff --git a/src/previewimage.cpp b/src/previewimage.cpp index 724d3744..b90a4720 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -102,6 +102,7 @@ void PreviewImage::loadUrlPreview(const QUrl& url) { m_pixmap.load(m_savePath); m_imageLabel->setPixmap(m_pixmap); + checkTitle(); m_textLabel->setText(m_title); } else @@ -131,6 +132,7 @@ void PreviewImage::snapFinished() m_pixmap = ws->previewImage(); m_imageLabel->setPixmap(m_pixmap); + checkTitle(); m_textLabel->setText(m_title); // kDebug() << "m_pixmap: " << m_pixmap.size(); @@ -167,6 +169,7 @@ void PreviewImage::showEmptyPreview() m_imageLabel->clear(); m_textLabel->clear(); + QHBoxLayout *layout = new QHBoxLayout(m_imageLabel); m_button = new QToolButton(m_imageLabel); m_button->setDefaultAction(historyMenu()); m_button->setPopupMode(QToolButton::InstantPopup); @@ -174,9 +177,8 @@ void PreviewImage::showEmptyPreview() m_button->setText(i18n("Add Preview")); m_button->setAutoRaise(true); m_button->setIconSize(QSize(48, 48)); - m_button->show(); - -// m_textLabel->setText( i18n("Add Preview") ); + layout->addWidget(m_button); + m_imageLabel->setLayout(layout); } @@ -333,3 +335,13 @@ QString PreviewImage::guessNameFromUrl(QUrl url) return name; } + + +void PreviewImage::checkTitle() +{ + if(m_title.length() > 23) + { + m_title.truncate(20); + m_title += "..."; + } +} diff --git a/src/previewimage.h b/src/previewimage.h index b8ef1f4c..d7f4d2aa 100644 --- a/src/previewimage.h +++ b/src/previewimage.h @@ -70,6 +70,8 @@ protected: void showEmptyPreview(); private: + void checkTitle(); + QPixmap m_pixmap; WebSnap *ws; |