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/statusbarextension.h>
31 #include <kpluginfactory.h>
34 K_PLUGIN_FACTORY( KAddressBookFactory
, registerPlugin
<KAddressBookPart
>(); )
35 K_EXPORT_PLUGIN( KAddressBookFactory( AboutData() ) )
37 KAddressBookPart::KAddressBookPart( QWidget
*parentWidget
, QObject
*parent
,
38 const QVariantList
& )
39 : KParts::ReadOnlyPart( parent
)
41 setComponentData( KAddressBookFactory::componentData() );
43 KIconLoader::global()->addAppDir( "kaddressbook" );
44 setXMLFile( "kaddressbookui.rc" );
45 // create a canvas to insert our widget
46 QWidget
*canvas
= new QWidget( parentWidget
);
47 canvas
->setFocusPolicy( Qt::ClickFocus
);
49 QVBoxLayout
*topLayout
= new QVBoxLayout( canvas
);
51 mMainWidget
= new MainWidget( this, canvas
);
53 topLayout
->addWidget( mMainWidget
);
54 topLayout
->setMargin(0);
57 void KAddressBookPart::newContact()
59 mMainWidget
->newContact();
62 void KAddressBookPart::newGroup()
64 mMainWidget
->newGroup();
67 KAddressBookPart::~KAddressBookPart()
71 bool KAddressBookPart::openFile()
76 void KAddressBookPart::guiActivateEvent(KParts::GUIActivateEvent
*e
)
79 KParts::ReadOnlyPart::guiActivateEvent(e
);