summaryrefslogtreecommitdiffabout
path: root/korganizer/koglobals.cpp
Unidiff
Diffstat (limited to 'korganizer/koglobals.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koglobals.cpp31
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
@@ -19,107 +19,78 @@
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
43class 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
53KOGlobals *KOGlobals::mSelf = 0; 40KOGlobals *KOGlobals::mSelf = 0;
54 41
55KOGlobals *KOGlobals::self() 42KOGlobals *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
64KOGlobals::KOGlobals() 51KOGlobals::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
84KConfig* KOGlobals::config() 60KConfig* 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
95KOGlobals::~KOGlobals() 71KOGlobals::~KOGlobals()
96{ 72{
97 delete mAlarmClient; 73
98} 74}
99 75
100const KCalendarSystem *KOGlobals::calendarSystem() const 76const KCalendarSystem *KOGlobals::calendarSystem() const
101{ 77{
102 return mCalendarSystem; 78 return mCalendarSystem;
103} 79}
104 80
105AlarmClient *KOGlobals::alarmClient() const
106{
107 return mAlarmClient;
108}
109
110void KOGlobals::fitDialogToScreen( QWidget *wid, bool force ) 81void 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;