# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KGlobalSettings Class Reference

Access the KDE global configuration. More...

`#include <kglobalsettings.h>`

Collaboration diagram for KGlobalSettings:

[legend]
List of all members.

## Public Types

enum | TearOffHandle { Disable = 0, ApplicationLevel, Enable }
enum | Completion { CompletionNone = 1, CompletionAuto, CompletionMan, CompletionShell, CompletionPopup, CompletionPopupAuto }

## Static Public Member Functions

static int | dndEventDelay ()
static bool | singleClick ()
static TearOffHandle | insertTearOffHandle ()
static bool | changeCursorOverIcon ()
static bool | visualActivate ()
static unsigned int | visualActivateSpeed ()
static int | autoSelectDelay ()
static int | contextMenuKey ()
static bool | showContextMenusOnPress ()
static Completion | completionMode ()
static KMouseSettings & | mouseSettings ()
static QString | desktopPath ()
static QString | autostartPath ()
static QString | trashPath ()
static QString | documentPath ()
static QColor | toolBarHighlightColor ()
static QColor | inactiveTitleColor ()
static QColor | inactiveTextColor ()
static QColor | activeTitleColor ()
static QColor | activeTextColor ()
static int | contrast ()
static QColor | buttonBackground ()
static QColor | buttonTextColor ()
static QColor | baseColor ()
static QColor | textColor ()
static QColor | linkColor ()
static QColor | visitedLinkColor ()
static QColor | highlightedTextColor ()
static QColor | highlightColor ()
static QColor | alternateBackgroundColor ()
static QColor | calculateAlternateBackgroundColor (const QColor &base)
static bool | shadeSortColumn ()
static QFont | generalFont ()
static QFont | fixedFont ()
static QFont | toolBarFont ()
static QFont | menuFont ()
static QFont | windowTitleFont ()
static QFont | taskbarFont ()
static QFont | largeFont (const QString &text=QString::null)
static bool | isMultiHead ()
static bool | wheelMouseZooms ()
static QRect | splashScreenDesktopGeometry ()
static QRect | desktopGeometry (const QPoint &point)
static QRect | desktopGeometry (QWidget *w)
static bool | showIconsOnPushButtons ()
static bool | showFilePreview (const KURL &)
static bool | opaqueResize ()
static int | buttonLayout ()

## Friends

class | KApplication

## Classes

struct | KMouseSettings
| Describes the mouse settings. More...

## Detailed Description

Access the KDE global configuration.

Author:
  David Faure <faure@kde.org>

Definition at line 46 of file kglobalsettings.h.

## Member Enumeration Documentation

enum KGlobalSettings::TearOffHandle

This enum describes the return type for insertTearOffHandle() whether to insert a handle or not.

Applications who independently want to use handles in their popup menus should test for Application level before calling the appropriate function in KPopupMenu.

Since:
  3,1

Enumeration values:

  Disable | disable tear-off handles
  ApplicationLevel | enable on application level
  Enable | enable tear-off handles

Definition at line 109 of file kglobalsettings.h.

enum KGlobalSettings::Completion

This enum describes the completion mode used for by the KCompletion class.

See the styleguide.

Enumeration values:

  CompletionNone | No completion is used.
  CompletionAuto | Text is automatically filled in whenever possible.
  CompletionMan | Same as automatic except shortest match is used for completion.
  CompletionShell | Complete text much in the same way as a typical *nix shell would.
  CompletionPopup | Lists all possible matches in a popup list-box to choose from.
  CompletionPopupAuto | Lists all possible matches in a popup list-box to choose from, and automatically fill the result whenever possible.

Definition at line 170 of file kglobalsettings.h.

## Member Function Documentation

int KGlobalSettings::dndEventDelay | ( |  | ) | `[static]`

Returns a threshold in pixels for drag & drop operations.

As long as the mouse movement has not exceeded this number of pixels in either X or Y direction no drag operation may be started. This prevents spurious drags when the user intended to click on something but moved the mouse a bit while doing so.

