mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Merge branch 'KDE/4.14'
This commit is contained in:
commit
1233bee5fa
3 changed files with 23 additions and 9 deletions
|
@ -187,6 +187,10 @@ QByteArray DolphinTabPage::saveState() const
|
||||||
|
|
||||||
void DolphinTabPage::restoreState(const QByteArray& state)
|
void DolphinTabPage::restoreState(const QByteArray& state)
|
||||||
{
|
{
|
||||||
|
if (state.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray sd = state;
|
QByteArray sd = state;
|
||||||
QDataStream stream(&sd, QIODevice::ReadOnly);
|
QDataStream stream(&sd, QIODevice::ReadOnly);
|
||||||
|
|
||||||
|
|
|
@ -1136,14 +1136,24 @@ void KStandardItemListWidget::updateIconsLayoutTextCache()
|
||||||
const int textLength = line.textStart() + line.textLength();
|
const int textLength = line.textStart() + line.textLength();
|
||||||
if (textLength < nameText.length()) {
|
if (textLength < nameText.length()) {
|
||||||
// Elide the last line of the text
|
// Elide the last line of the text
|
||||||
QString lastTextLine = nameText.mid(line.textStart());
|
qreal elidingWidth = maxWidth;
|
||||||
lastTextLine = m_customizedFontMetrics.elidedText(lastTextLine,
|
qreal lastLineWidth;
|
||||||
Qt::ElideRight,
|
do {
|
||||||
maxWidth);
|
QString lastTextLine = nameText.mid(line.textStart());
|
||||||
const QString elidedText = nameText.left(line.textStart()) + lastTextLine;
|
lastTextLine = m_customizedFontMetrics.elidedText(lastTextLine,
|
||||||
nameTextInfo->staticText.setText(elidedText);
|
Qt::ElideRight,
|
||||||
|
elidingWidth);
|
||||||
|
const QString elidedText = nameText.left(line.textStart()) + lastTextLine;
|
||||||
|
nameTextInfo->staticText.setText(elidedText);
|
||||||
|
|
||||||
|
lastLineWidth = m_customizedFontMetrics.boundingRect(lastTextLine).width();
|
||||||
|
|
||||||
|
// We do the text eliding in a loop with decreasing width (1 px / iteration)
|
||||||
|
// to avoid problems related to different width calculation code paths
|
||||||
|
// within Qt. (see bug 337104)
|
||||||
|
elidingWidth -= 1.0;
|
||||||
|
} while (lastLineWidth > maxWidth);
|
||||||
|
|
||||||
const qreal lastLineWidth = m_customizedFontMetrics.boundingRect(lastTextLine).width();
|
|
||||||
nameWidth = qMax(nameWidth, lastLineWidth);
|
nameWidth = qMax(nameWidth, lastLineWidth);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1289,11 +1289,11 @@ void DolphinView::updateViewState()
|
||||||
m_view->scrollToItem(currentIndex);
|
m_view->scrollToItem(currentIndex);
|
||||||
m_scrollToCurrentItem = false;
|
m_scrollToCurrentItem = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentItemUrl = KUrl();
|
|
||||||
} else {
|
} else {
|
||||||
selectionManager->setCurrentItem(0);
|
selectionManager->setCurrentItem(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_currentItemUrl = KUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_restoredContentsPosition.isNull()) {
|
if (!m_restoredContentsPosition.isNull()) {
|
||||||
|
|
Loading…
Reference in a new issue