mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Display path when custom paths are selected.
svn path=/trunk/KDE/kdebase/apps/; revision=818927
This commit is contained in:
parent
1df1a51a99
commit
b320b7b756
2 changed files with 34 additions and 1 deletions
|
@ -85,6 +85,7 @@ FolderView::FolderView(QObject *parent, const QVariantList &args)
|
|||
|
||||
m_newMenu = 0;
|
||||
m_layoutValid = false;
|
||||
m_titleHeight = 0;
|
||||
m_doubleClick = false;
|
||||
m_dragInProgress = false;
|
||||
|
||||
|
@ -256,7 +257,7 @@ void FolderView::layoutItems() const
|
|||
int spacing = 10;
|
||||
int margin = 10;
|
||||
int x = rect.x() + margin;
|
||||
int y = rect.y() + margin;
|
||||
int y = rect.y() + margin + m_titleHeight;
|
||||
|
||||
QSize grid = gridSize();
|
||||
int rowHeight = 0;
|
||||
|
@ -293,6 +294,37 @@ void FolderView::paintInterface(QPainter *painter, const QStyleOptionGraphicsIte
|
|||
opt.palette.setColor(QPalette::All, QPalette::Text, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
|
||||
m_delegate->setShadowColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
|
||||
|
||||
//Show path if not ~/Desktop
|
||||
if (m_url != KUrl("desktop:/")) {
|
||||
QPen currentPen = painter->pen();
|
||||
m_titleHeight = painter->fontMetrics().height();
|
||||
|
||||
painter->setPen(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
|
||||
QString titleText;
|
||||
if (m_url.isLocalFile() && m_url.path().startsWith(KUrl("~").path())) {
|
||||
titleText = m_url.path().replace(KUrl("~").path(), i18n("Home"));
|
||||
} else {
|
||||
titleText = m_url.pathOrUrl();
|
||||
}
|
||||
titleText = painter->fontMetrics().elidedText(titleText, Qt::ElideMiddle, contentRect.width());
|
||||
painter->drawText(contentRect, Qt::AlignLeft, titleText);
|
||||
|
||||
painter->setPen(Qt::NoPen);
|
||||
QLinearGradient lineGrad(contentRect.topLeft(), contentRect.topRight());
|
||||
QColor lineColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor));
|
||||
lineColor.setAlphaF(0.8);
|
||||
lineGrad.setColorAt(0.0, lineColor);
|
||||
lineColor.setAlphaF(0.0);
|
||||
lineGrad.setColorAt(1.0, lineColor);
|
||||
QBrush lineBrush(lineGrad);
|
||||
painter->setBrush(lineBrush);
|
||||
painter->drawRect(contentRect.left(), contentRect.top() + m_titleHeight, contentRect.width(), 1);
|
||||
|
||||
painter->setPen(currentPen);
|
||||
} else {
|
||||
m_titleHeight = 0;
|
||||
}
|
||||
|
||||
if (!m_layoutValid)
|
||||
layoutItems();
|
||||
|
||||
|
|
|
@ -107,6 +107,7 @@ private:
|
|||
ProxyModel *m_model;
|
||||
QItemSelectionModel *m_selectionModel;
|
||||
KUrl m_url;
|
||||
int m_titleHeight;
|
||||
QString m_filterFiles;
|
||||
QFont m_font;
|
||||
KNewMenu *m_newMenu;
|
||||
|
|
Loading…
Reference in a new issue