kaddressbook Library API Documentation

kaddressbook_part.cpp

00001 /*
00002     This file is part of KAddressbook.
00003     Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #include <qlayout.h>
00025 
00026 #include <kapplication.h>
00027 #include <kinstance.h>
00028 #include <klocale.h>
00029 #include <kaboutdata.h>
00030 #include <kiconloader.h>
00031 #include <kaction.h>
00032 #include <kdebug.h>
00033 #include <kparts/genericfactory.h>
00034 
00035 #include "kaddressbook.h"
00036 #include "kaddressbooktableview.h"
00037 #include "viewmanager.h"
00038 #include "kaddressbookiface.h"
00039 #include "actionmanager.h"
00040 
00041 #include "kaddressbook_part.h"
00042 
00043 typedef KParts::GenericFactory< KAddressbookPart > KAddressbookFactory;
00044 K_EXPORT_COMPONENT_FACTORY( libkaddressbookpart, KAddressbookFactory )
00045 
00046 KAddressbookPart::KAddressbookPart(QWidget *parentWidget, const char *widgetName,
00047                                QObject *parent, const char *name, const QStringList &) :
00048   KParts::ReadOnlyPart(parent, name), DCOPObject("KAddressBookIface")
00049 {
00050   kdDebug() << "KAddressbookPart()" << endl;
00051   kdDebug() << "  InstanceName: " << kapp->instanceName() << endl;
00052 
00053   setInstance(KAddressbookFactory::instance());
00054 
00055   kdDebug() << "KAddressbookPart()..." << endl;
00056   kdDebug() << "  InstanceName: " << kapp->instanceName() << endl;
00057 
00058   // create a canvas to insert our widget
00059   QWidget *canvas = new QWidget(parentWidget, widgetName);
00060   canvas->setFocusPolicy(QWidget::ClickFocus);
00061   setWidget(canvas);
00062 
00063   m_extension = new KAddressbookBrowserExtension(this);
00064 
00065   QVBoxLayout *topLayout = new QVBoxLayout(canvas);
00066 
00067   KGlobal::iconLoader()->addAppDir("kaddressbook");
00068 
00069   widget = new KAddressBook(canvas);
00070   widget->readConfig();
00071   topLayout->addWidget(widget);
00072   widget->viewManager()->showFeatures( 0 );
00073 
00074   widget->show();
00075 
00076   mActionManager = new ActionManager(this, widget, false, this);
00077 
00078   setXMLFile( "kaddressbook_part.rc" );
00079 }
00080 
00081 KAddressbookPart::~KAddressbookPart()
00082 {
00083   closeURL();
00084 }
00085 
00086 KAboutData *KAddressbookPart::createAboutData()
00087 {
00088   KAboutData *about = new KAboutData("kaddressbook", I18N_NOOP("KAddressBook"),
00089                                      "3.1", I18N_NOOP("The KDE Address Book"),
00090                                      KAboutData::License_BSD,
00091                                      I18N_NOOP("(c) 1997-2002, The KDE PIM Team"));
00092   about->addAuthor("Tobias Koenig", I18N_NOOP("Current maintainer"), "tokoe@kde.org");
00093   about->addAuthor("Don Sanders",I18N_NOOP("Original author"));
00094   about->addAuthor("Cornelius Schumacher",
00095                   I18N_NOOP("Co-maintainer, libkabc port, csv import/export"),
00096                   "schumacher@kde.org");
00097   about->addAuthor("Mike Pilone", I18N_NOOP( "GUI and framework redesign" ),
00098                   "mpilone@slac.com" );
00099   about->addAuthor("Greg Stern", I18N_NOOP("DCOP interface"));
00100   about->addAuthor("Mark Westcott",I18N_NOOP("Contact pinning"));
00101   about->addAuthor("Mischel Boyer de la Giroday", I18N_NOOP("LDAP Lookup"),
00102                    "michel@klaralvdalens-datakonsult.se");
00103   about->addAuthor("Steffen Hansen", I18N_NOOP("LDAP Lookup"), "hansen@kde.org");
00104 
00105 
00106   return about;
00107 }
00108 
00109 bool KAddressbookPart::openFile()
00110 {
00111   kdDebug() << "KAddressbookPart:openFile()" << endl;
00112 
00113   widget->show();
00114   return true;
00115 }
00116 
00117 void KAddressbookPart::guiActivateEvent(KParts::GUIActivateEvent *e)
00118 {
00119   kdDebug() << "KAddressbookPart::guiActivateEvent" << endl;
00120   KParts::ReadOnlyPart::guiActivateEvent(e);
00121 
00122   mActionManager->initActionViewList();
00123 }
00124 
00125 KAddressbookBrowserExtension::KAddressbookBrowserExtension(KAddressbookPart *parent) :
00126   KParts::BrowserExtension(parent, "KAddressbookBrowserExtension")
00127 {
00128 }
00129 
00130 KAddressbookBrowserExtension::~KAddressbookBrowserExtension()
00131 {
00132 }
00133 
00134 using namespace KParts;
00135 #include "kaddressbook_part.moc"
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:37 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001