For this to work you must save the position of the mouse (oldPos) in the QWidget::mousePressEvent(). When the position of the mouse (newPos) in a QWidget::mouseMoveEvent() exceeds this threshold you may start a drag which should originate from oldPos.

Example code:

     void KColorCells::mousePressEvent( QMouseEvent *e )
     {
        mOldPos = e->pos();
     }

     void KColorCells::mouseMoveEvent( QMouseEvent *e )
     {
        if( !(e->state() && LeftButton)) return;

        int delay = KGlobalSettings::dndEventDelay();
        QPoint newPos = e->pos();
        if(newPos.x() > mOldPos.x()+delay || newPos.x() < mOldPos.x()-delay ||
           newPos.y() > mOldPos.y()+delay || newPos.y() < mOldPos.y()-delay)
        {
           // Drag color object
           int cell = posToCell(mOldPos); // Find color at mOldPos
           if ((cell != -1) && colors[cell].isValid())
           {
              KColorDrag *d = KColorDrag::makeDrag( colors[cell], this);
              d->dragCopy();
           }
        }
     }

Returns:
  the threshold for drag & drop in pixels

Definition at line 79 of file kglobalsettings.cpp.

References KConfigBase::readNumEntry().

bool KGlobalSettings::singleClick | ( |  | ) | `[static]`

Returns whether KDE runs in single (default) or double click mode.

see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html

Returns:
  true if single click mode, or false if double click mode.

Definition at line 85 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

KGlobalSettings::TearOffHandle KGlobalSettings::insertTearOffHandle | ( |  | ) | `[static]`

Returns whether tear-off handles are inserted in KPopupMenus.

Returns:
  whether tear-off handles are inserted in KPopupMenus.

Since:
  3.1

Definition at line 91 of file kglobalsettings.cpp.

References Disable, KConfigBase::readBoolEntry(), and KConfigBase::readNumEntry().

bool KGlobalSettings::changeCursorOverIcon | ( |  | ) | `[static]`

Checks whether the cursor changes over icons.

Returns:
  the KDE setting for "change cursor over icon"

Definition at line 101 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

bool KGlobalSettings::visualActivate | ( |  | ) | `[static]`

Checks whether to show feedback when in item (specifically an icon) is activated.

Returns:
  whether to show some feedback when an item is activated.

Definition at line 107 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

unsigned int KGlobalSettings::visualActivateSpeed | ( |  | ) | `[static]`

Returns the speed of the visual activation feedback.

Returns:
  the speed of the visual activation feedback, between 0 for minimum and 100 for maximum speed

Definition at line 113 of file kglobalsettings.cpp.

References KConfigBase::readNumEntry().

Referenced by KIconEffect::visualActivate().

int KGlobalSettings::autoSelectDelay | ( |  | ) | `[static]`

Returns the KDE setting for the auto-select option.

Returns:
  the auto-select delay or -1 if auto-select is disabled.

Definition at line 125 of file kglobalsettings.cpp.

References KConfigBase::readNumEntry().

int KGlobalSettings::contextMenuKey | ( |  | ) | `[static]`

Returns the KDE setting for the shortcut key to open context menus.

Returns:
  the key that pops up context menus.

Definition at line 150 of file kglobalsettings.cpp.

References KConfigBase::readEntry().

bool KGlobalSettings::showContextMenusOnPress | ( |  | ) | `[static]`

Returns the KDE setting for context menus.

Returns:
  whether context menus should be shown on button press or button release (click).

Definition at line 144 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

KGlobalSettings::Completion KGlobalSettings::completionMode | ( |  | ) | `[static]`

Returns the preferred completion mode setting.

Returns:
  Completion. Default is `CompletionPopup`.

Definition at line 131 of file kglobalsettings.cpp.

References CompletionNone, CompletionPopup, CompletionPopupAuto, and KConfigBase::readNumEntry().

Referenced by KCompletion::KCompletion(), and KCompletionBase::KCompletionBase().

KGlobalSettings::KMouseSettings & KGlobalSettings::mouseSettings | ( |  | ) | `[static]`

