1 /***************************************************************************
2 * Copyright 2006 Alexander Dymo <adymo@kdevelop.org> *
3 * Copyright 2007 Andreas Pakulat <apaku@gmx.de> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU Library General Public *
16 * License along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20 #include "kdevfilemanagerplugin.h"
25 #include <kpluginfactory.h>
26 #include <kpluginloader.h>
28 #include <kactioncollection.h>
29 #include <kaboutdata.h>
31 #include <interfaces/icore.h>
32 #include <interfaces/iuicontroller.h>
34 #include "filemanager.h"
36 K_PLUGIN_FACTORY(KDevFileManagerFactory
, registerPlugin
<KDevFileManagerPlugin
>(); )
37 K_EXPORT_PLUGIN(KDevFileManagerFactory(KAboutData("kdevfilemanager","kdevfilemanager",ki18n("File Manager"), "0.1", ki18n("Browse the filesystem"), KAboutData::License_GPL
)))
40 class KDevFileManagerViewFactory
: public KDevelop::IToolViewFactory
{
42 KDevFileManagerViewFactory(KDevFileManagerPlugin
*plugin
): m_plugin(plugin
) {}
43 virtual QWidget
* create(QWidget
*parent
= 0)
46 return new FileManager(m_plugin
,parent
);
49 QList
<QAction
*> toolBarActions( QWidget
* w
) const
51 FileManager
* m
= qobject_cast
<FileManager
*>(w
);
53 return m
->toolBarActions();
54 return KDevelop::IToolViewFactory::toolBarActions( w
);
57 virtual Qt::DockWidgetArea
defaultPosition()
59 return Qt::LeftDockWidgetArea
;
62 virtual QString
id() const
64 return "org.kdevelop.FileManagerView";
68 KDevFileManagerPlugin
*m_plugin
;
71 KDevFileManagerPlugin::KDevFileManagerPlugin(QObject
*parent
, const QVariantList
&/*args*/)
72 :KDevelop::IPlugin(KDevFileManagerFactory::componentData(), parent
)
74 setXMLFile("kdevfilemanager.rc");
79 void KDevFileManagerPlugin::init()
81 m_factory
= new KDevFileManagerViewFactory(this);
82 core()->uiController()->addToolView("Filesystem", m_factory
);
85 KDevFileManagerPlugin::~KDevFileManagerPlugin()
89 void KDevFileManagerPlugin::unload()
91 core()->uiController()->removeToolView(m_factory
);
94 #include "kdevfilemanagerplugin.moc"