29 #include <calendarsupport/identitymanager.h>
32 #include <KServiceTypeTrader>
33 #include <KXMLGUIFactory>
47 : mCalendarDecorationsLoaded( false ), mIdentityManager( 0 )
61 QString::fromLatin1(
"[X-KDE-PluginInterfaceVersion] == %1" ).arg( QString::number( version ) );
64 return KServiceTypeTrader::self()->query( type, constraint );
70 CalendarSupport::Plugin::interfaceVersion() );
75 return availablePlugins( EventViews::CalendarDecoration::Decoration::serviceType(),
76 EventViews::CalendarDecoration::Decoration::interfaceVersion() );
92 kDebug() << service->library();
94 if ( !service->hasServiceType( CalendarSupport::Plugin::serviceType() ) ) {
98 KPluginLoader loader( *service );
102 kDebug() <<
"Factory creation failed";
106 CalendarSupport::PluginFactory *pluginFactory =
107 static_cast<CalendarSupport::PluginFactory *
>( factory );
109 if ( !pluginFactory ) {
110 kDebug() <<
"Cast failed";
114 return pluginFactory->createPluginFactory();
120 KService::List::ConstIterator it;
121 for ( it = list.constBegin(); it != list.constEnd(); ++it ) {
122 if ( (*it)->desktopEntryName() == name ) {
131 KPluginLoader loader( *service );
135 kDebug() <<
"Factory creation failed";
139 EventViews::CalendarDecoration::DecorationFactory *pluginFactory =
140 static_cast<EventViews::CalendarDecoration::DecorationFactory *
>( factory );
142 if ( !pluginFactory ) {
143 kDebug() <<
"Cast failed";
147 return pluginFactory->createPluginFactory();
153 KService::List::ConstIterator it;
154 for ( it = list.constBegin(); it != list.constEnd(); ++it ) {
155 if ( (*it)->desktopEntryName() == name ) {
164 kDebug() << service->library();
170 KPluginLoader loader( *service );
174 kDebug() <<
"Factory creation failed";
181 if ( !pluginFactory ) {
182 kDebug() <<
"Cast failed";
191 kDebug() << service->library();
197 KPluginLoader loader( *service );
201 kDebug() <<
"Factory creation failed";
208 if ( !pluginFactory ) {
209 kDebug() <<
"Cast failed";
218 mXMLGUIClients.insert( wdg, guiclient );
223 mXMLGUIClients.remove( wdg );
232 QWidget *topLevel = wdg->topLevelWidget();
233 QMap<QWidget*, KXMLGUIClient*>::ConstIterator it = mXMLGUIClients.find( topLevel );
234 if ( it != mXMLGUIClients.constEnd() ) {
244 KService::List::ConstIterator it;
245 for ( it = list.constBegin(); it != list.constEnd(); ++it ) {
246 if ( (*it)->desktopEntryName() == name ) {
256 KService::List::ConstIterator it;
257 for ( it = list.constBegin(); it != list.constEnd(); ++it ) {
258 if ( (*it)->desktopEntryName() == name ) {
267 if ( !mCalendarDecorationsLoaded ) {
270 mCalendarDecorations.clear();
272 KService::List::ConstIterator it;
273 for ( it = plugins.constBegin(); it != plugins.constEnd(); ++it ) {
274 if ( (*it)->hasServiceType( EventViews::CalendarDecoration::Decoration::serviceType() ) ) {
275 QString name = (*it)->desktopEntryName();
276 if ( selectedPlugins.contains( name ) ) {
278 mCalendarDecorations.append( d );
282 mCalendarDecorationsLoaded =
true;
285 return mCalendarDecorations;
295 KService::List::ConstIterator it;
296 for ( it = plugins.constBegin(); it != plugins.constEnd(); ++it ) {
297 if ( selectedPlugins.contains( (*it)->desktopEntryName() ) ) {
301 kError() <<
"parent has no mainGuiClient.";
304 parts.append( part );
317 QStringList selectedPlugins = viewPrefs->selectedPlugins();
320 KService::List::ConstIterator it;
321 for ( it = plugins.constBegin(); it != plugins.constEnd(); ++it ) {
322 if ( selectedPlugins.contains( (*it)->desktopEntryName() ) ) {
325 loadedPlugins.append( part );
329 return loadedPlugins;
334 qDeleteAll( mCalendarDecorations );
335 mCalendarDecorations.clear();
336 mCalendarDecorationsLoaded =
false;
350 KXMLGUIFactory *factory = parent->
mainGuiClient()->factory();
371 if ( !mIdentityManager ) {
372 mIdentityManager =
new CalendarSupport::IdentityManager;
374 return mIdentityManager;
static int interfaceVersion()
KService::List availablePlugins()
EventViews::PrefsPtr eventViewsPreferences() const
KService::List availablePrintPlugins()
KXMLGUIClient * xmlguiClient(QWidget *) const
EventViews::CalendarDecoration::Decoration::List loadCalendarDecorations()
KOrg::Part::List loadParts(KOrg::MainWindow *parent)
static QString serviceType()
void unloadParts(KOrg::MainWindow *parent, KOrg::Part::List &parts)
Unload the parts in &p parts for this main window.
QList< PrintPlugin * > List
KOrg::PrintPlugin * loadPrintPlugin(KService::Ptr service)
KOrg::PrintPlugin::List loadPrintPlugins()
virtual PrintPlugin * createPluginFactory()=0
KPIMIdentities::IdentityManager * identityManager()
Base class for KOrganizer printing classes.
interface for korganizer main window
KService::List availableParts()
CalendarSupport::Plugin * loadPlugin(KService::Ptr service)
KOrg::Part::List reloadParts(KOrg::MainWindow *parent, KOrg::Part::List &parts)
Unloads the parts from the main window.
virtual KXMLGUIClient * mainGuiClient()=0
Return XML GUI client of this main window.
QStringList mSelectedPlugins
void addXMLGUIClient(QWidget *, KXMLGUIClient *guiclient)
static KOPrefs * instance()
Get instance of KOPrefs.
void removeXMLGUIClient(QWidget *)
static QString serviceType()
virtual Part * createPluginFactory(MainWindow *parent)=0
KOrg::Part * loadPart(KService::Ptr, KOrg::MainWindow *parent)
KService::List availableCalendarDecorations()
EventViews::CalendarDecoration::Decoration * loadCalendarDecoration(KService::Ptr service)
static int interfaceVersion()