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