This returns the current mouse settings.

On Windows, settings are retrieved from the system.

Returns:
  the current mouse settings

Definition at line 564 of file kglobalsettings.cpp.

References KGlobalSettings::KMouseSettings::handed, and KConfigBase::readEntry().

static QString KGlobalSettings::desktopPath | ( |  | ) | `[inline, static]`

The path to the desktop directory of the current user.

Returns:
  the user's desktop directory

Definition at line 225 of file kglobalsettings.h.

static QString KGlobalSettings::autostartPath | ( |  | ) | `[inline, static]`

The path to the autostart directory of the current user.

Returns:
  the path of the autostart directory

Definition at line 231 of file kglobalsettings.h.

static QString KGlobalSettings::trashPath | ( |  | ) | `[inline, static]`

| DEPRECATED (starting from kde-3.4). This isn't where the trash contents is, anymore. Use KIO::trash() to trash files, "trash:/" to list the trash contents. Definition at line 238 of file kglobalsettings.h.

static QString KGlobalSettings::documentPath | ( |  | ) | `[inline, static]`

The path where documents are stored of the current user.

Returns:
  the path of the document directory

Definition at line 246 of file kglobalsettings.h.

QColor KGlobalSettings::toolBarHighlightColor | ( |  | ) | `[static]`

The default color to use when highlighting toolbar buttons.

Returns:
  the toolbar highlight color

Definition at line 157 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::inactiveTitleColor | ( |  | ) | `[static]`

The default color to use for inactive titles.

Returns:
  the inactive title color

Definition at line 164 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::inactiveTextColor | ( |  | ) | `[static]`

The default color to use for inactive texts.

Returns:
  the inactive text color

Definition at line 176 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::activeTitleColor | ( |  | ) | `[static]`

The default color to use for active titles.

Returns:
  the active title color

Definition at line 188 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::activeTextColor | ( |  | ) | `[static]`

The default color to use for active texts.

Returns:
  the active text color

Definition at line 201 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

int KGlobalSettings::contrast | ( |  | ) | `[static]`

Returns the contrast for borders.

Returns:
  the contrast (between 0 for minimum and 10 for maximum contrast)

Definition at line 211 of file kglobalsettings.cpp.

References KConfigBase::readNumEntry().

QColor KGlobalSettings::buttonBackground | ( |  | ) | `[static]`

Returns the button background color.

Returns:
  the button background color

Since:
  3.4

Definition at line 217 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::buttonTextColor | ( |  | ) | `[static]`

Returns the button text color.

Returns:
  the button text color

Since:
  3.4

Definition at line 225 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::baseColor | ( |  | ) | `[static]`

Returns the default base (background) color.

Returns:
  the default base (background) color

See also:
  QColorGroup::base()

Definition at line 234 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

Referenced by alternateBackgroundColor().

QColor KGlobalSettings::textColor | ( |  | ) | `[static]`

Returns the default text color.

Returns:
  the default text color

See also:
  QColorGroup::text()

Definition at line 243 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::linkColor | ( |  | ) | `[static]`

Returns the default link color.

Returns:
  the default link color

Definition at line 301 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::visitedLinkColor | ( |  | ) | `[static]`

Returns the default color for visited links.

Returns:
  the default color for visited links

Definition at line 310 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::highlightedTextColor | ( |  | ) | `[static]`

Returns the default color for highlighted text.

Returns:
  the default color for highlighted text

See also:
  QColorGroup::hightlightedText()

Definition at line 252 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::highlightColor | ( |  | ) | `[static]`

Returns the default color for text highlights.

Returns:
  the default color for text highlights

See also:
  QColorGroup::hightlight()

Definition at line 261 of file kglobalsettings.cpp.

References KConfigBase::readColorEntry().

QColor KGlobalSettings::alternateBackgroundColor | ( |  | ) | `[static]`

Returns the alternate background color used by KListView with KListViewItem.

Any other list that uses alternating background colors should use this too, to obey to the user's preferences. Returns an invalid color if the user doesn't want alternating backgrounds.

Returns:
  the alternate background color

See also:
  calculateAlternateBackgroundColor

Definition at line 270 of file kglobalsettings.cpp.

References baseColor(), calculateAlternateBackgroundColor(), and KConfigBase::readColorEntry().

QColor KGlobalSettings::calculateAlternateBackgroundColor | ( | const QColor & | base | ) | `[static]`

Calculates a color based on `base` to be used as alternating color for e.g.

listviews.

Parameters:

  | base | the base for the calculation

Returns:
  the calculated color

See also:
  alternateBackgroundColor

Definition at line 278 of file kglobalsettings.cpp.

References QColor::dark(), and QColor::light().

Referenced by alternateBackgroundColor().

bool KGlobalSettings::shadeSortColumn | ( |  | ) | `[static]`

Returns if the sorted column in a KListView shall be drawn with a shaded background color.

Returns:
  true if the sorted column shall be shaded

Since:
  3.4

Definition at line 295 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

QFont KGlobalSettings::generalFont | ( |  | ) | `[static]`

Returns the default general font.

Returns:
  the default general font.

Definition at line 318 of file kglobalsettings.cpp.

References KConfigBase::readFontEntry(), QFont::setPointSize(), and QFont::setStyleHint().

Referenced by largeFont().

QFont KGlobalSettings::fixedFont | ( |  | ) | `[static]`

Returns the default fixed font.

Returns:
  the default fixed font.

Definition at line 334 of file kglobalsettings.cpp.

References KConfigBase::readFontEntry(), QFont::setPointSize(), and QFont::setStyleHint().

QFont KGlobalSettings::toolBarFont | ( |  | ) | `[static]`

Returns the default toolbar font.

Returns:
  the default toolbar font.

Definition at line 350 of file kglobalsettings.cpp.

References KConfigBase::readFontEntry(), QFont::setPointSize(), and QFont::setStyleHint().

QFont KGlobalSettings::menuFont | ( |  | ) | `[static]`

Returns the default menu font.

Returns:
  the default menu font.

Definition at line 366 of file kglobalsettings.cpp.

References KConfigBase::readFontEntry(), QFont::setPointSize(), and QFont::setStyleHint().

QFont KGlobalSettings::windowTitleFont | ( |  | ) | `[static]`

Returns the default window title font.

Returns:
  the default window title font.

Definition at line 382 of file kglobalsettings.cpp.

References KConfigBase::readFontEntry(), QFont::setPointSize(), and QFont::setStyleHint().

QFont KGlobalSettings::taskbarFont | ( |  | ) | `[static]`

Returns the default taskbar font.

Returns:
  the default taskbar font.

Definition at line 398 of file kglobalsettings.cpp.

References KConfigBase::readFontEntry(), QFont::setPointSize(), and QFont::setStyleHint().

QFont KGlobalSettings::largeFont | ( | const QString & | text = `QString::null` | ) | `[static]`

Returns a font of approx.

48 pt. capable of showing `text`.

Parameters:

  | text | the text to test

Returns:
  the font that is capable to show the text with 48 pt

Since:
  3.1

Definition at line 415 of file kglobalsettings.cpp.

References QFontDatabase::families(), QFont::family(), generalFont(), QFontMetrics::height(), QFontMetrics::inFont(), QFontDatabase::isFixedPitch(), QFontDatabase::isSmoothlyScalable(), QFont::setPixelSize(), and QFont::setPointSize().

bool KGlobalSettings::isMultiHead | ( |  | ) | `[static]`

Returns if the user specified multihead.

In case the display has multiple screens, the return value of this function specifies if the user wants KDE to run on all of them or just on the primary On Windows, settings are retrieved from the system.

Returns:
  true if the user chose multi head

Definition at line 622 of file kglobalsettings.cpp.

References QCString::isEmpty(), and QCString::lower().

bool KGlobalSettings::wheelMouseZooms | ( |  | ) | `[static]`

Typically, QScrollView derived classes can be scrolled fast by holding down the Ctrl-button during wheel-scrolling.

