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 <QtGui/QVBoxLayout>
27 #include <kcomponentdata.h>
28 #include <kiconloader.h>
30 #include <kparts/genericfactory.h>
31 #include <kparts/statusbarextension.h>
33 K_PLUGIN_FACTORY( KAddressBookFactory
, registerPlugin
<KAddressBookPart
>(); )
34 K_EXPORT_PLUGIN( KAddressBookFactory( AboutData() ) )
36 KAddressBookPart::KAddressBookPart( QWidget
*parentWidget
, QObject
*parent
,
37 const QVariantList
& )
38 : KParts::ReadOnlyPart( parent
)
40 setComponentData( KAddressBookFactory::componentData() );
42 KIconLoader::global()->addAppDir( "kaddressbook" );
43 setXMLFile( "kaddressbookui.rc" );
44 // create a canvas to insert our widget
45 QWidget
*canvas
= new QWidget( parentWidget
);
46 canvas
->setFocusPolicy( Qt::ClickFocus
);
48 QVBoxLayout
*topLayout
= new QVBoxLayout( canvas
);
50 mMainWidget
= new MainWidget( this, canvas
);
52 topLayout
->addWidget( mMainWidget
);
53 topLayout
->setMargin(0);
56 void KAddressBookPart::newContact()
58 mMainWidget
->newContact();
61 void KAddressBookPart::newGroup()
63 mMainWidget
->newGroup();
66 KAddressBookPart::~KAddressBookPart()
70 bool KAddressBookPart::openFile()
75 void KAddressBookPart::guiActivateEvent(KParts::GUIActivateEvent
*e
)
78 KParts::ReadOnlyPart::guiActivateEvent(e
);