[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [patch] desktop grid #79932 (was: desktop icon text lines)
From:       Martin Koller <m.koller () surfeu ! at>
Date:       2004-11-28 19:15:26
Message-ID: 200411282015.30111.m.koller () surfeu ! at
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


On Saturday 27 November 2004 15:50, Martin Koller wrote:
> On Sunday 21 November 2004 21:03, David Faure wrote:
> > Personally I'm for committing the "make it configurable" patch.
>
> I did that now, but have seen, that I have to also solve the general
> problem with #79932 
<snip>

Finally I have a solution:

Attached you'll find a patch which solves 
http://bugs.kde.org/show_bug.cgi?id=79932

The approach is based on what I described in my previous mail, but again here 
my idea:

The user can already define the icon size he likes to have. He can also select 
the font he wants to have on the desktop. With my previous patch, he now also 
can select how many lines of text he wants to have.
But what is missing, is the possibility to select how _wide_ the text can be.
With this setting, we have all information to calculate a good fixed size 
grid.

The width can be defined in kcontrol in the background/advanced dialog (same 
as the text lines)

This is a better solution than simply define a fixed size for the grid, 
because with my approach you can simply play around with different icon sizes 
and font sizes, and you still get a good grid.

Waiting on your feedback ...

-- 
Best regards/Schöne Grüße

Martin    ()  ascii ribbon campaign - against html mail 
          /\                        - against microsoft attachments

       Some operating systems are called 'user friendly',
             Linux however is 'expert friendly'.

["grid.patch" (text/x-diff)]

Index: libkonq/konq_defaults.h
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_defaults.h,v
retrieving revision 1.27
diff -u -3 -p -r1.27 konq_defaults.h
--- libkonq/konq_defaults.h	8 Sep 2004 15:22:35 -0000	1.27
+++ libkonq/konq_defaults.h	28 Nov 2004 18:55:41 -0000
@@ -26,6 +26,7 @@
 #define DEFAULT_UNDERLINELINKS true
 #define DEFAULT_WORDWRAPTEXT true // kfm-like, sorry Reggie :-)
 #define DEFAULT_TEXTHEIGHT 2
+#define DEFAULT_TEXTWIDTH 70
 #define DEFAULT_FILESIZEINBYTES false
 
 #define DEFAULT_RENAMEICONDIRECTLY false
Index: libkonq/konq_iconviewwidget.cc
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_iconviewwidget.cc,v
retrieving revision 1.304
diff -u -3 -p -r1.304 konq_iconviewwidget.cc
--- libkonq/konq_iconviewwidget.cc	21 Nov 2004 21:01:58 -0000	1.304
+++ libkonq/konq_iconviewwidget.cc	28 Nov 2004 18:55:42 -0000
@@ -65,7 +65,6 @@ struct KonqIconViewWidgetPrivate
         pSoundTimer = 0;
         pPreviewJob = 0;
         bAllowSetWallpaper = false;
-	gridXspacing = 50;
 
         doAnimations = true;
         m_movie = 0L;
@@ -94,8 +93,6 @@ struct KonqIconViewWidgetPrivate
     bool bAllowSetWallpaper;
     bool bCaseInsensitive;
     bool bBoostPreview;
-    QPoint desktopGridSpacing;
-    int gridXspacing;
 
     // Animated icons support
     bool doAnimations;
@@ -134,18 +131,6 @@ KonqIconViewWidget::KonqIconViewWidget( 
     connect( this, SIGNAL(onViewport()), SLOT(slotOnViewport()) );
     connect( this, SIGNAL(itemRenamed(QIconViewItem *, const QString &)), \
SLOT(slotItemRenamed(QIconViewItem *, const QString &)) );  
-    if ( m_bDesktop ) {
-        KConfigGroup group( KGlobal::config(), "DesktopIcons" );
-        QPoint defaultSize;
-        d->desktopGridSpacing = group.readPointEntry( "DesktopGridSpacing", \
                &defaultSize );
-        if ( d->desktopGridSpacing.isNull() ) {
-            d->desktopGridSpacing = QPoint( 55, 15 );
-            // read GridXSpacing (for compatibility with old settings)
-            int compat = group.readNumEntry( "GridXSpacing", 0 );
-            if ( compat > 0 )
-                d->desktopGridSpacing.setX( compat );
-        }
-    }
     d->bBoostPreview = boostPreview();
 
     // hardcoded settings
@@ -241,7 +226,6 @@ void KonqIconViewWidget::readAnimatedIco
 {
     KConfigGroup cfgGroup( KGlobal::config(), "DesktopIcons" );
     d->doAnimations = cfgGroup.readBoolEntry( "Animated", true /*default*/ );
-    d->gridXspacing = cfgGroup.readNumEntry( "GridXSpacing", 50);
 }
 
 void KonqIconViewWidget::slotOnItem( QIconViewItem *_item )
@@ -615,13 +599,7 @@ bool KonqIconViewWidget::initConfig( boo
 
 bool KonqIconViewWidget::boostPreview() const
 {
-    if ( m_bDesktop ) {
-        int size = m_size ? m_size : KGlobal::iconLoader()->currentSize( \
                KIcon::Desktop );
-        int mini = spacing() + QMAX( 0, largestPreviewIconSize( size ) - size );
-        if ( d->desktopGridSpacing.x() < mini ||
-             d->desktopGridSpacing.y() < mini )
-            return false;
-    }
+    if ( m_bDesktop ) return false;
 
     KConfigGroup group( KGlobal::config(), "PreviewSettings" );
     return group.readBoolEntry( "BoostSize", false );
@@ -653,7 +631,7 @@ void KonqIconViewWidget::setIcons( int s
     if ( sizeChanged || previewSizeChanged )
     {
         int realSize = size ? size : KGlobal::iconLoader()->currentSize( \
                KIcon::Desktop );
-        setSpacing( ( realSize > KIcon::SizeSmall ) ? 5 : 0 );
+        setSpacing( ( m_bDesktop || ( realSize > KIcon::SizeSmall ) ) ? 5 : 0 );
     }
 
     if ( sizeChanged || previewSizeChanged || !stopImagePreviewFor.isEmpty() )
@@ -734,33 +712,34 @@ void KonqIconViewWidget::gridValues( int
     int iconSize = m_size ? m_size : KGlobal::iconLoader()->currentSize( \
KIcon::Desktop );  
     // Grid size
-    *dx = QMAX( iconSize + d->desktopGridSpacing.x(),
-                   previewSize + spacing() );
-    int textHeight = QMIN( iconTextHeight(), 2 ) * fontMetrics().height();
-    *dy = textHeight + 2 +
-        QMAX( iconSize + d->desktopGridSpacing.y(), previewSize );
+    // as KFileIVI limits to move an icon to x >= 5, y >= 5, we define a grid cell \
as: +    // spacing() must be >= 5 (currently set to 5 in setIcons())
+    // horizontal: left spacing() + <width>
+    // vertical  : top spacing(), <height>, bottom spacing()
+    // The doubled space in y-direction gives a better visual separation and makes \
it clearer +    // to which item the text belongs
+    *dx = spacing() + QMAX( QMAX( iconSize, previewSize ), \
m_pSettings->iconTextWidth() ); +    int textHeight = iconTextHeight() * \
fontMetrics().height(); +    *dy = spacing() + QMAX( iconSize, previewSize ) + 2 + \
textHeight + spacing();  
     // Icon Area
-    int x1, x2, y1, y2;
-    int yOffset = QMAX( 0, *dy - ( previewSize + textHeight ) );
+    int w, h;
     if ( m_IconRect.isValid() ) {
-        *x = x1 = m_IconRect.left(); x2 = m_IconRect.right();
-        y1 = m_IconRect.top(); y2 = m_IconRect.bottom();
+        *x = m_IconRect.left(); w = m_IconRect.width();
+        *y = m_IconRect.top();  h = m_IconRect.height();
     }
     else {
-        *x = x1 = 0; x2 = viewport()->width();
-        y1 = 0; y2 = viewport()->height();
+        *x = 0; w = viewport()->width();
+        *y = 0; h = viewport()->height();
     }
-    *y = y1 -= yOffset / 2;
-    y2 -= yOffset / 2;
 
-    *nx = (x2 - x1) / *dx;
-    *ny = (y2 - y1) / *dy;
+    *nx = w / *dx;
+    *ny = h / *dy;
     // TODO: Check that items->count() <= nx * ny
 
     // Let have exactly nx columns and ny rows
-    *dx = (x2 - x1) / *nx;
-    *dy = (y2 - y1) / *ny;
+    *dx = w / *nx;
+    *dy = h / *ny;
     kdDebug(1203) << "dx = " << *dx << ", dy = " << *dy << "\n";
 }
 
@@ -772,9 +751,10 @@ void KonqIconViewWidget::calculateGridX(
 
 int KonqIconViewWidget::gridXValue() const
 {
+    // this method is only used in konqi as filemanager (not desktop)
     int sz = m_size ? m_size : KGlobal::iconLoader()->currentSize( KIcon::Desktop );
     bool horizontal = (itemTextPos() == QIconView::Right);
-    int newGridX = sz + (!m_bSetGridX ? d->gridXspacing : 50) + ( horizontal ? 100 : \
0); +    int newGridX = sz + 50 + ( horizontal ? 100 : 0);
     newGridX = QMAX( newGridX, (horizontal ? 2 : 1) * previewIconSize( sz ) + 13 );
     //kdDebug(1203) << "gridXValue: " << newGridX << " sz=" << sz << endl;
     return newGridX;
@@ -1490,11 +1470,6 @@ void KonqIconViewWidget::lineupIcons()
         return;
     }
 
-    // Make a list of items
-    QValueList<QIconViewItem*> items;
-    for ( QIconViewItem* item = firstItem(); item; item = item->nextItem() )
-        items.append(item);
-
     int iconSize = m_size ? m_size : KGlobal::iconLoader()->currentSize( \
KIcon::Desktop );  
     // Create a grid of (ny x nx) bins.
@@ -1511,10 +1486,9 @@ void KonqIconViewWidget::lineupIcons()
     }
 
     // Insert items into grid
-    int textHeight = QMIN( iconTextHeight(), 2 ) * fontMetrics().height();
-    QValueList<QIconViewItem*>::Iterator it;
-    for ( it = items.begin(); it != items.end(); it++ ) {
-        QIconViewItem* item = *it;
+    int textHeight = iconTextHeight() * fontMetrics().height();
+
+    for ( QIconViewItem* item = firstItem(); item; item = item->nextItem() ) {
         int x = item->x() + item->width() / 2 - x0;
         int y = item->pixmapRect( false ).bottom() - iconSize / 2
                 - ( dy - ( iconSize + textHeight ) ) / 2 - y0;
@@ -1648,8 +1622,10 @@ void KonqIconViewWidget::lineupIcons()
                 continue;
             if ( !bin->isEmpty() ) {
                 QIconViewItem* item = bin->first();
-                int newX = x0 + i*dx + ( dx - item->width() ) / 2;
-                int newY = y0 + j*dy + dy - ( item->pixmapRect().bottom() + \
textHeight + 2 ); +                int newX = x0 + i*dx + spacing() +
+                           QMAX(0, ( (dx-spacing()) - item->width() ) / 2);  // \
pixmap can be larger as iconsize +                // align all icons vertically to \
their text +                int newY = y0 + j*dy + dy - spacing() - ( \
item->pixmapRect().bottom() + 2 + textHeight );  if ( item->x() != newX || item->y() \
!= newY ) {  QRect oldRect = item->rect();
                     movedItems.prepend( item );
@@ -1664,7 +1640,7 @@ void KonqIconViewWidget::lineupIcons()
     }
 
     // repaint
-    int itemWidth = dx - 2 * spacing();
+    int itemWidth = dx - spacing();
     if ( maxItemWidth() != itemWidth ) {
         setMaxItemWidth( itemWidth );
         setFont( font() );  // Force calcRect()
@@ -1695,7 +1671,7 @@ void KonqIconViewWidget::lineupIcons( QI
 {
     int x0, y0, dx, dy, nxmax, nymax;
     gridValues( &x0, &y0, &dx, &dy, &nxmax, &nymax );
-    int textHeight = QMIN( iconTextHeight(), 2 ) * fontMetrics().height();
+    int textHeight = iconTextHeight() * fontMetrics().height();
 
     QRegion repaintRegion;
     QValueList<QIconViewItem*> movedItems;
@@ -1703,8 +1679,10 @@ void KonqIconViewWidget::lineupIcons( QI
 
     QIconViewItem* item;
     for ( item = firstItem(); item; item = item->nextItem() ) {
-        int newX = x0 + nx * dx + ( dx - item->width() ) / 2;
-        int newY = y0 + ny * dy + dy - ( item->pixmapRect().bottom() + textHeight + \
2 ); +        int newX = x0 + nx*dx + spacing() +
+                   QMAX(0, ( (dx-spacing()) - item->width() ) / 2);  // icon can be \
larger as defined +        // align all icons vertically to their text
+        int newY = y0 + ny*dy + dy - spacing() - ( item->pixmapRect().bottom() + 2 + \
textHeight );  if ( item->x() != newX || item->y() != newY ) {
             QRect oldRect = item->rect();
             movedItems.prepend( item );
Index: libkonq/konq_settings.cc
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_settings.cc,v
retrieving revision 1.54
diff -u -3 -p -r1.54 konq_settings.cc
--- libkonq/konq_settings.cc	15 Feb 2004 01:01:30 -0000	1.54
+++ libkonq/konq_settings.cc	28 Nov 2004 18:55:42 -0000
@@ -36,6 +36,7 @@ struct KonqFMSettingsPrivate
     bool showPreviewsInFileTips;
     bool m_renameIconDirectly;
     bool localeAwareCompareIsCaseSensitive;
+    int m_iconTextWidth;
 };
 
 //static
@@ -86,6 +87,7 @@ void KonqFMSettings::init( KConfig * con
   m_highlightedTextColor = config->readColorEntry( "HighlightedTextColor", \
&m_highlightedTextColor );  m_itemTextBackground = config->readColorEntry( \
"ItemTextBackground" );  
+  d->m_iconTextWidth = config->readNumEntry( "TextWidth", DEFAULT_TEXTWIDTH );
   m_iconTextHeight = config->readNumEntry( "TextHeight", 0 );
   if ( m_iconTextHeight == 0 ) {
     if ( config->readBoolEntry( "WordWrapText", true ) )
@@ -167,3 +169,8 @@ int KonqFMSettings::caseSensitiveCompare
     else // can't use localeAwareCompare, have to fallback to normal QString compare
         return a.compare( b );
 }
+
+int KonqFMSettings::iconTextWidth() const
+{
+    return d->m_iconTextWidth;
+}
Index: libkonq/konq_settings.h
===================================================================
RCS file: /home/kde/kdebase/libkonq/konq_settings.h,v
retrieving revision 1.35
diff -u -3 -p -r1.35 konq_settings.h
--- libkonq/konq_settings.h	17 Nov 2004 17:56:22 -0000	1.35
+++ libkonq/konq_settings.h	28 Nov 2004 18:55:43 -0000
@@ -77,6 +77,7 @@ public:
   // Behaviour settings
   bool wordWrapText() const { return m_bWordWrapText; }
   int iconTextHeight() const { return m_iconTextHeight; }
+  int iconTextWidth() const;
   bool underlineLink() const { return m_underlineLink; }
   bool fileSizeInBytes() const { return m_fileSizeInBytes; }
   bool alwaysNewWin() const { return m_alwaysNewWin; }
Index: kcontrol/background/bgadvanced.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/background/bgadvanced.cpp,v
retrieving revision 1.18
diff -u -3 -p -r1.18 bgadvanced.cpp
--- kcontrol/background/bgadvanced.cpp	26 Nov 2004 20:25:38 -0000	1.18
+++ kcontrol/background/bgadvanced.cpp	28 Nov 2004 18:55:43 -0000
@@ -202,6 +202,16 @@ int BGAdvancedDialog::textLines() const
     return dlg->m_spinTextLines->value();
 }
 
+void BGAdvancedDialog::setTextWidth(int width)
+{
+    dlg->m_spinTextWidth->setValue(width);
+}
+
+int BGAdvancedDialog::textWidth() const
+{
+    return dlg->m_spinTextWidth->value();
+}
+
 void BGAdvancedDialog::updateUI()
 {
     QString prog = r->KBackgroundProgram::name();
Index: kcontrol/background/bgadvanced.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/background/bgadvanced.h,v
retrieving revision 1.8
diff -u -3 -p -r1.8 bgadvanced.h
--- kcontrol/background/bgadvanced.h	26 Nov 2004 20:25:38 -0000	1.8
+++ kcontrol/background/bgadvanced.h	28 Nov 2004 18:55:43 -0000
@@ -52,6 +52,8 @@ public:
    void setShadowEnabled(bool enabled);
    void setTextLines(int lines);
    int textLines() const;
+   void setTextWidth(int width);
+   int textWidth() const;
 
    void updateUI();
 
Index: kcontrol/background/bgadvanced_ui.ui
===================================================================
RCS file: /home/kde/kdebase/kcontrol/background/bgadvanced_ui.ui,v
retrieving revision 1.17
diff -u -3 -p -r1.17 bgadvanced_ui.ui
--- kcontrol/background/bgadvanced_ui.ui	26 Nov 2004 21:29:13 -0000	1.17
+++ kcontrol/background/bgadvanced_ui.ui	28 Nov 2004 18:55:43 -0000
@@ -9,7 +9,7 @@
             <x>0</x>
             <y>0</y>
             <width>511</width>
-            <height>385</height>
+            <height>454</height>
         </rect>
     </property>
     <vbox>
@@ -180,23 +180,6 @@ You can also remove programs from this l
                 <property name="name">
                     <cstring>unnamed</cstring>
                 </property>
-                <spacer row="0" column="2" rowspan="2" colspan="1">
-                    <property name="name">
-                        <cstring>spacer7</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
-                    </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
-                    </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>220</width>
-                            <height>20</height>
-                        </size>
-                    </property>
-                </spacer>
                 <widget class="KColorButton" row="0" column="1">
                     <property name="name">
                         <cstring>m_colorText</cstring>
@@ -216,15 +199,49 @@ You can also remove programs from this l
                         <string>Click here to change the color of the desktop \
font.</string>  </property>
                 </widget>
-                <widget class="QCheckBox" row="2" column="0">
+                <widget class="QLabel" row="0" column="0">
                     <property name="name">
-                        <cstring>m_cbShadow</cstring>
+                        <cstring>textLabel6</cstring>
                     </property>
                     <property name="text">
-                        <string>&amp;Enable shadow</string>
+                        <string>&amp;Text color:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>m_colorText</cstring>
                     </property>
                     <property name="whatsThis" stdset="0">
-                        <string>Check here to enable a shadow outline around the \
desktop font. This also improves the readability of the desktop text against \
backgrounds of a similar color.</string> +                        <string>Click here \
to change the color of the desktop font.</string> +                    </property>
+                </widget>
+                <spacer row="0" column="2" rowspan="2" colspan="1">
+                    <property name="name">
+                        <cstring>spacer7</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>220</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget class="KColorButton" row="1" column="1">
+                    <property name="name">
+                        <cstring>m_colorTextBackground</cstring>
+                    </property>
+                    <property name="enabled">
+                        <bool>false</bool>
+                    </property>
+                    <property name="text">
+                        <string></string>
+                    </property>
+                    <property name="whatsThis" stdset="0">
+                        <string>Click here to select the solid background color. \
Choose a different color from the background text color to assure \
readability.</string>  </property>
                 </widget>
                 <widget class="QCheckBox" row="1" column="0">
@@ -238,18 +255,15 @@ You can also remove programs from this l
                         <string>Check here if you want to use a solid background \
color. This is useful to ensure that the desktop text will be identifiable against \
all background colors and wallpapers, or in other words, that a background or \
wallpaper will not make a desktop text of a similar color difficult to read.</string> \
</property>  </widget>
-                <widget class="QLabel" row="0" column="0">
+                <widget class="QCheckBox" row="2" column="0">
                     <property name="name">
-                        <cstring>textLabel6</cstring>
+                        <cstring>m_cbShadow</cstring>
                     </property>
                     <property name="text">
-                        <string>&amp;Text color:</string>
-                    </property>
-                    <property name="buddy" stdset="0">
-                        <cstring>m_colorText</cstring>
+                        <string>&amp;Enable shadow</string>
                     </property>
                     <property name="whatsThis" stdset="0">
-                        <string>Click here to change the color of the desktop \
font.</string> +                        <string>Check here to enable a shadow outline \
around the desktop font. This also improves the readability of the desktop text \
against backgrounds of a similar color.</string>  </property>
                 </widget>
                 <widget class="QLabel" row="3" column="0">
@@ -280,18 +294,35 @@ You can also remove programs from this l
                         <string>Choose here the maximum number of text lines below \
an icon on the desktop. Longer text will be truncated at the end of the last \
line.</string>  </property>
                 </widget>
-                <widget class="KColorButton" row="1" column="1">
+                <widget class="QSpinBox" row="4" column="1">
                     <property name="name">
-                        <cstring>m_colorTextBackground</cstring>
+                        <cstring>m_spinTextWidth</cstring>
                     </property>
-                    <property name="enabled">
-                        <bool>false</bool>
+                    <property name="suffix">
+                        <string></string>
+                    </property>
+                    <property name="maxValue">
+                        <number>99999</number>
+                    </property>
+                    <property name="value">
+                        <number>0</number>
+                    </property>
+                    <property name="whatsThis" stdset="0">
+                        <string>Choose here the maximum width of text lines below an \
icon on the desktop.</string> +                    </property>
+                </widget>
+                <widget class="QLabel" row="4" column="0">
+                    <property name="name">
+                        <cstring>textLabel6_2_2</cstring>
                     </property>
                     <property name="text">
-                        <string></string>
+                        <string>&amp;Width for icon text:</string>
+                    </property>
+                    <property name="buddy" stdset="0">
+                        <cstring>m_colorText</cstring>
                     </property>
                     <property name="whatsThis" stdset="0">
-                        <string>Click here to select the solid background color. \
Choose a different color from the background text color to assure \
readability.</string> +                        <string>Choose here the maximum width \
of text lines below an icon on the desktop.</string>  </property>
                 </widget>
             </grid>
Index: kcontrol/background/bgdialog.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/background/bgdialog.cpp,v
retrieving revision 1.51
diff -u -3 -p -r1.51 bgdialog.cpp
--- kcontrol/background/bgdialog.cpp	26 Nov 2004 20:25:38 -0000	1.51
+++ kcontrol/background/bgdialog.cpp	28 Nov 2004 18:55:44 -0000
@@ -923,6 +923,7 @@ void BGDialog::slotAdvanced()
     dlg.setTextBackgroundColor(m_pGlobals->textBackgroundColor());
     dlg.setShadowEnabled(m_pGlobals->shadowEnabled());
     dlg.setTextLines(m_pGlobals->textLines());
+    dlg.setTextWidth(m_pGlobals->textWidth());
 
     if (m_pGlobals->limitCache())
        dlg.setCacheSize( m_pGlobals->cacheSize() );
@@ -949,6 +950,7 @@ void BGDialog::slotAdvanced()
     m_pGlobals->setTextBackgroundColor(dlg.textBackgroundColor());
     m_pGlobals->setShadowEnabled(dlg.shadowEnabled());
     m_pGlobals->setTextLines(dlg.textLines());
+    m_pGlobals->setTextWidth(dlg.textWidth());
 
     r->stop();
     m_previewUpdates = true;
Index: kcontrol/background/bgsettings.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/background/bgsettings.cpp,v
retrieving revision 1.20
diff -u -3 -p -r1.20 bgsettings.cpp
--- kcontrol/background/bgsettings.cpp	26 Nov 2004 20:25:38 -0000	1.20
+++ kcontrol/background/bgsettings.cpp	28 Nov 2004 18:55:44 -0000
@@ -25,6 +25,7 @@
 #include <ksimpleconfig.h>
 #include <kstandarddirs.h>
 #include <krandomsequence.h>
+#include <konq_defaults.h>
 
 #include "bgdefaults.h"
 #include "bgsettings.h"
@@ -1149,6 +1150,14 @@ void KGlobalBackgroundSettings::setTextL
     m_textLines = lines;
 }
 
+void KGlobalBackgroundSettings::setTextWidth(int width)
+{
+    if (width == m_textWidth)
+        return;
+    dirty = true;
+    m_textWidth = width;
+}
+
 void KGlobalBackgroundSettings::readSettings()
 {
     m_pConfig->setGroup("Background Common");
@@ -1163,7 +1172,8 @@ void KGlobalBackgroundSettings::readSett
     m_TextColor = m_pConfig->readColorEntry("NormalTextColor", &m_TextColor);
     m_TextBackgroundColor = m_pConfig->readColorEntry("ItemTextBackground");
     m_shadowEnabled = m_pConfig->readBoolEntry("ShadowEnabled", true);
-    m_textLines = m_pConfig->readNumEntry("TextHeight", 2);
+    m_textLines = m_pConfig->readNumEntry("TextHeight", DEFAULT_TEXTHEIGHT);
+    m_textWidth = m_pConfig->readNumEntry("TextWidth", DEFAULT_TEXTWIDTH);
 
     m_Names.clear();
     NETRootInfo info( qt_xdisplay(), NET::DesktopNames | NET::NumberOfDesktops );
@@ -1190,6 +1200,7 @@ void KGlobalBackgroundSettings::writeSet
     m_pConfig->writeEntry("ItemTextBackground", m_TextBackgroundColor);
     m_pConfig->writeEntry("ShadowEnabled", m_shadowEnabled);
     m_pConfig->writeEntry("TextHeight", m_textLines);
+    m_pConfig->writeEntry("TextWidth", m_textWidth);
     m_pConfig->sync();
     dirty = false;
 
Index: kcontrol/background/bgsettings.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/background/bgsettings.h,v
retrieving revision 1.30
diff -u -3 -p -r1.30 bgsettings.h
--- kcontrol/background/bgsettings.h	26 Nov 2004 20:25:38 -0000	1.30
+++ kcontrol/background/bgsettings.h	28 Nov 2004 18:55:44 -0000
@@ -321,6 +321,8 @@ public:
 
     void setTextLines(int lines);
     int textLines() const { return m_textLines; }
+    void setTextWidth(int width);
+    int textWidth() const { return m_textWidth; }
 
     void readSettings();
     void writeSettings();
@@ -336,6 +338,7 @@ private:
     QColor m_TextBackgroundColor;
     bool m_shadowEnabled;
     int m_textLines;
+    int m_textWidth;
 
     KConfig *m_pConfig;
     bool m_bDeleteConfig;


[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic