00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "config.h"
00019 #include "kglobalsettings.h"
00020
00021 #include <qdir.h>
00022 #include <qpixmap.h>
00023 #include <qfontdatabase.h>
00024 #include <qcursor.h>
00025
00026 #include <kconfig.h>
00027 #include <ksimpleconfig.h>
00028 #include <kapplication.h>
00029 #include <kstandarddirs.h>
00030 #include <kipc.h>
00031
00032 #ifdef Q_WS_WIN
00033 #include <windows.h>
00034 #include "qt_windows.h"
00035 static QRgb qt_colorref2qrgb(COLORREF col)
00036 {
00037 return qRgb(GetRValue(col),GetGValue(col),GetBValue(col));
00038 }
00039 #endif
00040
00041 #include <kdebug.h>
00042 #include <kglobal.h>
00043 #include <kshortcut.h>
00044 #include <kstandarddirs.h>
00045 #include <kcharsets.h>
00046 #include <kaccel.h>
00047 #include <klocale.h>
00048 #include <qfontinfo.h>
00049 #include <stdlib.h>
00050 #include <kprotocolinfo.h>
00051
00052 #ifdef Q_WS_X11
00053 #include <X11/Xlib.h>
00054 #endif
00055
00056 QString* KGlobalSettings::s_desktopPath = 0;
00057 QString* KGlobalSettings::s_autostartPath = 0;
00058 QString* KGlobalSettings::s_trashPath = 0;
00059 QString* KGlobalSettings::s_documentPath = 0;
00060 QFont *KGlobalSettings::_generalFont = 0;
00061 QFont *KGlobalSettings::_fixedFont = 0;
00062 QFont *KGlobalSettings::_toolBarFont = 0;
00063 QFont *KGlobalSettings::_menuFont = 0;
00064 QFont *KGlobalSettings::_windowTitleFont = 0;
00065 QFont *KGlobalSettings::_taskbarFont = 0;
00066 QFont *KGlobalSettings::_largeFont = 0;
00067 QColor *KGlobalSettings::_kde34Blue = 0;
00068 QColor *KGlobalSettings::_inactiveBackground = 0;
00069 QColor *KGlobalSettings::_inactiveForeground = 0;
00070 QColor *KGlobalSettings::_activeBackground = 0;
00071 QColor *KGlobalSettings::_buttonBackground = 0;
00072 QColor *KGlobalSettings::_selectBackground = 0;
00073 QColor *KGlobalSettings::_linkColor = 0;
00074 QColor *KGlobalSettings::_visitedLinkColor = 0;
00075 QColor *KGlobalSettings::alternateColor = 0;
00076
00077 KGlobalSettings::KMouseSettings *KGlobalSettings::s_mouseSettings = 0;
00078
00079 int KGlobalSettings::dndEventDelay()
00080 {
00081 KConfigGroup g( KGlobal::config(), "General" );
00082 return g.readNumEntry("StartDragDist", QApplication::startDragDistance());
00083 }
00084
00085 bool KGlobalSettings::singleClick()
00086 {
00087 KConfigGroup g( KGlobal::config(), "KDE" );
00088 return g.readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK);
00089 }
00090
00091 KGlobalSettings::TearOffHandle KGlobalSettings::insertTearOffHandle()
00092 {
00093 int tearoff;
00094 bool effectsenabled;
00095 KConfigGroup g( KGlobal::config(), "KDE" );
00096 effectsenabled = g.readBoolEntry( "EffectsEnabled", false);
00097 tearoff = g.readNumEntry("InsertTearOffHandle", KDE_DEFAULT_INSERTTEAROFFHANDLES);
00098 return effectsenabled ? (TearOffHandle) tearoff : Disable;
00099 }
00100
00101 bool KGlobalSettings::changeCursorOverIcon()
00102 {
00103 KConfigGroup g( KGlobal::config(), "KDE" );
00104 return g.readBoolEntry("ChangeCursor", KDE_DEFAULT_CHANGECURSOR);
00105 }
00106
00107 bool KGlobalSettings::visualActivate()
00108 {
00109 KConfigGroup g( KGlobal::config(), "KDE" );
00110 return g.readBoolEntry("VisualActivate", KDE_DEFAULT_VISUAL_ACTIVATE);
00111 }
00112
00113 unsigned int KGlobalSettings::visualActivateSpeed()
00114 {
00115 KConfigGroup g( KGlobal::config(), "KDE" );
00116 return
00117 g.readNumEntry(
00118 "VisualActivateSpeed",
00119 KDE_DEFAULT_VISUAL_ACTIVATE_SPEED
00120 );
00121 }
00122
00123
00124
00125 int KGlobalSettings::autoSelectDelay()
00126 {
00127 KConfigGroup g( KGlobal::config(), "KDE" );
00128 return g.readNumEntry("AutoSelectDelay", KDE_DEFAULT_AUTOSELECTDELAY);
00129 }
00130
00131 KGlobalSettings::Completion KGlobalSettings::completionMode()
00132 {
00133 int completion;
00134 KConfigGroup g( KGlobal::config(), "General" );
00135 completion = g.readNumEntry("completionMode", -1);
00136 if ((completion < (int) CompletionNone) ||
00137 (completion > (int) CompletionPopupAuto))
00138 {
00139 completion = (int) CompletionPopup;
00140 }
00141 return (Completion) completion;
00142 }
00143
00144 bool KGlobalSettings::showContextMenusOnPress ()
00145 {
00146 KConfigGroup g(KGlobal::config(), "ContextMenus");
00147 return g.readBoolEntry("ShowOnPress", true);
00148 }
00149
00150 int KGlobalSettings::contextMenuKey ()
00151 {
00152 KConfigGroup g(KGlobal::config(), "Shortcuts");
00153 KShortcut cut (g.readEntry ("PopupMenuContext", "Menu"));
00154 return cut.keyCodeQt();
00155 }
00156
00157 QColor KGlobalSettings::toolBarHighlightColor()
00158 {
00159 initColors();
00160 KConfigGroup g( KGlobal::config(), "Toolbar style" );
00161 return g.readColorEntry("HighlightColor", _kde34Blue);
00162 }
00163
00164 QColor KGlobalSettings::inactiveTitleColor()
00165 {
00166 #ifdef Q_WS_WIN
00167 return qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION));
00168 #else
00169 if (!_inactiveBackground)
00170 {
00171 if(KStandardDirs::isDiscovery())
00172 _inactiveBackground = new QColor(143,159,180);
00173 else
00174 _inactiveBackground = new QColor(157, 170, 186); }
00175 KConfigGroup g( KGlobal::config(), "WM" );
00176 return g.readColorEntry( "inactiveBackground", _inactiveBackground );
00177 #endif
00178 }
00179
00180 QColor KGlobalSettings::inactiveTextColor()
00181 {
00182 #ifdef Q_WS_WIN
00183 return qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT));
00184 #else
00185 if (!_inactiveForeground)
00186 _inactiveForeground = new QColor(221,221,221);
00187 KConfigGroup g( KGlobal::config(), "WM" );
00188 return g.readColorEntry( "inactiveForeground", _inactiveForeground );
00189 #endif
00190 }
00191
00192 QColor KGlobalSettings::activeTitleColor()
00193 {
00194 #ifdef Q_WS_WIN
00195 return qt_colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION));
00196 #else
00197 initColors();
00198 if (!_activeBackground)
00199 {
00200 if( KStandardDirs::isDiscovery())
00201 _activeBackground = new QColor(62,145,235);
00202 else
00203 _activeBackground = new QColor(237,237,237);
00204 }
00205 KConfigGroup g( KGlobal::config(), "WM" );
00206 return g.readColorEntry( "activeBackground", _activeBackground);
00207 #endif
00208 }
00209
00210 QColor KGlobalSettings::activeTextColor()
00211 {
00212 #ifdef Q_WS_WIN
00213 return qt_colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT));
00214 #else
00215 KConfigGroup g( KGlobal::config(), "WM" );
00216 return g.readColorEntry( "activeForeground", &Qt::white );
00217 #endif
00218 }
00219
00220 int KGlobalSettings::contrast()
00221 {
00222 KConfigGroup g( KGlobal::config(), "KDE" );
00223 return g.readNumEntry( "contrast", 7 );
00224 }
00225
00226 QColor KGlobalSettings::buttonBackground()
00227 {
00228 if (!_buttonBackground)
00229 _buttonBackground = new QColor(221,223,228);
00230 KConfigGroup g( KGlobal::config(), "General" );
00231 return g.readColorEntry( "buttonBackground", _buttonBackground );
00232 }
00233
00234 QColor KGlobalSettings::buttonTextColor()
00235 {
00236 KConfigGroup g( KGlobal::config(), "General" );
00237 return g.readColorEntry( "buttonForeground", &Qt::black );
00238 }
00239
00240
00241
00242
00243 QColor KGlobalSettings::baseColor()
00244 {
00245 KConfigGroup g( KGlobal::config(), "General" );
00246 return g.readColorEntry( "windowBackground", &Qt::white );
00247 }
00248
00249
00250
00251
00252 QColor KGlobalSettings::textColor()
00253 {
00254 KConfigGroup g( KGlobal::config(), "General" );
00255 return g.readColorEntry( "windowForeground", &Qt::black );
00256 }
00257
00258
00259
00260
00261 QColor KGlobalSettings::highlightedTextColor()
00262 {
00263 KConfigGroup g( KGlobal::config(), "General" );
00264 return g.readColorEntry( "selectForeground", &Qt::white );
00265 }
00266
00267
00268
00269
00270 QColor KGlobalSettings::highlightColor()
00271 {
00272 initColors();
00273 if (!_selectBackground)
00274 _selectBackground = new QColor(103,141,178);
00275 KConfigGroup g( KGlobal::config(), "General" );
00276 return g.readColorEntry( "selectBackground", _selectBackground );
00277 }
00278
00279 QColor KGlobalSettings::alternateBackgroundColor()
00280 {
00281 initColors();
00282 KConfigGroup g( KGlobal::config(), "General" );
00283 *alternateColor = calculateAlternateBackgroundColor( baseColor() );
00284 return g.readColorEntry( "alternateBackground", alternateColor );
00285 }
00286
00287 QColor KGlobalSettings::calculateAlternateBackgroundColor(const QColor& base)
00288 {
00289 if (base == Qt::white)
00290 return QColor(238,246,255);
00291 else
00292 {
00293 int h, s, v;
00294 base.hsv( &h, &s, &v );
00295 if (v > 128)
00296 return base.dark(106);
00297 else if (base != Qt::black)
00298 return base.light(110);
00299
00300 return QColor(32,32,32);
00301 }
00302 }
00303
00304 bool KGlobalSettings::shadeSortColumn()
00305 {
00306 KConfigGroup g( KGlobal::config(), "General" );
00307 return g.readBoolEntry( "shadeSortColumn", KDE_DEFAULT_SHADE_SORT_COLUMN );
00308 }
00309
00310 QColor KGlobalSettings::linkColor()
00311 {
00312 initColors();
00313 if (!_linkColor)
00314 _linkColor = new QColor(0,0,238);
00315 KConfigGroup g( KGlobal::config(), "General" );
00316 return g.readColorEntry( "linkColor", _linkColor );
00317 }
00318
00319 QColor KGlobalSettings::visitedLinkColor()
00320 {
00321 if (!_visitedLinkColor)
00322 _visitedLinkColor = new QColor(82,24,139);
00323 KConfigGroup g( KGlobal::config(), "General" );
00324 return g.readColorEntry( "visitedLinkColor", _visitedLinkColor );
00325 }
00326
00327 QFont KGlobalSettings::generalFont()
00328 {
00329 if (_generalFont)
00330 return *_generalFont;
00331
00332
00333 _generalFont = new QFont("Sans", 10);
00334 _generalFont->setPointSize(10);
00335 _generalFont->setStyleHint(QFont::SansSerif);
00336
00337 KConfigGroup g( KGlobal::config(), "General" );
00338 *_generalFont = g.readFontEntry("font", _generalFont);
00339
00340 return *_generalFont;
00341 }
00342
00343 QFont KGlobalSettings::fixedFont()
00344 {
00345 if (_fixedFont)
00346 return *_fixedFont;
00347
00348
00349 _fixedFont = new QFont("Monospace", 10);
00350 _fixedFont->setPointSize(10);
00351 _fixedFont->setStyleHint(QFont::TypeWriter);
00352
00353 KConfigGroup g( KGlobal::config(), "General" );
00354 *_fixedFont = g.readFontEntry("fixed", _fixedFont);
00355
00356 return *_fixedFont;
00357 }
00358
00359 QFont KGlobalSettings::toolBarFont()
00360 {
00361 if(_toolBarFont)
00362 return *_toolBarFont;
00363
00364
00365 _toolBarFont = new QFont("Sans", 10);
00366 _toolBarFont->setPointSize(10);
00367 _toolBarFont->setStyleHint(QFont::SansSerif);
00368
00369 KConfigGroup g( KGlobal::config(), "General" );
00370 *_toolBarFont = g.readFontEntry("toolBarFont", _toolBarFont);
00371
00372 return *_toolBarFont;
00373 }
00374
00375 QFont KGlobalSettings::menuFont()
00376 {
00377 if(_menuFont)
00378 return *_menuFont;
00379
00380
00381 _menuFont = new QFont("Sans", 10);
00382 _menuFont->setPointSize(10);
00383 _menuFont->setStyleHint(QFont::SansSerif);
00384
00385 KConfigGroup g( KGlobal::config(), "General" );
00386 *_menuFont = g.readFontEntry("menuFont", _menuFont);
00387
00388 return *_menuFont;
00389 }
00390
00391 QFont KGlobalSettings::windowTitleFont()
00392 {
00393 if(_windowTitleFont)
00394 return *_windowTitleFont;
00395
00396
00397 _windowTitleFont = new QFont("Sans", 10, QFont::Bold);
00398 _windowTitleFont->setPointSize(10);
00399 _windowTitleFont->setStyleHint(QFont::SansSerif);
00400
00401 KConfigGroup g( KGlobal::config(), "WM" );
00402 *_windowTitleFont = g.readFontEntry("activeFont", _windowTitleFont);
00403
00404 return *_windowTitleFont;
00405 }
00406
00407 QFont KGlobalSettings::taskbarFont()
00408 {
00409 if(_taskbarFont)
00410 return *_taskbarFont;
00411
00412
00413 _taskbarFont = new QFont("Sans", 11);
00414 _taskbarFont->setPointSize(11);
00415 _taskbarFont->setStyleHint(QFont::SansSerif);
00416
00417 KConfigGroup g( KGlobal::config(), "General" );
00418 *_taskbarFont = g.readFontEntry("taskbarFont", _taskbarFont);
00419
00420 return *_taskbarFont;
00421 }
00422
00423
00424 QFont KGlobalSettings::largeFont(const QString &text)
00425 {
00426 QFontDatabase db;
00427 QStringList fam = db.families();
00428
00429
00430 if (fam.remove("Arial"))
00431 fam.prepend("Arial");
00432 if (fam.remove("Verdana"))
00433 fam.prepend("Verdana");
00434 if (fam.remove("Tahoma"))
00435 fam.prepend("Tahoma");
00436 if (fam.remove("Lucida Sans"))
00437 fam.prepend("Lucida Sans");
00438 if (fam.remove("Lucidux Sans"))
00439 fam.prepend("Lucidux Sans");
00440 if (fam.remove("Nimbus Sans"))
00441 fam.prepend("Nimbus Sans");
00442 if (fam.remove("Gothic I"))
00443 fam.prepend("Gothic I");
00444
00445 if (_largeFont)
00446 fam.prepend(_largeFont->family());
00447
00448 for(QStringList::ConstIterator it = fam.begin();
00449 it != fam.end(); ++it)
00450 {
00451 if (db.isSmoothlyScalable(*it) && !db.isFixedPitch(*it))
00452 {
00453 QFont font(*it);
00454 font.setPixelSize(75);
00455 QFontMetrics metrics(font);
00456 int h = metrics.height();
00457 if ((h < 60) || ( h > 90))
00458 continue;
00459
00460 bool ok = true;
00461 for(unsigned int i = 0; i < text.length(); i++)
00462 {
00463 if (!metrics.inFont(text[i]))
00464 {
00465 ok = false;
00466 break;
00467 }
00468 }
00469 if (!ok)
00470 continue;
00471
00472 font.setPointSize(48);
00473 _largeFont = new QFont(font);
00474 return *_largeFont;
00475 }
00476 }
00477 _largeFont = new QFont(KGlobalSettings::generalFont());
00478 _largeFont->setPointSize(48);
00479 return *_largeFont;
00480 }
00481
00482 void KGlobalSettings::initStatic()
00483 {
00484 if ( s_desktopPath != 0 )
00485 return;
00486
00487 s_desktopPath = new QString();
00488 s_autostartPath = new QString();
00489 s_trashPath = new QString();
00490 s_documentPath = new QString();
00491
00492 KConfigGroup g( KGlobal::config(), "Paths" );
00493
00494
00495 *s_desktopPath = QDir::homeDirPath() + "/Desktop/";
00496 *s_desktopPath = g.readPathEntry( "Desktop", *s_desktopPath);
00497 *s_desktopPath = QDir::cleanDirPath( *s_desktopPath );
00498 if ( !s_desktopPath->endsWith("/") )
00499 s_desktopPath->append('/');
00500
00501
00502 *s_trashPath = *s_desktopPath + i18n("Trash") + "/";
00503 *s_trashPath = g.readPathEntry( "Trash" , *s_trashPath);
00504 *s_trashPath = QDir::cleanDirPath( *s_trashPath );
00505 if ( !s_trashPath->endsWith("/") )
00506 s_trashPath->append('/');
00507
00508 if ( !g.hasKey( "Trash" ) )
00509 {
00510 g.writePathEntry( "Trash", *s_trashPath, true, true );
00511 g.sync();
00512 }
00513
00514
00515 *s_autostartPath = KGlobal::dirs()->localkdedir() + "Autostart/";
00516 *s_autostartPath = g.readPathEntry( "Autostart" , *s_autostartPath);
00517 *s_autostartPath = QDir::cleanDirPath( *s_autostartPath );
00518 if ( !s_autostartPath->endsWith("/") )
00519 s_autostartPath->append('/');
00520
00521
00522 *s_documentPath = g.readPathEntry( "Documents", (QDir::homeDirPath()+"/Documents/") );
00523 *s_documentPath = QDir::cleanDirPath( *s_documentPath );
00524 if ( !s_documentPath->endsWith("/"))
00525 s_documentPath->append('/');
00526
00527
00528 if (kapp)
00529 kapp->addKipcEventMask(KIPC::SettingsChanged);
00530 }
00531
00532 void KGlobalSettings::initColors()
00533 {
00534 if (!_kde34Blue) {
00535 if (QPixmap::defaultDepth() > 8)
00536 _kde34Blue = new QColor(33,68,156);
00537 else
00538 _kde34Blue = new QColor(0, 0, 192);
00539 }
00540 if (!alternateColor)
00541 alternateColor = new QColor(237, 244, 249);
00542 }
00543
00544 void KGlobalSettings::rereadFontSettings()
00545 {
00546 delete _generalFont;
00547 _generalFont = 0L;
00548 delete _fixedFont;
00549 _fixedFont = 0L;
00550 delete _menuFont;
00551 _menuFont = 0L;
00552 delete _toolBarFont;
00553 _toolBarFont = 0L;
00554 delete _windowTitleFont;
00555 _windowTitleFont = 0L;
00556 delete _taskbarFont;
00557 _taskbarFont = 0L;
00558 }
00559
00560 void KGlobalSettings::rereadPathSettings()
00561 {
00562 kdDebug() << "KGlobalSettings::rereadPathSettings" << endl;
00563 delete s_autostartPath;
00564 s_autostartPath = 0L;
00565 delete s_trashPath;
00566 s_trashPath = 0L;
00567 delete s_desktopPath;
00568 s_desktopPath = 0L;
00569 delete s_documentPath;
00570 s_documentPath = 0L;
00571 }
00572
00573 KGlobalSettings::KMouseSettings & KGlobalSettings::mouseSettings()
00574 {
00575 if ( ! s_mouseSettings )
00576 {
00577 s_mouseSettings = new KMouseSettings;
00578 KMouseSettings & s = *s_mouseSettings;
00579
00580 #ifndef Q_WS_WIN
00581 KConfigGroup g( KGlobal::config(), "Mouse" );
00582 QString setting = g.readEntry("MouseButtonMapping");
00583 if (setting == "RightHanded")
00584 s.handed = KMouseSettings::RightHanded;
00585 else if (setting == "LeftHanded")
00586 s.handed = KMouseSettings::LeftHanded;
00587 else
00588 {
00589 #ifdef Q_WS_X11
00590
00591
00592
00593 s.handed = KMouseSettings::RightHanded;
00594 unsigned char map[20];
00595 int num_buttons = XGetPointerMapping(kapp->getDisplay(), map, 20);
00596 if( num_buttons == 2 )
00597 {
00598 if ( (int)map[0] == 1 && (int)map[1] == 2 )
00599 s.handed = KMouseSettings::RightHanded;
00600 else if ( (int)map[0] == 2 && (int)map[1] == 1 )
00601 s.handed = KMouseSettings::LeftHanded;
00602 }
00603 else if( num_buttons >= 3 )
00604 {
00605 if ( (int)map[0] == 1 && (int)map[2] == 3 )
00606 s.handed = KMouseSettings::RightHanded;
00607 else if ( (int)map[0] == 3 && (int)map[2] == 1 )
00608 s.handed = KMouseSettings::LeftHanded;
00609 }
00610 #else
00611
00612 #endif
00613 }
00614 #endif //Q_WS_WIN
00615 }
00616 #ifdef Q_WS_WIN
00617
00618 s_mouseSettings->handed = (GetSystemMetrics(SM_SWAPBUTTON) ? KMouseSettings::LeftHanded : KMouseSettings::RightHanded);
00619 #endif
00620 return *s_mouseSettings;
00621 }
00622
00623 void KGlobalSettings::rereadMouseSettings()
00624 {
00625 #ifndef Q_WS_WIN
00626 delete s_mouseSettings;
00627 s_mouseSettings = 0L;
00628 #endif
00629 }
00630
00631 bool KGlobalSettings::isMultiHead()
00632 {
00633 #ifdef Q_WS_WIN
00634 return GetSystemMetrics(SM_CMONITORS) > 1;
00635 #else
00636 QCString multiHead = getenv("KDE_MULTIHEAD");
00637 if (!multiHead.isEmpty()) {
00638 return (multiHead.lower() == "true");
00639 }
00640 return false;
00641 #endif
00642 }
00643
00644 bool KGlobalSettings::wheelMouseZooms()
00645 {
00646 KConfigGroup g( KGlobal::config(), "KDE" );
00647 return g.readBoolEntry( "WheelMouseZooms", KDE_DEFAULT_WHEEL_ZOOM );
00648 }
00649
00650 QRect KGlobalSettings::splashScreenDesktopGeometry()
00651 {
00652 QDesktopWidget *dw = QApplication::desktop();
00653
00654 if (dw->isVirtualDesktop()) {
00655 KConfigGroup group(KGlobal::config(), "Windows");
00656 int scr = group.readNumEntry("Unmanaged", -3);
00657 if (group.readBoolEntry("XineramaEnabled", true) && scr != -2) {
00658 if (scr == -3)
00659 scr = dw->screenNumber(QCursor::pos());
00660 return dw->screenGeometry(scr);
00661 } else {
00662 return dw->geometry();
00663 }
00664 } else {
00665 return dw->geometry();
00666 }
00667 }
00668
00669 QRect KGlobalSettings::desktopGeometry(const QPoint& point)
00670 {
00671 QDesktopWidget *dw = QApplication::desktop();
00672
00673 if (dw->isVirtualDesktop()) {
00674 KConfigGroup group(KGlobal::config(), "Windows");
00675 if (group.readBoolEntry("XineramaEnabled", true) &&
00676 group.readBoolEntry("XineramaPlacementEnabled", true)) {
00677 return dw->screenGeometry(dw->screenNumber(point));
00678 } else {
00679 return dw->geometry();
00680 }
00681 } else {
00682 return dw->geometry();
00683 }
00684 }
00685
00686 QRect KGlobalSettings::desktopGeometry(QWidget* w)
00687 {
00688 QDesktopWidget *dw = QApplication::desktop();
00689
00690 if (dw->isVirtualDesktop()) {
00691 KConfigGroup group(KGlobal::config(), "Windows");
00692 if (group.readBoolEntry("XineramaEnabled", true) &&
00693 group.readBoolEntry("XineramaPlacementEnabled", true)) {
00694 if (w)
00695 return dw->screenGeometry(dw->screenNumber(w));
00696 else return dw->screenGeometry(-1);
00697 } else {
00698 return dw->geometry();
00699 }
00700 } else {
00701 return dw->geometry();
00702 }
00703 }
00704
00705 bool KGlobalSettings::showIconsOnPushButtons()
00706 {
00707 KConfigGroup g( KGlobal::config(), "KDE" );
00708 return g.readBoolEntry("ShowIconsOnPushButtons",
00709 KDE_DEFAULT_ICON_ON_PUSHBUTTON);
00710 }
00711
00712 bool KGlobalSettings::showFilePreview(const KURL &url)
00713 {
00714 KConfigGroup g(KGlobal::config(), "PreviewSettings");
00715 QString protocol = url.protocol();
00716 bool defaultSetting = KProtocolInfo::showFilePreview( protocol );
00717 return g.readBoolEntry(protocol, defaultSetting );
00718 }
00719
00720 bool KGlobalSettings::opaqueResize()
00721 {
00722 KConfigGroup g( KGlobal::config(), "KDE" );
00723 return g.readBoolEntry("OpaqueResize",
00724 KDE_DEFAULT_OPAQUE_RESIZE);
00725 }
00726
00727 int KGlobalSettings::buttonLayout()
00728 {
00729 KConfigGroup g( KGlobal::config(), "KDE" );
00730 return g.readNumEntry("ButtonLayout",
00731 KDE_DEFAULT_BUTTON_LAYOUT);
00732 }