-rw-r--r-- | korganizer/kotodoviewitem.cpp | 2 | ||||
-rw-r--r-- | libkcal/todo.cpp | 16 | ||||
-rw-r--r-- | microkde/kglobalsettings.cpp | 10 | ||||
-rw-r--r-- | microkde/kglobalsettings.h | 1 |
4 files changed, 27 insertions, 2 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 66f8d06..8cb6b83 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -68,129 +68,129 @@ void KOTodoViewItem::setSortKey(int column,const QString &key) | |||
68 | #if QT_VERSION >= 0x030000 | 68 | #if QT_VERSION >= 0x030000 |
69 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 69 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
70 | int y,int h) | 70 | int y,int h) |
71 | { | 71 | { |
72 | QListViewItem::paintBranches(p,cg,w,y,h); | 72 | QListViewItem::paintBranches(p,cg,w,y,h); |
73 | } | 73 | } |
74 | #else | 74 | #else |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | void KOTodoViewItem::construct() | 77 | void KOTodoViewItem::construct() |
78 | { | 78 | { |
79 | // qDebug("KOTodoViewItem::construct() "); | 79 | // qDebug("KOTodoViewItem::construct() "); |
80 | m_init = true; | 80 | m_init = true; |
81 | QString keyd = "=="; | 81 | QString keyd = "=="; |
82 | QString keyt = "=="; | 82 | QString keyt = "=="; |
83 | QString skeyd = "=="; | 83 | QString skeyd = "=="; |
84 | QString skeyt = "=="; | 84 | QString skeyt = "=="; |
85 | 85 | ||
86 | setOn(mTodo->isCompleted()); | 86 | setOn(mTodo->isCompleted()); |
87 | setText(0,mTodo->summary()); | 87 | setText(0,mTodo->summary()); |
88 | setText(1,QString::number(mTodo->priority())); | 88 | setText(1,QString::number(mTodo->priority())); |
89 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 89 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
90 | if (mTodo->percentComplete()<100) { | 90 | if (mTodo->percentComplete()<100) { |
91 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 91 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
92 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 92 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
93 | } | 93 | } |
94 | else { | 94 | else { |
95 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 95 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
96 | else setSortKey(2,QString::number(99)); | 96 | else setSortKey(2,QString::number(99)); |
97 | } | 97 | } |
98 | if (mTodo->hasDueDate()) { | 98 | if (mTodo->hasDueDate()) { |
99 | setText(3, mTodo->dtDueDateStr()); | 99 | setText(3, mTodo->dtDueDateStr()); |
100 | QDate d = mTodo->dtDue().date(); | 100 | QDate d = mTodo->dtDue().date(); |
101 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 101 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
102 | // setSortKey(3,keyd); | 102 | // setSortKey(3,keyd); |
103 | if (mTodo->doesFloat()) { | 103 | if (mTodo->doesFloat()) { |
104 | setText(4,""); | 104 | setText(4,""); |
105 | } | 105 | } |
106 | else { | 106 | else { |
107 | setText(4,mTodo->dtDueTimeStr()); | 107 | setText(4,mTodo->dtDueTimeStr()); |
108 | QTime t = mTodo->dtDue().time(); | 108 | QTime t = mTodo->dtDue().time(); |
109 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 109 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
110 | //setSortKey(4,keyt); | 110 | //setSortKey(4,keyt); |
111 | } | 111 | } |
112 | } else { | 112 | } else { |
113 | setText(3,""); | 113 | setText(3,""); |
114 | setText(4,""); | 114 | setText(4,""); |
115 | } | 115 | } |
116 | setSortKey(3,keyd); | 116 | setSortKey(3,keyd); |
117 | setSortKey(4,keyt); | 117 | setSortKey(4,keyt); |
118 | 118 | ||
119 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); | 119 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); |
120 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 120 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | keyd = ""; | 124 | keyd = ""; |
125 | keyt = ""; | 125 | keyt = ""; |
126 | 126 | ||
127 | if (mTodo->isRunning() ) { | 127 | if (mTodo->isRunning() ) { |
128 | QDate d = mTodo->runStart().date(); | 128 | QDate d = mTodo->runStart().date(); |
129 | QTime t = mTodo->runStart().time(); | 129 | QTime t = mTodo->runStart().time(); |
130 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 130 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
131 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 131 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
132 | keyd = KGlobal::locale()->formatDate( d ); | 132 | keyd = KGlobal::locale()->formatDate( d , true); |
133 | keyt = KGlobal::locale()->formatTime( t ); | 133 | keyt = KGlobal::locale()->formatTime( t ); |
134 | 134 | ||
135 | } else { | 135 | } else { |
136 | 136 | ||
137 | if (mTodo->hasStartDate()) { | 137 | if (mTodo->hasStartDate()) { |
138 | keyd = mTodo->dtStartDateStr(); | 138 | keyd = mTodo->dtStartDateStr(); |
139 | QDate d = mTodo->dtStart().date(); | 139 | QDate d = mTodo->dtStart().date(); |
140 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 140 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
141 | 141 | ||
142 | if ( !mTodo->doesFloat()) { | 142 | if ( !mTodo->doesFloat()) { |
143 | keyt = mTodo->dtStartTimeStr(); | 143 | keyt = mTodo->dtStartTimeStr(); |
144 | QTime t = mTodo->dtStart().time(); | 144 | QTime t = mTodo->dtStart().time(); |
145 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 145 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | } | 149 | } |
150 | } | 150 | } |
151 | setText(5,keyd); | 151 | setText(5,keyd); |
152 | setText(6,keyt); | 152 | setText(6,keyt); |
153 | setSortKey(5,skeyd); | 153 | setSortKey(5,skeyd); |
154 | setSortKey(6,skeyt); | 154 | setSortKey(6,skeyt); |
155 | 155 | ||
156 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); | 156 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); |
157 | setText(8,mTodo->categoriesStr()); | 157 | setText(8,mTodo->categoriesStr()); |
158 | 158 | ||
159 | #if 0 | 159 | #if 0 |
160 | // Find sort id in description. It's the text behind the last '#' character | 160 | // Find sort id in description. It's the text behind the last '#' character |
161 | // found in the description. White spaces are removed from beginning and end | 161 | // found in the description. White spaces are removed from beginning and end |
162 | // of sort id. | 162 | // of sort id. |
163 | int pos = mTodo->description().findRev('#'); | 163 | int pos = mTodo->description().findRev('#'); |
164 | if (pos < 0) { | 164 | if (pos < 0) { |
165 | setText(6,""); | 165 | setText(6,""); |
166 | } else { | 166 | } else { |
167 | QString str = mTodo->description().mid(pos+1); | 167 | QString str = mTodo->description().mid(pos+1); |
168 | str.stripWhiteSpace(); | 168 | str.stripWhiteSpace(); |
169 | setText(6,str); | 169 | setText(6,str); |
170 | } | 170 | } |
171 | #endif | 171 | #endif |
172 | 172 | ||
173 | m_known = false; | 173 | m_known = false; |
174 | m_init = false; | 174 | m_init = false; |
175 | 175 | ||
176 | setMyPixmap(); | 176 | setMyPixmap(); |
177 | 177 | ||
178 | } | 178 | } |
179 | void KOTodoViewItem::setMyPixmap() | 179 | void KOTodoViewItem::setMyPixmap() |
180 | { | 180 | { |
181 | int size = 5; | 181 | int size = 5; |
182 | QPixmap pixi = QPixmap( 1, 1 ); | 182 | QPixmap pixi = QPixmap( 1, 1 ); |
183 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 183 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
184 | // pixi = SmallIcon("redcross16"); | 184 | // pixi = SmallIcon("redcross16"); |
185 | // } else { | 185 | // } else { |
186 | QPainter p; | 186 | QPainter p; |
187 | 187 | ||
188 | int pixSize = 0; | 188 | int pixSize = 0; |
189 | QPixmap pPix = QPixmap( size, size ); | 189 | QPixmap pPix = QPixmap( size, size ); |
190 | if ( mTodo->description().length() > 0 ) { | 190 | if ( mTodo->description().length() > 0 ) { |
191 | pixi.resize(size, pixSize+size); | 191 | pixi.resize(size, pixSize+size); |
192 | pPix.fill( Qt::darkGreen ); | 192 | pPix.fill( Qt::darkGreen ); |
193 | p.begin( &pixi ); | 193 | p.begin( &pixi ); |
194 | p. drawPixmap ( 0, pixSize, pPix); | 194 | p. drawPixmap ( 0, pixSize, pPix); |
195 | p.end(); | 195 | p.end(); |
196 | pixSize += size; | 196 | pixSize += size; |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7dee4cd..c008fe1 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -1,142 +1,156 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <kglobalsettings.h> | ||
22 | #include <klocale.h> | 23 | #include <klocale.h> |
23 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <qregexp.h> | ||
24 | 26 | ||
25 | #include "todo.h" | 27 | #include "todo.h" |
26 | 28 | ||
27 | using namespace KCal; | 29 | using namespace KCal; |
28 | 30 | ||
29 | Todo::Todo(): Incidence() | 31 | Todo::Todo(): Incidence() |
30 | { | 32 | { |
31 | // mStatus = TENTATIVE; | 33 | // mStatus = TENTATIVE; |
32 | 34 | ||
33 | mHasDueDate = false; | 35 | mHasDueDate = false; |
34 | setHasStartDate( false ); | 36 | setHasStartDate( false ); |
35 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 37 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
36 | mHasCompletedDate = false; | 38 | mHasCompletedDate = false; |
37 | mPercentComplete = 0; | 39 | mPercentComplete = 0; |
38 | mRunning = false; | 40 | mRunning = false; |
39 | mRunSaveTimer = 0; | 41 | mRunSaveTimer = 0; |
40 | } | 42 | } |
41 | 43 | ||
42 | Todo::Todo(const Todo &t) : Incidence(t) | 44 | Todo::Todo(const Todo &t) : Incidence(t) |
43 | { | 45 | { |
44 | mDtDue = t.mDtDue; | 46 | mDtDue = t.mDtDue; |
45 | mHasDueDate = t.mHasDueDate; | 47 | mHasDueDate = t.mHasDueDate; |
46 | mCompleted = t.mCompleted; | 48 | mCompleted = t.mCompleted; |
47 | mHasCompletedDate = t.mHasCompletedDate; | 49 | mHasCompletedDate = t.mHasCompletedDate; |
48 | mPercentComplete = t.mPercentComplete; | 50 | mPercentComplete = t.mPercentComplete; |
49 | mRunning = false; | 51 | mRunning = false; |
50 | mRunSaveTimer = 0; | 52 | mRunSaveTimer = 0; |
51 | } | 53 | } |
52 | 54 | ||
53 | Todo::~Todo() | 55 | Todo::~Todo() |
54 | { | 56 | { |
55 | setRunning( false ); | 57 | setRunning( false ); |
56 | } | 58 | } |
57 | 59 | ||
58 | void Todo::setRunning( bool run ) | 60 | void Todo::setRunning( bool run ) |
59 | { | 61 | { |
60 | if ( run == mRunning ) | 62 | if ( run == mRunning ) |
61 | return; | 63 | return; |
62 | if ( !mRunSaveTimer ) { | 64 | if ( !mRunSaveTimer ) { |
63 | mRunSaveTimer = new QTimer ( this ); | 65 | mRunSaveTimer = new QTimer ( this ); |
64 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); | 66 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); |
65 | } | 67 | } |
66 | mRunning = run; | 68 | mRunning = run; |
67 | if ( mRunning ) { | 69 | if ( mRunning ) { |
68 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min | 70 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min |
69 | mRunStart = QDateTime::currentDateTime(); | 71 | mRunStart = QDateTime::currentDateTime(); |
70 | } else { | 72 | } else { |
71 | mRunSaveTimer->stop(); | 73 | mRunSaveTimer->stop(); |
72 | saveRunningInfoToFile(); | 74 | saveRunningInfoToFile(); |
73 | } | 75 | } |
74 | } | 76 | } |
75 | 77 | ||
76 | void Todo::saveRunningInfoToFile() | 78 | void Todo::saveRunningInfoToFile() |
77 | { | 79 | { |
78 | qDebug("Todo::saveRunningInfoToFile() "); | 80 | qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
81 | |||
82 | QString dir = KGlobalSettings::timeTrackerDir(); | ||
83 | qDebug("%s ", dir.latin1()); | ||
84 | QString file = "%1-%2-%3-%4-%5-%6-%7.tt"; | ||
85 | |||
86 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ).arg( mRunStart.time().msec(), 3 ); | ||
87 | file.replace ( QRegExp (" "), "0" ); | ||
88 | file = dir +"/" +file; | ||
89 | qDebug("%s ", file.latin1()); | ||
90 | |||
91 | |||
92 | |||
79 | } | 93 | } |
80 | 94 | ||
81 | int Todo::runTime() | 95 | int Todo::runTime() |
82 | { | 96 | { |
83 | if ( !mRunning ) | 97 | if ( !mRunning ) |
84 | return 0; | 98 | return 0; |
85 | return mRunStart.secsTo( QDateTime::currentDateTime() ); | 99 | return mRunStart.secsTo( QDateTime::currentDateTime() ); |
86 | } | 100 | } |
87 | bool Todo::hasRunningSub() | 101 | bool Todo::hasRunningSub() |
88 | { | 102 | { |
89 | if ( mRunning ) | 103 | if ( mRunning ) |
90 | return true; | 104 | return true; |
91 | Incidence *aTodo; | 105 | Incidence *aTodo; |
92 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 106 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
93 | if ( ((Todo*)aTodo)->hasRunningSub() ) | 107 | if ( ((Todo*)aTodo)->hasRunningSub() ) |
94 | return true; | 108 | return true; |
95 | } | 109 | } |
96 | return false; | 110 | return false; |
97 | } | 111 | } |
98 | Incidence *Todo::clone() | 112 | Incidence *Todo::clone() |
99 | { | 113 | { |
100 | return new Todo(*this); | 114 | return new Todo(*this); |
101 | } | 115 | } |
102 | 116 | ||
103 | bool Todo::contains ( Todo* from ) | 117 | bool Todo::contains ( Todo* from ) |
104 | { | 118 | { |
105 | 119 | ||
106 | if ( !from->summary().isEmpty() ) | 120 | if ( !from->summary().isEmpty() ) |
107 | if ( !summary().startsWith( from->summary() )) | 121 | if ( !summary().startsWith( from->summary() )) |
108 | return false; | 122 | return false; |
109 | if ( from->hasStartDate() ) { | 123 | if ( from->hasStartDate() ) { |
110 | if ( !hasStartDate() ) | 124 | if ( !hasStartDate() ) |
111 | return false; | 125 | return false; |
112 | if ( from->dtStart() != dtStart()) | 126 | if ( from->dtStart() != dtStart()) |
113 | return false; | 127 | return false; |
114 | } | 128 | } |
115 | if ( from->hasDueDate() ){ | 129 | if ( from->hasDueDate() ){ |
116 | if ( !hasDueDate() ) | 130 | if ( !hasDueDate() ) |
117 | return false; | 131 | return false; |
118 | if ( from->dtDue() != dtDue()) | 132 | if ( from->dtDue() != dtDue()) |
119 | return false; | 133 | return false; |
120 | } | 134 | } |
121 | if ( !from->location().isEmpty() ) | 135 | if ( !from->location().isEmpty() ) |
122 | if ( !location().startsWith( from->location() ) ) | 136 | if ( !location().startsWith( from->location() ) ) |
123 | return false; | 137 | return false; |
124 | if ( !from->description().isEmpty() ) | 138 | if ( !from->description().isEmpty() ) |
125 | if ( !description().startsWith( from->description() )) | 139 | if ( !description().startsWith( from->description() )) |
126 | return false; | 140 | return false; |
127 | if ( from->alarms().count() ) { | 141 | if ( from->alarms().count() ) { |
128 | Alarm *a = from->alarms().first(); | 142 | Alarm *a = from->alarms().first(); |
129 | if ( a->enabled() ){ | 143 | if ( a->enabled() ){ |
130 | if ( !alarms().count() ) | 144 | if ( !alarms().count() ) |
131 | return false; | 145 | return false; |
132 | Alarm *b = alarms().first(); | 146 | Alarm *b = alarms().first(); |
133 | if( ! b->enabled() ) | 147 | if( ! b->enabled() ) |
134 | return false; | 148 | return false; |
135 | if ( ! (a->offset() == b->offset() )) | 149 | if ( ! (a->offset() == b->offset() )) |
136 | return false; | 150 | return false; |
137 | } | 151 | } |
138 | } | 152 | } |
139 | 153 | ||
140 | QStringList cat = categories(); | 154 | QStringList cat = categories(); |
141 | QStringList catFrom = from->categories(); | 155 | QStringList catFrom = from->categories(); |
142 | QString nCat; | 156 | QString nCat; |
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index b837b23..e54b0d9 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp | |||
@@ -1,66 +1,76 @@ | |||
1 | #include "kglobalsettings.h" | 1 | #include "kglobalsettings.h" |
2 | #include "kconfig.h" | 2 | #include "kconfig.h" |
3 | #include "kglobal.h" | 3 | #include "kglobal.h" |
4 | #include "kconfigbase.h" | 4 | #include "kconfigbase.h" |
5 | 5 | ||
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | QFont KGlobalSettings::generalFont() | 8 | QFont KGlobalSettings::generalFont() |
9 | { | 9 | { |
10 | int size = 12; | 10 | int size = 12; |
11 | if (QApplication::desktop()->width() < 480 ) { | 11 | if (QApplication::desktop()->width() < 480 ) { |
12 | size = 10; | 12 | size = 10; |
13 | } | 13 | } |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | else | 15 | else |
16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
17 | size = 18; | 17 | size = 18; |
18 | #endif | 18 | #endif |
19 | QFont f = QApplication::font(); | 19 | QFont f = QApplication::font(); |
20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); | 20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); |
21 | f.setPointSize( size ); | 21 | f.setPointSize( size ); |
22 | return f; | 22 | return f; |
23 | } | 23 | } |
24 | QFont KGlobalSettings::generalMaxFont() | 24 | QFont KGlobalSettings::generalMaxFont() |
25 | { | 25 | { |
26 | int size = 12; | 26 | int size = 12; |
27 | if (QApplication::desktop()->width() < 480 ) { | 27 | if (QApplication::desktop()->width() < 480 ) { |
28 | size = 10; | 28 | size = 10; |
29 | } | 29 | } |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | else | 31 | else |
32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
33 | size = 18; | 33 | size = 18; |
34 | #endif | 34 | #endif |
35 | QFont f = QApplication::font(); | 35 | QFont f = QApplication::font(); |
36 | if ( f.pointSize() > size ) | 36 | if ( f.pointSize() > size ) |
37 | f.setPointSize( size ); | 37 | f.setPointSize( size ); |
38 | return f; | 38 | return f; |
39 | } | 39 | } |
40 | |||
41 | QString KGlobalSettings::timeTrackerDir() | ||
42 | { | ||
43 | static QString dir; | ||
44 | if ( dir.isEmpty() ) { | ||
45 | dir = locateLocal( "data", "timetracker" ); | ||
46 | } | ||
47 | return dir; | ||
48 | } | ||
49 | |||
40 | QFont KGlobalSettings::toolBarFont() | 50 | QFont KGlobalSettings::toolBarFont() |
41 | { | 51 | { |
42 | return QApplication::font(); | 52 | return QApplication::font(); |
43 | } | 53 | } |
44 | 54 | ||
45 | QColor KGlobalSettings::toolBarHighlightColor() | 55 | QColor KGlobalSettings::toolBarHighlightColor() |
46 | { | 56 | { |
47 | return QColor( "black" ); | 57 | return QColor( "black" ); |
48 | } | 58 | } |
49 | 59 | ||
50 | QRect KGlobalSettings::desktopGeometry( QWidget * ) | 60 | QRect KGlobalSettings::desktopGeometry( QWidget * ) |
51 | { | 61 | { |
52 | return QApplication::desktop()->rect(); | 62 | return QApplication::desktop()->rect(); |
53 | } | 63 | } |
54 | 64 | ||
55 | /** | 65 | /** |
56 | * Returns whether KDE runs in single (default) or double click | 66 | * Returns whether KDE runs in single (default) or double click |
57 | * mode. | 67 | * mode. |
58 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html | 68 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html |
59 | * @return true if single click mode, or false if double click mode. | 69 | * @return true if single click mode, or false if double click mode. |
60 | **/ | 70 | **/ |
61 | bool KGlobalSettings::singleClick() | 71 | bool KGlobalSettings::singleClick() |
62 | { | 72 | { |
63 | KConfig *c = KGlobal::config(); | 73 | KConfig *c = KGlobal::config(); |
64 | KConfigGroupSaver cgs( c, "KDE" ); | 74 | KConfigGroupSaver cgs( c, "KDE" ); |
65 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); | 75 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); |
66 | } | 76 | } |
diff --git a/microkde/kglobalsettings.h b/microkde/kglobalsettings.h index 075bb1c..3eeda35 100644 --- a/microkde/kglobalsettings.h +++ b/microkde/kglobalsettings.h | |||
@@ -1,31 +1,32 @@ | |||
1 | #ifndef MICROKDE_KGLOBALSETTINGS_H | 1 | #ifndef MICROKDE_KGLOBALSETTINGS_H |
2 | #define MICROKDE_KGLOBALSETTINGS_H | 2 | #define MICROKDE_KGLOBALSETTINGS_H |
3 | 3 | ||
4 | #include <qfont.h> | 4 | #include <qfont.h> |
5 | #include <qrect.h> | 5 | #include <qrect.h> |
6 | 6 | ||
7 | 7 | ||
8 | #define KDE_DEFAULT_SINGLECLICK true | 8 | #define KDE_DEFAULT_SINGLECLICK true |
9 | 9 | ||
10 | 10 | ||
11 | class KGlobalSettings | 11 | class KGlobalSettings |
12 | { | 12 | { |
13 | public: | 13 | public: |
14 | static QFont generalFont(); | 14 | static QFont generalFont(); |
15 | static QFont generalMaxFont(); | 15 | static QFont generalMaxFont(); |
16 | static QFont toolBarFont(); | 16 | static QFont toolBarFont(); |
17 | 17 | ||
18 | static QColor toolBarHighlightColor(); | 18 | static QColor toolBarHighlightColor(); |
19 | static QRect desktopGeometry( QWidget * ); | 19 | static QRect desktopGeometry( QWidget * ); |
20 | static QString timeTrackerDir(); | ||
20 | 21 | ||
21 | /** | 22 | /** |
22 | * Returns whether KDE runs in single (default) or double click | 23 | * Returns whether KDE runs in single (default) or double click |
23 | * mode. | 24 | * mode. |
24 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html | 25 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html |
25 | * @return true if single click mode, or false if double click mode. | 26 | * @return true if single click mode, or false if double click mode. |
26 | **/ | 27 | **/ |
27 | static bool singleClick(); | 28 | static bool singleClick(); |
28 | 29 | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | #endif | 32 | #endif |