author | zautrix <zautrix> | 2005-04-17 14:27:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 14:27:55 (UTC) |
commit | b411ec2d8961d07c3e2e9aefc9e04322b7851859 (patch) (unidiff) | |
tree | 79e2a70f1ad32562456b0bfa03aa2b916095fbb0 /korganizer/koglobals.cpp | |
parent | 2d81c75c4ffb8f144ae58e90e68496500d07a19e (diff) | |
download | kdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.zip kdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.tar.gz kdepimpi-b411ec2d8961d07c3e2e9aefc9e04322b7851859.tar.bz2 |
qdebugcleanup
-rw-r--r-- | korganizer/koglobals.cpp | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/korganizer/koglobals.cpp b/korganizer/koglobals.cpp index 8016034..9ece77f 100644 --- a/korganizer/koglobals.cpp +++ b/korganizer/koglobals.cpp | |||
@@ -1,143 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program 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 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | 25 | ||
26 | #include <kdebug.h> | 26 | #include <kdebug.h> |
27 | #include <kglobal.h> | 27 | #include <kglobal.h> |
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
30 | #include <kglobalsettings.h> | 30 | #include <kglobalsettings.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | 32 | ||
33 | #include <kcalendarsystem.h> | 33 | #include <kcalendarsystem.h> |
34 | 34 | ||
35 | #ifndef KORG_NOKALARMD | ||
36 | #include "kalarmdclient.h" | ||
37 | #endif | ||
38 | #include "simplealarmclient.h" | ||
39 | 35 | ||
40 | #include "koglobals.h" | 36 | #include "koglobals.h" |
41 | #include "koprefs.h" | 37 | #include "koprefs.h" |
42 | 38 | ||
43 | class NopAlarmClient : public AlarmClient | ||
44 | { | ||
45 | public: | ||
46 | void startDaemon() {} | ||
47 | bool setCalendars( const QStringList & ) { return false; } | ||
48 | bool addCalendar( const QString & ) { return false; } | ||
49 | bool removeCalendar( const QString & ) { return false; } | ||
50 | bool reloadCalendar( const QString & ) { return false; } | ||
51 | }; | ||
52 | 39 | ||
53 | KOGlobals *KOGlobals::mSelf = 0; | 40 | KOGlobals *KOGlobals::mSelf = 0; |
54 | 41 | ||
55 | KOGlobals *KOGlobals::self() | 42 | KOGlobals *KOGlobals::self() |
56 | { | 43 | { |
57 | if (!mSelf) { | 44 | if (!mSelf) { |
58 | mSelf = new KOGlobals; | 45 | mSelf = new KOGlobals; |
59 | } | 46 | } |
60 | 47 | ||
61 | return mSelf; | 48 | return mSelf; |
62 | } | 49 | } |
63 | 50 | ||
64 | KOGlobals::KOGlobals() | 51 | KOGlobals::KOGlobals() |
65 | { | 52 | { |
66 | KConfig *cfg = KOGlobals::config(); | 53 | KConfig *cfg = KOGlobals::config(); |
67 | 54 | ||
68 | cfg->setGroup("General"); | 55 | cfg->setGroup("General"); |
69 | mCalendarSystem = KGlobal::locale()->calendar(); | 56 | mCalendarSystem = KGlobal::locale()->calendar(); |
70 | 57 | ||
71 | cfg->setGroup("AlarmDaemon"); | ||
72 | QString alarmClient = cfg->readEntry( "Daemon", "kalarmd" ); | ||
73 | if ( alarmClient == "simple" ) { | ||
74 | mAlarmClient = new SimpleAlarmClient; | ||
75 | #ifndef KORG_NOKALARMD | ||
76 | } else if ( alarmClient == "kalarmd" ) { | ||
77 | mAlarmClient = new KalarmdClient; | ||
78 | #endif | ||
79 | } else { | ||
80 | mAlarmClient = new NopAlarmClient; | ||
81 | } | ||
82 | } | 58 | } |
83 | 59 | ||
84 | KConfig* KOGlobals::config() | 60 | KConfig* KOGlobals::config() |
85 | { | 61 | { |
86 | static KConfig *mConfig = 0; | 62 | static KConfig *mConfig = 0; |
87 | if (!mConfig) { | 63 | if (!mConfig) { |
88 | KOPrefs *p = KOPrefs::instance(); | 64 | KOPrefs *p = KOPrefs::instance(); |
89 | mConfig = p->getConfig(); | 65 | mConfig = p->getConfig(); |
90 | //mConfig = new KConfig( locateLocal( "config", "korganizerrc" ) ); | 66 | //mConfig = new KConfig( locateLocal( "config", "korganizerrc" ) ); |
91 | } | 67 | } |
92 | return mConfig; | 68 | return mConfig; |
93 | } | 69 | } |
94 | 70 | ||
95 | KOGlobals::~KOGlobals() | 71 | KOGlobals::~KOGlobals() |
96 | { | 72 | { |
97 | delete mAlarmClient; | 73 | |
98 | } | 74 | } |
99 | 75 | ||
100 | const KCalendarSystem *KOGlobals::calendarSystem() const | 76 | const KCalendarSystem *KOGlobals::calendarSystem() const |
101 | { | 77 | { |
102 | return mCalendarSystem; | 78 | return mCalendarSystem; |
103 | } | 79 | } |
104 | 80 | ||
105 | AlarmClient *KOGlobals::alarmClient() const | ||
106 | { | ||
107 | return mAlarmClient; | ||
108 | } | ||
109 | |||
110 | void KOGlobals::fitDialogToScreen( QWidget *wid, bool force ) | 81 | void KOGlobals::fitDialogToScreen( QWidget *wid, bool force ) |
111 | { | 82 | { |
112 | bool resized = false; | 83 | bool resized = false; |
113 | 84 | ||
114 | int w = wid->frameSize().width(); | 85 | int w = wid->frameSize().width(); |
115 | int h = wid->frameSize().height(); | 86 | int h = wid->frameSize().height(); |
116 | 87 | ||
117 | QRect desk = KGlobalSettings::desktopGeometry(wid); | 88 | QRect desk = KGlobalSettings::desktopGeometry(wid); |
118 | if ( w > desk.width() ) { | 89 | if ( w > desk.width() ) { |
119 | w = desk.width(); | 90 | w = desk.width(); |
120 | resized = true; | 91 | resized = true; |
121 | } | 92 | } |
122 | // Yuck this hack is ugly. Is the -30 really to circumvent the size of | 93 | // Yuck this hack is ugly. Is the -30 really to circumvent the size of |
123 | // kicker?! | 94 | // kicker?! |
124 | if ( h > desk.height() - 30 ) { | 95 | if ( h > desk.height() - 30 ) { |
125 | h = desk.height() - 30; | 96 | h = desk.height() - 30; |
126 | resized = true; | 97 | resized = true; |
127 | } | 98 | } |
128 | 99 | ||
129 | if ( resized || force ) { | 100 | if ( resized || force ) { |
130 | wid->resize( w, h ); | 101 | wid->resize( w, h ); |
131 | wid->move( desk.x(), desk.y()+15 ); | 102 | wid->move( desk.x(), desk.y()+15 ); |
132 | if ( force ) wid->setFixedSize( w, h ); | 103 | if ( force ) wid->setFixedSize( w, h ); |
133 | } | 104 | } |
134 | } | 105 | } |
135 | 106 | ||
136 | bool KOGlobals::reverseLayout() | 107 | bool KOGlobals::reverseLayout() |
137 | { | 108 | { |
138 | #if QT_VERSION >= 0x030000 | 109 | #if QT_VERSION >= 0x030000 |
139 | return QApplication::reverseLayout(); | 110 | return QApplication::reverseLayout(); |
140 | #else | 111 | #else |
141 | return false; | 112 | return false; |
142 | #endif | 113 | #endif |
143 | } | 114 | } |