summaryrefslogtreecommitdiffstats
path: root/kmymoney2/kmymoneyglobalsettings.cpp
blob: 6989537fc4dbfe84f65d32b82656763a0452e287 (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
/***************************************************************************
                          kmymoneyglobalsettings.cpp
                             -------------------
    copyright            : (C) 2006 by Thomas Baumgart
    email                : ipwizard@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// ----------------------------------------------------------------------------
// TQt Includes

#include <tqregexp.h>

// ----------------------------------------------------------------------------
// TDE Includes

#include <tdeglobalsettings.h>

// ----------------------------------------------------------------------------
// Project Includes

#include <kmymoney/kmymoneyglobalsettings.h>

TQFont KMyMoneyGlobalSettings::listCellFont(void)
{
  if(useSystemFont()) {
    return TDEGlobalSettings::generalFont();
  } else {
    return KMyMoneySettings::listCellFont();
  }
}

TQFont KMyMoneyGlobalSettings::listHeaderFont(void)
{
  if(useSystemFont()) {
    TQFont font = TDEGlobalSettings::generalFont();
    font.setBold(true);
    return font;
  } else {
    return KMyMoneySettings::listHeaderFont();
  }
}

TQColor KMyMoneyGlobalSettings::listColor(void)
{
  if(useSystemColors())
    return TDEGlobalSettings::baseColor();
  else
    return KMyMoneySettings::listColor();
}

TQColor KMyMoneyGlobalSettings::listBGColor(void)
{
  if(useSystemColors())
    return TDEGlobalSettings::alternateBackgroundColor();
  else
    return KMyMoneySettings::listBGColor();
}

TQStringList KMyMoneyGlobalSettings::itemList(void)
{
  bool prevValue = self()->useDefaults(true);
  TQStringList all = TQStringList::split(",", KMyMoneySettings::itemList());
  self()->useDefaults(prevValue);
  TQStringList list = TQStringList::split(",", KMyMoneySettings::itemList());

  // now add all from 'all' that are missing in 'list'
  TQRegExp exp("-?(\\d+)");
  TQStringList::iterator it_s;
  for(it_s = all.begin(); it_s != all.end(); ++it_s) {
    exp.search(*it_s);
    if(!list.contains(exp.cap(1)) && !list.contains(TQString("-%1").arg(exp.cap(1)))) {
      list << *it_s;
    }
  }
  return list;
}

int KMyMoneyGlobalSettings::firstFiscalMonth(void)
{
  return KMyMoneySettings::fiscalYearBegin()+1;
}

int KMyMoneyGlobalSettings::firstFiscalDay(void)
{
  return KMyMoneySettings::fiscalYearBeginDay();
}