File indexing completed on 2024-05-12 16:39:24

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
0003    Copyright (C) 2009 Dag Andersen <danders@get2net.dk>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 
0021 // clazy:excludeall=qstring-arg
0022 #include "factory.h"
0023 #include "part.h"
0024 #include "aboutdata.h"
0025 
0026 #include <KoResourcePaths.h>
0027 #include <KoComponentData.h>
0028 
0029 #include <kiconloader.h>
0030 
0031 
0032 namespace KPlatoWork
0033 {
0034 
0035 KoComponentData* Factory::s_global = 0L;
0036 KAboutData* Factory::s_aboutData = 0L;
0037 
0038 Factory::Factory()
0039     : KPluginFactory()
0040 {
0041     global();
0042 }
0043 
0044 Factory::~Factory()
0045 {
0046     delete s_aboutData;
0047     s_aboutData = 0L;
0048     delete s_global;
0049     s_global = 0L;
0050 }
0051 
0052 QObject* Factory::create(const char* iface, QWidget* parentWidget, QObject *parent,
0053                              const QVariantList& args, const QString& keyword)
0054 {
0055     Q_UNUSED(args);
0056     Q_UNUSED(keyword);
0057     Q_UNUSED(iface);
0058     Part *part = new Part(parentWidget, parent);
0059     return part;
0060 }
0061 
0062 KAboutData* Factory::aboutData()
0063 {
0064     if (!s_aboutData)
0065         s_aboutData = newAboutData();
0066     return s_aboutData;
0067 }
0068 
0069 const KoComponentData &Factory::global()
0070 {
0071     if (!s_global)
0072     {
0073         s_global = new KoComponentData(*aboutData());
0074 
0075         // Add any application-specific resource directories here
0076         KoResourcePaths::addResourceType("planwork_template", "data", "calligraplanwork/templates/");
0077         KoResourcePaths::addResourceType("projects", "data", "calligraplanwork/projects/");
0078 
0079         // Tell the iconloader about share/apps/calligra/icons
0080         KIconLoader::global()->addAppDir("calligra");
0081 
0082     }
0083     return *s_global;
0084 }
0085 
0086 } // KPlatoWork namespace