But QTextEdit and derived classes perform zooming instead of fast scrolling.

This value determines whether the user wants to zoom or scroll fast with Ctrl-wheelscroll.

Returns:
  true if the user wishes to zoom with the mouse wheel, false for scrolling

Since:
  3.1

Definition at line 635 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

QRect KGlobalSettings::splashScreenDesktopGeometry | ( |  | ) | `[static]`

This function returns the desktop geometry for an application's splash screen.

It takes into account the user's display settings (number of screens, Xinerama, etc), and the user's preferences (if KDE should be Xinerama aware).

Returns:
  the geometry to use for the desktop. Note that it might not start at (0,0).

Since:
  3.2

Definition at line 641 of file kglobalsettings.cpp.

References QApplication::desktop(), QDesktopWidget::isVirtualDesktop(), KConfigBase::readBoolEntry(), KConfigBase::readNumEntry(), QDesktopWidget::screenGeometry(), and QDesktopWidget::screenNumber().

QRect KGlobalSettings::desktopGeometry | ( | const QPoint & | point | ) | `[static]`

This function returns the desktop geometry for an application that needs to set the geometry of a widget on the screen manually.

It takes into account the user's display settings (number of screens, Xinerama, etc), and the user's preferences (if KDE should be Xinerama aware).

Note that this can break in multi-head (not Xinerama) mode because this point could be on multiple screens. Use with care.

Parameters:

  | point | a reference point for the widget, for instance one that the widget should be adjacent or on top of.

Returns:
  the geometry to use for the desktop. Note that it might not start at (0,0).

Since:
  3.2

Definition at line 660 of file kglobalsettings.cpp.

References QApplication::desktop(), QDesktopWidget::isVirtualDesktop(), KConfigBase::readBoolEntry(), QDesktopWidget::screenGeometry(), and QDesktopWidget::screenNumber().

QRect KGlobalSettings::desktopGeometry | ( | QWidget * | w | ) | `[static]`

This function returns the desktop geometry for an application that needs to set the geometry of a widget on the screen manually.

It takes into account the user's display settings (number of screens, Xinerama, etc), and the user's preferences (if KDE should be Xinerama aware).

Parameters:

  | w | the widget in question. This is used to determine which screen to use in Xinerama or multi-head mode.

Returns:
  the geometry to use for the desktop. Note that it might not start at (0,0).

Since:
  3.2

Definition at line 677 of file kglobalsettings.cpp.

References QApplication::desktop(), QDesktopWidget::isVirtualDesktop(), KConfigBase::readBoolEntry(), QDesktopWidget::screenGeometry(), and QDesktopWidget::screenNumber().

bool KGlobalSettings::showIconsOnPushButtons | ( |  | ) | `[static]`

This function determines if the user wishes to see icons on the push buttons.

Returns:
  Returns true if user wants to show icons.

Since:
  3.2

Definition at line 696 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

bool KGlobalSettings::showFilePreview | ( | const KURL & |  | ) | `[static]`

This function determines if the user wishes to see previews for the selected url.

Returns:
  Returns true if user wants to show previews.

Since:
  3.2

Definition at line 703 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry(), and KProtocolInfo::showFilePreview().

bool KGlobalSettings::opaqueResize | ( |  | ) | `[static]`

Whether the user wishes to use opaque resizing.

Primarily intended for QSplitter::setOpaqueResize()

Returns:
  Returns true if user wants to use opaque resizing.

Since:
  3.2

Definition at line 711 of file kglobalsettings.cpp.

References KConfigBase::readBoolEntry().

int KGlobalSettings::buttonLayout | ( |  | ) | `[static]`

The layout scheme to use for dialog buttons.

Returns:
  Returns the number of the scheme to use.

See also:
  KDialogBase::setButtonStyle

Since:
  3.3

Definition at line 718 of file kglobalsettings.cpp.

References KConfigBase::readNumEntry().

The documentation for this class was generated from the following files:

- kglobalsettings.h
- kglobalsettings.cpp

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:40 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003