summaryrefslogtreecommitdiffabout
path: root/microkde/kglobalsettings.cpp
blob: 3f8a6309fd78d34f7e5b2cd975f9212a9c6159f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include "kglobalsettings.h"
#include "kconfig.h"
#include "kglobal.h"
#include "kconfigbase.h"

#include <qapplication.h>

#ifdef DESKTOP_VERSION
  QColor KGlobalSettings::mAlternate = QColor( 235, 235, 235 );
#else
  QColor KGlobalSettings::mAlternate =  QColor( 210, 210, 210 );
#endif 


QFont KGlobalSettings::generalFont()
{
   int size = 12;
   if (QApplication::desktop()->width() < 480 ) {
        size = 10;   
   }
#ifndef DESKTOP_VERSION
   else
    if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
        size = 18;  
#endif 
    QFont f = QApplication::font();
    //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1());
    f.setPointSize( size );
    return f;
}
QFont KGlobalSettings::generalMaxFont()
{
   int size = 12;
   if (QApplication::desktop()->width() < 480 ) {
        size = 10;   
   }
#ifndef DESKTOP_VERSION
   else
    if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
        size = 18;  
#endif 
    QFont f = QApplication::font();
    if ( f.pointSize() > size )
        f.setPointSize( size );
    return f;
}

QString KGlobalSettings::timeTrackerDir()
{
    static QString dir;
    if ( dir.isEmpty() ) {
        dir = locateLocal( "data", "timetrackerdir/d.ttl" );
        dir = dir.left ( dir.length() - 5);
    }
    return dir;
}
QString KGlobalSettings::backupDataDir()
{
    static QString dir;
    if ( dir.isEmpty() ) {
        dir = locateLocal( "data", "backupdir/d.ttl" );
        dir = dir.left ( dir.length() - 5);
    }
    return dir;
}

QFont KGlobalSettings::toolBarFont()
{
    return  QApplication::font();
}

QColor KGlobalSettings::toolBarHighlightColor()
{
    return QColor( "black" );
}

QColor KGlobalSettings::alternateBackgroundColor()
{
    return mAlternate;

}
void  KGlobalSettings::setAlternateBackgroundColor(QColor c)
{
   mAlternate = c;

}

QRect KGlobalSettings::desktopGeometry( QWidget * )
{
  return QApplication::desktop()->rect();
}

    /**
     * Returns whether KDE runs in single (default) or double click
     * mode.
     * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html
     * @return true if single click mode, or false if double click mode.
     **/
bool KGlobalSettings::singleClick()
{   
    KConfig *c = KGlobal::config();
    KConfigGroupSaver cgs( c, "KDE" );
    return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK);
}