Fix typo found by Yuri Chornoivan
[kdepim.git] / knode / knode_part.cpp
bloba0973bc0cb69d72ea2c8266ae78a83b645246e0e
1 /*
2 This file is part of KNode.
3 Copyright (c) 2003 Laurent Montel <montel@kde.org>,
4 Based on the work of Cornelius Schumacher <schumacher@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution.
25 #include "knode_part.h"
27 #include "knglobals.h"
28 #include "knmainwidget.h"
29 #include "aboutdata.h"
30 #include "kncollectionview.h"
31 #include "utils/startup.h"
34 #include <kparts/genericfactory.h>
35 #include <kparts/statusbarextension.h>
36 #include <kiconloader.h>
37 #include <kdebug.h>
38 #include <kstatusbar.h>
39 #include <ksqueezedtextlabel.h>
41 #include <QVBoxLayout>
44 K_PLUGIN_FACTORY(KNodeFactory, registerPlugin<KNodePart>();)
45 K_EXPORT_PLUGIN(KNodeFactory(KNode::AboutData()))
47 KNodePart::KNodePart( QWidget *parentWidget, QObject *parent, const QVariantList &)
48 : KParts::ReadOnlyPart( parent ),
49 mParentWidget( parentWidget )
51 kDebug(5003) <<"KNodePart()";
52 kDebug(5003) <<" InstanceName:" << KGlobal::mainComponent().componentName();
54 setComponentData( KNodeFactory::componentData() );
56 kDebug(5003) <<"KNodePart()...";
57 kDebug(5003) <<" InstanceName:" << KGlobal::mainComponent().componentName();
59 KNode::Utilities::Startup::loadLibrariesIconsAndTranslations();
61 #ifdef __GNUC__
62 #warning Port me!
63 #endif
64 // kapp->dcopClient()->suspend(); // Don't handle DCOP requests yet
66 knGlobals.setComponentData( KNodeFactory::componentData() );
68 // create a canvas to insert our widget
69 QWidget *canvas = new QWidget(parentWidget);
70 canvas->setFocusPolicy( Qt::ClickFocus );
71 setWidget(canvas);
73 mainWidget = new KNMainWidget( this, canvas );
74 QVBoxLayout *topLayout = new QVBoxLayout( canvas, 0 );
75 topLayout->addWidget(mainWidget);
76 mainWidget->setFocusPolicy( Qt::ClickFocus );
78 #ifdef __GNUC__
79 #warning Port me!
80 #endif
81 // kapp->dcopClient()->resume(); // Ok. We are ready for DCOP requests.
83 KParts::StatusBarExtension* statusBar = new KParts::StatusBarExtension(this);
84 statusBar->addStatusBarItem(mainWidget->statusBarLabelFilter(), 10, false);
85 statusBar->addStatusBarItem(mainWidget->statusBarLabelGroup(), 15, false);
87 setXMLFile( "knodeui.rc" );
90 KNodePart::~KNodePart()
92 mainWidget->prepareShutdown();
95 KAboutData *KNodePart::createAboutData()
97 return new KNode::AboutData();
100 bool KNodePart::openFile()
102 kDebug(5003) <<"KNodePart:openFile()";
104 mainWidget->show();
105 return true;
108 void KNodePart::guiActivateEvent(KParts::GUIActivateEvent *e)
110 kDebug(5003) <<"KNodePart::guiActivateEvent";
111 KParts::ReadOnlyPart::guiActivateEvent(e);
115 QWidget* KNodePart::parentWidget() const
117 return mParentWidget;
122 #include "knode_part.moc"