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
@@ -27,33 +27,20 @@
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 }
@@ -63,55 +50,39 @@ KOGlobals *KOGlobals::self()
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);