koglobals.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <qapplication.h>
00026
00027 #include <kdebug.h>
00028 #include <kglobal.h>
00029 #include <kconfig.h>
00030 #include <kstandarddirs.h>
00031 #include <kglobalsettings.h>
00032 #include <klocale.h>
00033 #include <kstaticdeleter.h>
00034 #include <kiconloader.h>
00035
00036 #include <kcalendarsystem.h>
00037
00038 #include "alarmclient.h"
00039
00040 #include "koglobals.h"
00041 #include "korganizer_part.h"
00042
00043 #if 0 // unused
00044 class NopAlarmClient : public AlarmClient
00045 {
00046 public:
00047 void startDaemon() {}
00048 void stopDaemon() {}
00049 };
00050 #endif
00051
00052 KOGlobals *KOGlobals::mSelf = 0;
00053
00054 static KStaticDeleter<KOGlobals> koGlobalsDeleter;
00055
00056 KOGlobals *KOGlobals::self()
00057 {
00058 if (!mSelf) {
00059 koGlobalsDeleter.setObject( mSelf, new KOGlobals );
00060 }
00061
00062 return mSelf;
00063 }
00064
00065 KOGlobals::KOGlobals()
00066 {
00067
00068
00069 mOwnInstance = new KInstance("korganizer");
00070 mOwnInstance->config()->setGroup("General");
00071
00072 mAlarmClient = new AlarmClient;
00073 }
00074
00075 KConfig* KOGlobals::config() const
00076 {
00077 return mOwnInstance->config();
00078 }
00079
00080 KOGlobals::~KOGlobals()
00081 {
00082 delete mAlarmClient;
00083 mAlarmClient = 0;
00084
00085 delete mOwnInstance;
00086 mOwnInstance = 0;
00087 }
00088
00089 const KCalendarSystem *KOGlobals::calendarSystem() const
00090 {
00091 return KGlobal::locale()->calendar();
00092 }
00093
00094 AlarmClient *KOGlobals::alarmClient() const
00095 {
00096 return mAlarmClient;
00097 }
00098
00099 void KOGlobals::fitDialogToScreen( QWidget *wid, bool force )
00100 {
00101 bool resized = false;
00102
00103 int w = wid->frameSize().width();
00104 int h = wid->frameSize().height();
00105
00106 QRect desk = KGlobalSettings::desktopGeometry(wid);
00107 if ( w > desk.width() ) {
00108 w = desk.width();
00109 resized = true;
00110 }
00111
00112
00113 if ( h > desk.height() - 30 ) {
00114 h = desk.height() - 30;
00115 resized = true;
00116 }
00117
00118 if ( resized || force ) {
00119 wid->resize( w, h );
00120 wid->move( desk.x(), desk.y()+15 );
00121 if ( force ) wid->setFixedSize( w, h );
00122 }
00123 }
00124
00125 bool KOGlobals::reverseLayout()
00126 {
00127 #if QT_VERSION >= 0x030000
00128 return QApplication::reverseLayout();
00129 #else
00130 return false;
00131 #endif
00132 }
00133
00134 QPixmap KOGlobals::smallIcon(const QString& name)
00135 {
00136 return SmallIcon(name, mOwnInstance);
00137 }
00138
00139 QIconSet KOGlobals::smallIconSet(const QString& name, int size)
00140 {
00141 return SmallIconSet(name, size, mOwnInstance);
00142 }
This file is part of the documentation for korganizer Library Version 3.3.2.