[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/apps/plasma/applets/folderview
From: Andrew Lake <jamboarder () yahoo ! com>
Date: 2008-06-10 1:40:02
Message-ID: 1213062002.034283.5145.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 818927 by alake:
Display path when custom paths are selected.
M +33 -1 folderview.cpp
M +1 -0 folderview.h
--- trunk/KDE/kdebase/apps/plasma/applets/folderview/folderview.cpp #818926:818927
@@ -85,6 +85,7 @@
m_newMenu = 0;
m_layoutValid = false;
+ m_titleHeight = 0;
m_doubleClick = false;
m_dragInProgress = false;
@@ -256,7 +257,7 @@
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 @@
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();
--- trunk/KDE/kdebase/apps/plasma/applets/folderview/folderview.h #818926:818927
@@ -107,6 +107,7 @@
ProxyModel *m_model;
QItemSelectionModel *m_selectionModel;
KUrl m_url;
+ int m_titleHeight;
QString m_filterFiles;
QFont m_font;
KNewMenu *m_newMenu;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic