• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kaddressbook

  • sources
  • kde-4.14
  • kdepim
  • kaddressbook
kaddressbookpart.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KAddressBook.
3 
4  Copyright (c) 2009-2015 Laurent Montel <montel@kde.org>
5 
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.
10 
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.
15 
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.
19 */
20 
21 #include "kaddressbookpart.h"
22 #include "aboutdata.h"
23 #include "mainwidget.h"
24 #include "startup.h"
25 
26 #include <KDebug>
27 #include <KIconLoader>
28 #include <KLocalizedString>
29 #include <KPluginFactory>
30 #include <KParts/StatusBarExtension>
31 #include <KAction>
32 #include <KActionCollection>
33 
34 #include <QVBoxLayout>
35 
36 K_PLUGIN_FACTORY( KAddressBookFactory, registerPlugin<KAddressBookPart>(); )
37 K_EXPORT_PLUGIN( KAddressBookFactory( AboutData() ) )
38 
39 KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent,
40  const QVariantList & )
41  : KParts::ReadOnlyPart( parent )
42 {
43  setComponentData( KAddressBookFactory::componentData() );
44 
45  KAddressBook::insertLibraryCatalogues();
46 
47  KIconLoader::global()->addAppDir( QLatin1String("kaddressbook") );
48  // create a canvas to insert our widget
49  QWidget *canvas = new QWidget( parentWidget );
50  canvas->setFocusPolicy( Qt::ClickFocus );
51  setWidget( canvas );
52  QVBoxLayout *topLayout = new QVBoxLayout( canvas );
53 
54  mMainWidget = new MainWidget( this, canvas );
55  initAction();
56 
57  topLayout->addWidget( mMainWidget );
58  topLayout->setMargin(0);
59  setXMLFile( QLatin1String("kaddressbookui.rc") );
60 }
61 
62 void KAddressBookPart::updateQuickSearchText()
63 {
64  mMainWidget->updateQuickSearchText();
65 }
66 
67 void KAddressBookPart::initAction()
68 {
69  KAction *action = new KAction( KIcon( QLatin1String("configure") ), i18n( "&Configure KAddressBook..." ), this );
70  actionCollection()->addAction( QLatin1String("kaddressbook_configure"), action );
71  connect( action, SIGNAL(triggered(bool)), mMainWidget,
72  SLOT(configure()) );
73 }
74 
75 void KAddressBookPart::newContact()
76 {
77  mMainWidget->newContact();
78 }
79 
80 void KAddressBookPart::newGroup()
81 {
82  mMainWidget->newGroup();
83 }
84 
85 KAddressBookPart::~KAddressBookPart()
86 {
87 }
88 
89 bool KAddressBookPart::openFile()
90 {
91  return false;
92 }
93 
94 void KAddressBookPart::guiActivateEvent( KParts::GUIActivateEvent *e )
95 {
96  kDebug();
97  KParts::ReadOnlyPart::guiActivateEvent( e );
98 }
99 
K_EXPORT_PLUGIN
K_EXPORT_PLUGIN(KAddressBookFactory(AboutData())) KAddressBookPart
Definition: kaddressbookpart.cpp:37
QWidget
KAddressBookPart::KAddressBookPart
KAddressBookPart(QWidget *parentWidget, QObject *parent, const QVariantList &)
QWidget::setFocusPolicy
void setFocusPolicy(Qt::FocusPolicy policy)
KAddressBookPart::~KAddressBookPart
virtual ~KAddressBookPart()
Definition: kaddressbookpart.cpp:85
KAddressBookPart::updateQuickSearchText
void updateQuickSearchText()
Definition: kaddressbookpart.cpp:62
MainWidget::newContact
void newContact()
Definition: mainwidget.cpp:774
AboutData
Definition: aboutdata.h:28
KAddressBookPart::newContact
void newContact()
Definition: kaddressbookpart.cpp:75
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
startup.h
QObject
aboutdata.h
QVBoxLayout
QLayout::setMargin
void setMargin(int margin)
KAddressBookPart::openFile
virtual bool openFile()
Definition: kaddressbookpart.cpp:89
mainwidget.h
KAddressBook::insertLibraryCatalogues
void insertLibraryCatalogues()
Definition: startup.cpp:6
kaddressbookpart.h
KAddressBookPart::newGroup
void newGroup()
Definition: kaddressbookpart.cpp:80
QLatin1String
MainWidget::updateQuickSearchText
void updateQuickSearchText()
Definition: mainwidget.cpp:370
KAddressBookPart::initAction
void initAction()
Definition: kaddressbookpart.cpp:67
MainWidget::newGroup
void newGroup()
Definition: mainwidget.cpp:779
KAddressBookPart::guiActivateEvent
virtual void guiActivateEvent(KParts::GUIActivateEvent *)
Definition: kaddressbookpart.cpp:94
MainWidget
Definition: mainwidget.h:64
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal