diff -p -up apps/plasma/applets/folderview/folderview.cpp.orig apps/plasma/applets/folderview/folderview.cpp --- apps/plasma/applets/folderview/folderview.cpp.orig 2010-03-02 15:56:56.000000000 -0300 +++ apps/plasma/applets/folderview/folderview.cpp 2010-03-02 16:51:37.000000000 -0300 @@ -347,6 +347,8 @@ void FolderView::init() m_filterFiles = cg.readEntry("filterFiles", "*"); m_filterType = cg.readEntry("filter", 0); m_filterFilesMimeList = cg.readEntry("mimeFilter", QStringList()); + m_firstLineFade = cg.readEntry("firstLineFade", true); + m_frameWidth = cg.readEntry("frameWidth", 0); m_userSelectedShowAllFiles = m_filterType; if (isContainment()) { @@ -518,6 +520,8 @@ void FolderView::createConfigurationInte uiDisplay.previewsAdvanced->setEnabled(m_showPreviews); uiDisplay.numLinesEdit->setValue(m_numTextLines); uiDisplay.colorButton->setColor(textColor()); + uiDisplay.firstLineFade->setChecked(m_firstLineFade); + uiDisplay.frameWidth->setValue(m_frameWidth); for (int i = 0; i < uiDisplay.sortCombo->maxCount(); i++) { if (m_sortColumn == uiDisplay.sortCombo->itemData(i).toInt()) { @@ -735,6 +739,14 @@ void FolderView::configAccepted() needReload = true; } + if (m_firstLineFade != uiDisplay.firstLineFade->isChecked()) { + m_firstLineFade = uiDisplay.firstLineFade->isChecked(); + cg.writeEntry("firstLineFade", m_firstLineFade); + } + + m_frameWidth = uiDisplay.frameWidth->value(); + cg.writeEntry("frameWidth", m_frameWidth); + if (m_iconView) { updateIconViewState(); } @@ -875,6 +887,8 @@ void FolderView::updateIconViewState() m_iconView->setWordWrap(m_numTextLines > 1); m_iconView->setAlignToGrid(m_alignToGrid); m_iconView->setIconsMoveable(!m_iconsLocked); + m_iconView->setFirstLineFade(m_firstLineFade); + m_iconView->setFrameWidth(m_frameWidth); if (m_label) { m_label->setPalette(palette); diff -p -up apps/plasma/applets/folderview/folderviewDisplayConfig.ui.orig apps/plasma/applets/folderview/folderviewDisplayConfig.ui --- apps/plasma/applets/folderview/folderviewDisplayConfig.ui.orig 2010-03-02 15:57:06.000000000 -0300 +++ apps/plasma/applets/folderview/folderviewDisplayConfig.ui 2010-03-02 16:25:25.000000000 -0300 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>442</width> - <height>362</height> + <width>454</width> + <height>405</height> </rect> </property> <layout class="QGridLayout" name="gridLayout"> @@ -63,7 +63,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="1" column="2" colspan="2"> + <item row="1" column="2"> <widget class="KLineEdit" name="labelEdit"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> @@ -101,7 +101,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="3" column="0" rowspan="6"> + <item row="3" column="0" rowspan="5"> <spacer name="horizontalSpacer_3"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -157,7 +157,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="4" column="3"> + <item row="4" column="3" colspan="2"> <spacer name="horizontalSpacer_7"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -227,6 +227,56 @@ p, li { white-space: pre-wrap; } </layout> </item> <item row="6" column="1"> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Frame width:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="6" column="2" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_20"> + <property name="text"> + <string>Normal</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="frameWidth"> + <property name="whatsThis"> + <string>Use this icon to increase the width of the icon frame.</string> + </property> + <property name="maximum"> + <number>48</number> + </property> + <property name="singleStep"> + <number>4</number> + </property> + <property name="pageStep"> + <number>8</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBelow</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_21"> + <property name="text"> + <string>Large</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="7" column="1"> <widget class="QLabel" name="label_8"> <property name="text"> <string>Previews:</string> @@ -236,7 +286,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="6" column="2" colspan="2"> + <item row="7" column="2" colspan="3"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> <widget class="QCheckBox" name="showPreviews"> @@ -273,7 +323,7 @@ p, li { white-space: pre-wrap; } </item> </layout> </item> - <item row="7" column="1"> + <item row="8" column="1"> <widget class="QLabel" name="label_11"> <property name="text"> <string>Lock in place:</string> @@ -283,7 +333,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="7" column="2"> + <item row="8" column="2"> <widget class="QCheckBox" name="lockInPlace"> <property name="whatsThis"> <string>Check this option if you do not want the icons to be moveable in the view. @@ -295,7 +345,7 @@ This option is useful if you want to avo </property> </widget> </item> - <item row="8" column="1"> + <item row="9" column="1"> <widget class="QLabel" name="label_12"> <property name="text"> <string>Align to grid:</string> @@ -305,7 +355,7 @@ This option is useful if you want to avo </property> </widget> </item> - <item row="8" column="2"> + <item row="9" column="2"> <widget class="QCheckBox" name="alignToGrid"> <property name="whatsThis"> <string>Check this option if you want the icons to be arranged in a grid. @@ -317,7 +367,7 @@ When this option is checked, icons will </property> </widget> </item> - <item row="9" column="0" colspan="2"> + <item row="10" column="0" colspan="2"> <widget class="QLabel" name="label_9"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> @@ -334,7 +384,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="10" column="1"> + <item row="11" column="1"> <widget class="QLabel" name="label_3"> <property name="text"> <string>Lines:</string> @@ -347,7 +397,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="10" column="2"> + <item row="11" column="2"> <widget class="KIntSpinBox" name="numLinesEdit"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> @@ -372,7 +422,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="11" column="0"> + <item row="12" column="0"> <spacer name="horizontalSpacer_4"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -388,7 +438,7 @@ p, li { white-space: pre-wrap; } </property> </spacer> </item> - <item row="11" column="1"> + <item row="12" column="1"> <widget class="QLabel" name="label_2"> <property name="text"> <string>Color:</string> @@ -401,7 +451,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="11" column="2"> + <item row="12" column="2"> <widget class="KColorButton" name="colorButton"> <property name="whatsThis"> <string>Click this button to choose the color which is used for the text labels in the view.</string> @@ -411,7 +461,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="12" column="1"> + <item row="13" column="1"> <widget class="QLabel" name="label_10"> <property name="text"> <string>Shadows:</string> @@ -424,7 +474,7 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="12" column="2"> + <item row="13" column="2"> <widget class="QCheckBox" name="drawShadows"> <property name="whatsThis"> <string><html><body><p>Check this option if you want the text labels to cast a shadow on the background.</p> @@ -438,7 +488,27 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="13" column="3"> + <item row="14" column="1"> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>First line fading: </string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="14" column="2"> + <widget class="QCheckBox" name="firstLineFade"> + <property name="whatsThis"> + <string>With this option enabled, the text of an icon will have the fadding effect on the first line.</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="15" column="4"> <spacer name="verticalSpacer_2"> <property name="orientation"> <enum>Qt::Vertical</enum> diff -p -up apps/plasma/applets/folderview/folderview.h.orig apps/plasma/applets/folderview/folderview.h --- apps/plasma/applets/folderview/folderview.h.orig 2010-03-02 15:56:59.000000000 -0300 +++ apps/plasma/applets/folderview/folderview.h 2010-03-02 16:01:27.000000000 -0300 @@ -193,6 +193,8 @@ private: bool m_iconsLocked; bool m_alignToGrid; bool m_userSelectedShowAllFiles; + bool m_firstLineFade; + int m_frameWidth; QString m_customLabel; QStringList m_previewPlugins; int m_customIconSize; diff -p -up apps/plasma/applets/folderview/iconview.cpp.orig apps/plasma/applets/folderview/iconview.cpp --- apps/plasma/applets/folderview/iconview.cpp.orig 2010-03-02 15:57:19.000000000 -0300 +++ apps/plasma/applets/folderview/iconview.cpp 2010-03-02 17:29:32.000000000 -0300 @@ -67,6 +67,7 @@ IconView::IconView(QGraphicsWidget *parent) : AbstractItemView(parent), + m_frameWidth(0), m_itemFrame(0), m_columns(0), m_rows(0), @@ -82,6 +83,7 @@ IconView::IconView(QGraphicsWidget *pare m_alignToGrid(false), m_wordWrap(false), m_popupShowPreview(true), + m_firstLineFade(true), m_flow(layoutDirection() == Qt::LeftToRight ? LeftToRight : RightToLeft), m_popupCausedWidget(0), m_dropOperation(0), @@ -318,7 +320,7 @@ void IconView::updateGridSize() int w = qMin(fm.width('x') * 15, m_iconSize.width() * 2); QSize size; - size.rwidth() = qMax(w, m_iconSize.width()) + left + right; + size.rwidth() = qMax(w, m_iconSize.width()) + left + right + m_frameWidth; size.rheight() = top + bottom + m_iconSize.height() + fm.lineSpacing() * textLineCount() + 4; // Update the minimum size hint @@ -973,6 +975,27 @@ void IconView::finishedScrolling() } } +void IconView::setFirstLineFade(bool on) +{ + if (m_firstLineFade != on) + m_firstLineFade = on; + markAreaDirty(visibleArea()); + update(); +} + +bool IconView::firstLineFade() const +{ + return m_firstLineFade; +} + +void IconView::setFrameWidth(const int width) +{ + if (width != m_frameWidth){ + m_frameWidth = width; + updateGridSize(); + } +} + QSize IconView::itemSize(const QStyleOptionViewItemV4 &option, const QModelIndex &index) const { QSize size = option.decorationSize; @@ -996,7 +1019,11 @@ QSize IconView::itemSize(const QStyleOpt layout.setFont(font); const QSize ts = doTextLayout(layout, QSize(grid.width() - left - right, grid.height() - size.height()), - Qt::AlignHCenter, QTextOption::WrapAtWordBoundaryOrAnywhere); + Qt::AlignHCenter, + (m_firstLineFade) + ? QTextOption::WordWrap + : QTextOption::WrapAtWordBoundaryOrAnywhere + ); size.rwidth() = qMax(size.width(), ts.width()); size.rheight() += ts.height(); @@ -1064,7 +1091,10 @@ void IconView::paintItem(QPainter *paint layout.setText(KStringHandler::preProcessWrap(text)); layout.setFont(font); const QSize size = doTextLayout(layout, tr.size(), Qt::AlignHCenter, - QTextOption::WrapAtWordBoundaryOrAnywhere); + (m_firstLineFade) + ? QTextOption::WordWrap + : QTextOption::WrapAtWordBoundaryOrAnywhere + ); painter->setPen(option.palette.color(QPalette::Text)); drawTextLayout(painter, layout, tr); @@ -1318,7 +1348,10 @@ QRegion IconView::visualRegion(const QMo layout.setText(index.data(Qt::DisplayRole).toString()); layout.setFont(font()); const QSize ts = doTextLayout(layout, tr.size(), Qt::AlignHCenter, - QTextOption::WrapAtWordBoundaryOrAnywhere); + (m_firstLineFade) + ? QTextOption::WordWrap + : QTextOption::WrapAtWordBoundaryOrAnywhere + ); tr = QStyle::alignedRect(layoutDirection(), Qt::AlignTop | Qt::AlignHCenter, ts, tr); // Extend the icon rect so it touches the text rect diff -p -up apps/plasma/applets/folderview/iconview.h.orig apps/plasma/applets/folderview/iconview.h --- apps/plasma/applets/folderview/iconview.h.orig 2010-03-02 15:57:22.000000000 -0300 +++ apps/plasma/applets/folderview/iconview.h 2010-03-02 16:44:29.000000000 -0300 @@ -76,6 +76,7 @@ public: Q_PROPERTY(bool iconsMoveable READ iconsMoveable WRITE setIconsMoveable) Q_PROPERTY(bool customLayout READ customLayout WRITE setCustomLayout) Q_PROPERTY(Flow flow READ flow WRITE setFlow) + Q_PROPERTY(bool firstLineFade READ firstLineFade WRITE setFirstLineFade) public: IconView(QGraphicsWidget *parent); @@ -91,6 +92,11 @@ public: void setWordWrap(bool on); bool wordWrap() const; + void setFirstLineFade(bool on); + bool firstLineFade() const; + + void setFrameWidth(const int width); + void setTextLineCount(int rows); int textLineCount() const; @@ -238,6 +244,8 @@ private: bool m_alignToGrid; bool m_wordWrap; bool m_popupShowPreview; + bool m_firstLineFade; + int m_frameWidth; QPersistentModelIndex m_hoveredIndex; QPersistentModelIndex m_pressedIndex; QPersistentModelIndex m_editorIndex;