Apply the wording fix by Marek Laane.
[kdepim.git] / kaddressbook / kaddressbookpart.cpp
blob0ecfb28fc82b0f526fd07999a93170c7a0ec0748
1 /*
2 This file is part of KAddressBook.
4 Copyright (c) 2009 Laurent Montel <montel@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 along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "kaddressbookpart.h"
22 #include "aboutdata.h"
23 #include "mainwidget.h"
25 #include <KComponentData>
26 #include <KDebug>
27 #include <KIconLoader>
28 #include <KLocale>
29 #include <KPluginFactory>
30 #include <KParts/StatusBarExtension>
31 #include <KAction>
32 #include <KActionCollection>
34 #include <QtGui/QVBoxLayout>
36 K_PLUGIN_FACTORY( KAddressBookFactory, registerPlugin<KAddressBookPart>(); )
37 K_EXPORT_PLUGIN( KAddressBookFactory( AboutData() ) )
39 KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent,
40 const QVariantList & )
41 : KParts::ReadOnlyPart( parent )
43 setComponentData( KAddressBookFactory::componentData() );
45 KIconLoader::global()->addAppDir( "kaddressbook" );
46 // create a canvas to insert our widget
47 QWidget *canvas = new QWidget( parentWidget );
48 canvas->setFocusPolicy( Qt::ClickFocus );
49 setWidget( canvas );
50 QVBoxLayout *topLayout = new QVBoxLayout( canvas );
52 mMainWidget = new MainWidget( this, canvas );
53 initAction();
55 topLayout->addWidget( mMainWidget );
56 topLayout->setMargin(0);
57 setXMLFile( "kaddressbookui.rc" );
60 void KAddressBookPart::initAction()
62 KAction *action = new KAction( KIcon( "configure" ), i18n( "&Configure KAddressBook..." ), this );
63 actionCollection()->addAction( "kaddressbook_configure", action );
64 connect( action, SIGNAL(triggered(bool)), mMainWidget,
65 SLOT(configure()) );
68 void KAddressBookPart::newContact()
70 mMainWidget->newContact();
73 void KAddressBookPart::newGroup()
75 mMainWidget->newGroup();
78 KAddressBookPart::~KAddressBookPart()
82 bool KAddressBookPart::openFile()
84 return false;
87 void KAddressBookPart::guiActivateEvent( KParts::GUIActivateEvent *e )
89 kDebug();
90 KParts::ReadOnlyPart::guiActivateEvent( e );