]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinpart.cpp
Interface modifications to KCmdLineArgs, KAboutData and KComponentData; BIC, SIC...
[dolphin.git] / src / dolphinpart.cpp
1 /* This file is part of the KDE project
2 Copyright (c) 2007 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 */
19
20 #include "dolphinpart.h"
21 #include <kparts/genericfactory.h>
22 #include "dolphinview.h"
23 #include "dolphinsortfilterproxymodel.h"
24 #include <kdirmodel.h>
25 #include <kdirlister.h>
26
27 typedef KParts::GenericFactory<DolphinPart> DolphinPartFactory;
28 K_EXPORT_COMPONENT_FACTORY(dolphinpart, DolphinPartFactory)
29
30 DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringList& args)
31 : KParts::ReadOnlyPart(parent)
32 {
33 Q_UNUSED(args)
34 setComponentData( DolphinPartFactory::componentData() );
35 //setBrowserExtension( new DolphinPartBrowserExtension( this ) );
36
37 m_dirLister = new KDirLister;
38 m_dirLister->setAutoUpdate(true);
39 m_dirLister->setMainWindow(parentWidget->topLevelWidget());
40 m_dirLister->setDelayedMimeTypes(true);
41
42 m_dirModel = new KDirModel(this);
43 m_dirModel->setDirLister(m_dirLister);
44
45 m_proxyModel = new DolphinSortFilterProxyModel(this);
46 m_proxyModel->setSourceModel(m_dirModel);
47
48 m_view = new DolphinView(parentWidget,
49 KUrl(),
50 m_dirLister,
51 m_dirModel,
52 m_proxyModel);
53 setWidget(m_view);
54 }
55
56 DolphinPart::~DolphinPart()
57 {
58 delete m_dirLister;
59 }
60
61 KAboutData* DolphinPart::createAboutData()
62 {
63 return new KAboutData("dolphinpart", 0, ki18n( "Dolphin Part" ), "0.1");
64 }
65
66 bool DolphinPart::openUrl(const KUrl& url)
67 {
68 m_view->setUrl(url);
69 return true;
70 }
71
72 #include "dolphinpart.moc"