diff options
Diffstat (limited to 'kaddressbook/interfaces')
-rw-r--r-- | kaddressbook/interfaces/Makefile.am | 18 | ||||
-rw-r--r-- | kaddressbook/interfaces/configurewidget.cpp | 53 | ||||
-rw-r--r-- | kaddressbook/interfaces/configurewidget.h | 72 | ||||
-rw-r--r-- | kaddressbook/interfaces/contacteditorwidget.cpp | 60 | ||||
-rw-r--r-- | kaddressbook/interfaces/contacteditorwidget.h | 143 | ||||
-rw-r--r-- | kaddressbook/interfaces/core.cpp | 33 | ||||
-rw-r--r-- | kaddressbook/interfaces/core.h | 203 | ||||
-rw-r--r-- | kaddressbook/interfaces/extensionwidget.cpp | 68 | ||||
-rw-r--r-- | kaddressbook/interfaces/extensionwidget.h | 120 | ||||
-rw-r--r-- | kaddressbook/interfaces/kaddressbook_contacteditorwidget.desktop | 55 | ||||
-rw-r--r-- | kaddressbook/interfaces/kaddressbook_extension.desktop | 59 | ||||
-rw-r--r-- | kaddressbook/interfaces/kaddressbook_xxport.desktop | 62 | ||||
-rw-r--r-- | kaddressbook/interfaces/xxport.cpp | 128 | ||||
-rw-r--r-- | kaddressbook/interfaces/xxport.h | 179 |
14 files changed, 1253 insertions, 0 deletions
diff --git a/kaddressbook/interfaces/Makefile.am b/kaddressbook/interfaces/Makefile.am new file mode 100644 index 000000000..7b4373643 --- /dev/null +++ b/kaddressbook/interfaces/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = -I$(top_srcdir) $(all_includes) + +lib_LTLIBRARIES = libkabinterfaces.la + +libkabinterfaces_la_SOURCES = configurewidget.cpp contacteditorwidget.cpp \ + core.cpp extensionwidget.cpp xxport.cpp +libkabinterfaces_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -no-undefined +libkabinterfaces_la_LIBADD = $(LIB_KABC) + +kabincludedir = $(includedir)/kaddressbook +kabinclude_HEADERS = configurewidget.h contacteditorwidget.h core.h \ + extensionwidget.h xxport.h + +METASOURCES = AUTO + +servicetypedir = $(kde_servicetypesdir) +servicetype_DATA = kaddressbook_contacteditorwidget.desktop \ + kaddressbook_extension.desktop kaddressbook_xxport.desktop diff --git a/kaddressbook/interfaces/configurewidget.cpp b/kaddressbook/interfaces/configurewidget.cpp new file mode 100644 index 000000000..518a29538 --- /dev/null +++ b/kaddressbook/interfaces/configurewidget.cpp @@ -0,0 +1,53 @@ +/* + This file is part of KAddressBook. + Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <kabc/addressbook.h> + +#include "configurewidget.h" + +using namespace KAB; + +ConfigureWidget::ConfigureWidget( KABC::AddressBook *ab, QWidget *parent, + const char *name ) + : QWidget( parent, name ), mAddressBook( ab ) +{ +} + +ConfigureWidget::~ConfigureWidget() +{ +} + +void ConfigureWidget::restoreSettings( KConfig* ) +{ + // should be reimplemented in the views, extensions etc. +} + +void ConfigureWidget::saveSettings( KConfig* ) +{ + // should be reimplemented in the views, extensions etc. +} + +KABC::AddressBook *ConfigureWidget::addressBook() const +{ + return mAddressBook; +} diff --git a/kaddressbook/interfaces/configurewidget.h b/kaddressbook/interfaces/configurewidget.h new file mode 100644 index 000000000..601adce97 --- /dev/null +++ b/kaddressbook/interfaces/configurewidget.h @@ -0,0 +1,72 @@ +/* + This file is part of KAddressBook. + Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#ifndef KAB_CONFIGUREWIDGET_H +#define KAB_CONFIGUREWIDGET_H + +#include <qwidget.h> + +#include <kconfig.h> +#include <kdepimmacros.h> + +namespace KABC { +class AddressBook; +} + +namespace KAB { + +class KDE_EXPORT ConfigureWidget : public QWidget +{ + public: + ConfigureWidget( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); + ~ConfigureWidget(); + + /** + This method is called before the configure dialog is shown. + The widget should reimplement it and fill the GUI with the + values from the config file. + Important: Don't change the group of cfg! + */ + virtual void restoreSettings( KConfig *cfg ); + + /** + This method is called after the user clicked the 'Ok' button. + The widget should reimplement it and save all values from + the GUI to the config file. + Important: Don't change the group of cfg! + */ + virtual void saveSettings( KConfig *cfg ); + + + /** + Returns a pointer to the address book of this widget. + */ + KABC::AddressBook *addressBook() const; + + private: + KABC::AddressBook *mAddressBook; +}; + +} + +#endif diff --git a/kaddressbook/interfaces/contacteditorwidget.cpp b/kaddressbook/interfaces/contacteditorwidget.cpp new file mode 100644 index 000000000..366087c62 --- /dev/null +++ b/kaddressbook/interfaces/contacteditorwidget.cpp @@ -0,0 +1,60 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include "contacteditorwidget.h" + +using namespace KAB; + +ContactEditorWidget::ContactEditorWidget( KABC::AddressBook *ab, + QWidget *parent, const char *name ) + : QWidget( parent, name ), mAddressBook( ab ), mModified( false ) +{ +} + +ContactEditorWidget::~ContactEditorWidget() +{ +} + +KABC::AddressBook *ContactEditorWidget::addressBook() const +{ + return mAddressBook; +} + +bool ContactEditorWidget::modified() const +{ + return mModified; +} + +void ContactEditorWidget::setModified() +{ + setModified( true ); +} + +void ContactEditorWidget::setModified( bool modified ) +{ + mModified = modified; + if ( modified ) + emit changed(); +} + +#include "contacteditorwidget.moc" diff --git a/kaddressbook/interfaces/contacteditorwidget.h b/kaddressbook/interfaces/contacteditorwidget.h new file mode 100644 index 000000000..4b80b44f4 --- /dev/null +++ b/kaddressbook/interfaces/contacteditorwidget.h @@ -0,0 +1,143 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2004 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#ifndef KAB_CONTACTEDITORWIDGET_H +#define KAB_CONTACTEDITORWIDGET_H + +#include <qwidget.h> + +#include <kabc/addressbook.h> +#include <klibloader.h> +#include <kdepimmacros.h> + +#define KAB_CEW_PLUGIN_VERSION 1 + +namespace KAB { + +class KDE_EXPORT ContactEditorWidget : public QWidget +{ + Q_OBJECT + + public: + typedef QValueList<ContactEditorWidget*> List; + + ContactEditorWidget( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); + ~ContactEditorWidget(); + + /** + Return logical height of the widget. This is used to calculate how + much vertical space relative to other widgets this widget will use + in the summary view. + */ + virtual int logicalHeight() const { return 1; } + + /** + Return logical wide of the widget. This is used to calculate how + much horizontal space relative to other widgets this widget will use + in the summary view. + */ + virtual int logicalWidth() const { return 1; } + + /** + Load the contacts data into the GUI. + */ + virtual void loadContact( KABC::Addressee *addr ) = 0; + + /** + Save the data from the GUI into the passed contact + object. + */ + virtual void storeContact( KABC::Addressee *addr ) = 0; + + /** + Sets whether the contact should be presented as + read-only. You should update your GUI in the reimplemented + method. + */ + virtual void setReadOnly( bool readOnly ) = 0; + + /** + Returns whether this widget was modified. + */ + bool modified() const; + + signals: + /** + Emitted whenever the page has changed, do not emit it directly, + use setModified() instead. + */ + void changed(); + + public slots: + /** + Call this slot whenever the data were changed by the user. It + will emit the changed() signal and set the modified property. + + @param modified Set whether the widget was modified. + */ + void setModified( bool modified ); + + void setModified(); + + protected: + /** + Returns a pointer to the address book object. + */ + KABC::AddressBook *addressBook() const; + + private: + KABC::AddressBook *mAddressBook; + bool mModified; + + class ContactEditorWidgetPrivate; + ContactEditorWidgetPrivate *d; +}; + +class ContactEditorWidgetFactory : public KLibFactory +{ + public: + virtual ContactEditorWidget *createWidget( KABC::AddressBook *ab, QWidget *parent, + const char *name = 0 ) = 0; + + /** + Returns the i18ned title of this tab page. + */ + virtual QString pageTitle() const { return ""; } + + /** + Returns the identifier of the tab page where the widget + shall belong to. + */ + virtual QString pageIdentifier() const = 0; + + protected: + virtual QObject* createObject( QObject*, const char*, const char*, + const QStringList & ) + { + return 0; + } +}; + +} + +#endif diff --git a/kaddressbook/interfaces/core.cpp b/kaddressbook/interfaces/core.cpp new file mode 100644 index 000000000..6c8e10910 --- /dev/null +++ b/kaddressbook/interfaces/core.cpp @@ -0,0 +1,33 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include "core.h" + +using namespace KAB; + +Core::Core( KXMLGUIClient *client, QObject *parent, const char *name ) + : QObject( parent, name ), mGUIClient( client ) +{ +} + +#include "core.moc" diff --git a/kaddressbook/interfaces/core.h b/kaddressbook/interfaces/core.h new file mode 100644 index 000000000..276b20d61 --- /dev/null +++ b/kaddressbook/interfaces/core.h @@ -0,0 +1,203 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#ifndef KAB_CORE_H +#define KAB_CORE_H + +#include <config.h> // for KDEPIM_NEW_DISTRLISTS + +#ifdef KDEPIM_NEW_DISTRLISTS +#include <libkdepim/distributionlist.h> +#endif + +#include <qobject.h> + +#include <kabc/field.h> +#include <kcommand.h> +#include <kxmlguiclient.h> +#include <kdepimmacros.h> + +namespace KABC { +class AddressBook; +class Resource; +} + +class QWidget; + +class KActionCollection; +class KConfig; +class KURL; + +namespace KAB { + +class SearchManager; + +class KDE_EXPORT Core : public QObject +{ + Q_OBJECT + + public: + Core( KXMLGUIClient *client, QObject *parent, const char *name = 0 ); + + /** + Returns a pointer to the StdAddressBook of the application. + */ + virtual KABC::AddressBook *addressBook() const = 0; + + /** + Returns a pointer to the KConfig object of the application. + */ + virtual KConfig *config() const = 0; + + /** + Returns a pointer to the global KActionCollection object. So + other classes can register their actions easily. + */ + virtual KActionCollection *actionCollection() const = 0; + + /** + Returns a pointer to the gui client. + */ + virtual KXMLGUIClient *guiClient() const { return mGUIClient; } + + /** + Returns the current sort field. + */ + virtual KABC::Field *currentSortField() const = 0; + + /** + Returns the uid list of the currently selected contacts. + */ + virtual QStringList selectedUIDs() const = 0; + + /** + Displays a ResourceSelectDialog and returns the selected + resource or a null pointer if no resource was selected by + the user. + */ + virtual KABC::Resource *requestResource( QWidget *parent ) = 0; + + /** + Returns the parent widget. + */ + virtual QWidget *widget() const = 0; + + /** + Deletes given contacts from the address book. + + @param uids The uids of the contacts, which shall be deleted. + */ + virtual void deleteContacts( const QStringList &uids ) = 0; + + /** + Deletes given contacts from the address book. + + @param uids The uids of the contacts, which shall be deleted. + */ + virtual void deleteDistributionLists( const QStringList &uids ) = 0; + +#ifdef KDEPIM_NEW_DISTRLISTS + /** + Returns all the distribution lists. + */ + virtual KPIM::DistributionList::List distributionLists() const = 0; + + + /** + Returns the name of all the distribution lists. + */ + virtual QStringList distributionListNames() const = 0; + + /** + sets the distribution list to display. If null, the regular + address book is to be displayed. + */ + virtual void setSelectedDistributionList( const QString &name ) = 0; +#endif + + //// This class isn't part of interfaces/, so this method here isn't really useful + virtual SearchManager *searchManager() const = 0; + + virtual KCommandHistory *commandHistory() const = 0; + + signals: + /** + Forwarded from SearchManager + After it is emitted, distributionListNames() might have a different result. + */ + void contactsUpdated(); + + public slots: + /** + Is called whenever a contact is selected in the view. + */ + virtual void setContactSelected( const QString &uid ) = 0; + + /** + DCOP METHOD: Adds the given email address to address book. + */ + virtual void addEmail( const QString& addr ) = 0; + + /** + DCOP METHOD: Imports the vCard, located at the given url. + */ + virtual void importVCard( const KURL& url ) = 0; + + /** + DCOP METHOD: Imports the given vCard. + */ + virtual void importVCardFromData( const QString& vCard ) = 0; + + /** + DCOP METHOD: Opens contact editor to input a new contact. + */ + virtual void newContact() = 0; + + /** + DCOP METHOD: Opens distribution list editor to input a new distribution list. + */ + virtual void newDistributionList() = 0; + + /** + DCOP METHOD: Returns the name of the contact, that matches the given + phone number. + */ + virtual QString getNameByPhone( const QString& phone ) = 0; + + /** + Shows an edit dialog for the given uid. + */ + virtual void editContact( const QString &uid = QString::null ) = 0; + + /** + Shows an edit dialog for the given distribution list + */ + virtual void editDistributionList( const QString &name ) = 0; + + private: + KXMLGUIClient *mGUIClient; +}; + +} + +#endif diff --git a/kaddressbook/interfaces/extensionwidget.cpp b/kaddressbook/interfaces/extensionwidget.cpp new file mode 100644 index 000000000..b70291583 --- /dev/null +++ b/kaddressbook/interfaces/extensionwidget.cpp @@ -0,0 +1,68 @@ +/* + This file is part of KAddressBook. + Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include "core.h" + +#include "extensionwidget.h" + +using namespace KAB; + +ExtensionWidget::ExtensionWidget( Core *core, QWidget *parent, + const char *name ) + : QWidget( parent, name ), mCore( core ) +{ +} + +ExtensionWidget::~ExtensionWidget() +{ +} + +KAB::Core *ExtensionWidget::core() const +{ + return mCore; +} + +bool ExtensionWidget::contactsSelected() const +{ + return mCore->selectedUIDs().count() != 0; +} + +KABC::Addressee::List ExtensionWidget::selectedContacts() +{ + KABC::Addressee::List list; + + const QStringList uids = mCore->selectedUIDs(); + QStringList::ConstIterator it; + const QStringList::ConstIterator endIt = uids.end(); + for ( it = uids.begin(); it != endIt; ++it ) + list.append( mCore->addressBook()->findByUid( *it ) ); + + return list; +} + +void ExtensionWidget::contactsSelectionChanged() +{ + // do nothing +} + +#include "extensionwidget.moc" diff --git a/kaddressbook/interfaces/extensionwidget.h b/kaddressbook/interfaces/extensionwidget.h new file mode 100644 index 000000000..076defad2 --- /dev/null +++ b/kaddressbook/interfaces/extensionwidget.h @@ -0,0 +1,120 @@ +/* + This file is part of KAddressBook. + Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#ifndef KAB_EXTENSIONWIDGET_H +#define KAB_EXTENSIONWIDGET_H + +#include <qwidget.h> + +#include <kabc/addressbook.h> +#include <klibloader.h> +#include <kdepimmacros.h> + +#define KAB_EXTENSIONWIDGET_PLUGIN_VERSION 1 + +namespace KAB { +class Core; +class ConfigureWidget; + +class KDE_EXPORT ExtensionWidget : public QWidget +{ + Q_OBJECT + + public: + ExtensionWidget( Core *core, QWidget *parent, const char *name = 0 ); + ~ExtensionWidget(); + + /** + @return A pointer to the core object + */ + KAB::Core *core() const; + + /** + Returns whether there are selected contacts in the view. + */ + bool contactsSelected() const; + + /** + Returns a list of contacts that are selected in the view. + Use @ref addresseesSelected() to test if there exists selected + contacts. + */ + KABC::Addressee::List selectedContacts(); + + /** + This method is called whenever the selection in the view changed. + */ + virtual void contactsSelectionChanged(); + + /** + This method should be reimplemented and return the i18ned title of this + widget. + */ + virtual QString title() const = 0; + + /** + This method should be reimplemented and return a unique identifier. + */ + virtual QString identifier() const = 0; + + signals: + void modified( const KABC::Addressee::List &list ); + void deleted( const QStringList& uidList ); + + private: + KAB::Core *mCore; + + class ExtensionWidgetPrivate; + ExtensionWidgetPrivate *d; +}; + +class ExtensionFactory : public KLibFactory +{ + public: + virtual ExtensionWidget *extension( KAB::Core *core, QWidget *parent, + const char *name = 0 ) = 0; + + virtual ConfigureWidget *configureWidget( QWidget*, const char* = 0 ) + { + return 0; + } + + virtual bool configureWidgetAvailable() { return false; } + + /** + This method should return the same identifier like the config + widget. + */ + virtual QString identifier() const = 0; + + protected: + virtual QObject* createObject( QObject*, const char*, const char*, + const QStringList & ) + { + return 0; + } +}; + +} + +#endif diff --git a/kaddressbook/interfaces/kaddressbook_contacteditorwidget.desktop b/kaddressbook/interfaces/kaddressbook_contacteditorwidget.desktop new file mode 100644 index 000000000..bb646e78c --- /dev/null +++ b/kaddressbook/interfaces/kaddressbook_contacteditorwidget.desktop @@ -0,0 +1,55 @@ +[Desktop Entry] +Type=ServiceType +X-KDE-ServiceType=KAddressBook/ContactEditorWidget +Comment=KAddressBook Contact Editor Widget Plugin +Comment[af]=KAddressBook kontak redigeerder inprop module +Comment[bg]=Приставка за редактиране на контактите от адресника +Comment[bs]=KAddressBook dodatak za prozor za izmjenu kontakta +Comment[ca]=Endollable de l'estri editor de contactes de la llibreta d'adreces +Comment[cs]=Modul widgetu editoru kontaktů KAddressBook +Comment[da]=KAddressBook plugin til kontakteditorkontrol +Comment[de]=Adressbuch Kontakteditor-Modul +Comment[el]=Πρόσθετο επεξεργασίας επαφής του KAddressBook +Comment[eo]=Kromaĵo por KAddressBook Kontaktredaktila Fenestraĵo +Comment[es]=Accesorio de elemento de editor de contactos para KAddressBook +Comment[et]=KDE aadressiraamatu kontaktide redigeerimise plugin +Comment[eu]=KAddressBook-en kontaktu editore trepetaren plugin-a +Comment[fa]=وصلۀ عنصر ویرایشگر تماس KAddressBook +Comment[fi]=Osoitekirjan yhteystietojen muokkainliitännäinen +Comment[fr]=Module d'édition de contacts de KAddressBook +Comment[fy]=KAddressBook Kontaktbewurker-plugin +Comment[gl]=Extensión Editor de Contactos para KAddressBook +Comment[he]=תוסף תצוגה עבור עורך אנשי קשר של פנקס הכתובות +Comment[hu]=KAddressBook névjegyszerkesztő bővítőmodul +Comment[is]=KAddressbook tengiliðaritils íforrit +Comment[it]=Plugin editor dei contatti di KAddressbook +Comment[ja]=KAddressbook 連絡先エディタ ウィジェット プラグイン +Comment[ka]= KDE-ს წიგნაკის კონტაქტთა რედაქტირების ელემენტის მოდული +Comment[kk]=Адрестік кітапшаның контактты өңдеу модулі +Comment[km]=កម្មវិធីជំនួយធាតុក្រាហ្វិកកម្មវិធីនិពន្ធទំនាក់ទំនងរបស់ KAddressBook +Comment[lt]=KAddressBook kontaktų redaktoriaus valdiklių priedas +Comment[mk]=Приклучок за уредување контакти во КАдресар +Comment[ms]=Plugin Widget Editor Orang Hubungan KAddressBook +Comment[nb]=KAddressbook programtillegg for kontakt redigeringselement +Comment[nds]=Editormoduul för KAdressbook-Kontakten +Comment[ne]=केडीई ठेगाना पुस्तिका सम्पर्क सम्पादक विजेट प्लगइन +Comment[nl]=KAddressBook Contacteditor-plugin +Comment[nn]=Programtillegg for kontaktredigering i KDE-adresseboka +Comment[pl]=Wtyczka okna edycji wizytówki dla KAddressBook +Comment[pt]='Plugin' de Edição de 'Widgets' de Contacto do KAddressbook +Comment[pt_BR]=Plug-in do Editor de Contatos do KAddressBook +Comment[ru]=Редактор контакта адресной книги KDE +Comment[sk]=KAddressBook modul pre editor kontaktov +Comment[sl]=Vstavek gradnika urejevalnika stikov za Adresar +Comment[sr]=KAddressBook прикључак контроле едитора контаката +Comment[sr@Latn]=KAddressBook priključak kontrole editora kontakata +Comment[sv]=Kadressbok-insticksprogram för kontakteditor +Comment[ta]=கேமுகவரிபுத்தகம் தொடர்பு தொகுப்பான் சாளர சொருகுப்பொருள் +Comment[tg]=Муҳаррири алоқоти китоби адресии KDE +Comment[tr]=Adres Defteri Kişi Düzenleyici Parçacık Eklentisi +Comment[uk]=Втулок редагування контактів адресної книги +Comment[zh_CN]=KAddressBook 联系人编辑部件插件 +Comment[zh_TW]=KAddressBook 聯絡人編輯器外掛程式 + +[PropertyDef::X-KDE-KAddressBook-CEWPluginVersion] +Type=int diff --git a/kaddressbook/interfaces/kaddressbook_extension.desktop b/kaddressbook/interfaces/kaddressbook_extension.desktop new file mode 100644 index 000000000..55be3b71e --- /dev/null +++ b/kaddressbook/interfaces/kaddressbook_extension.desktop @@ -0,0 +1,59 @@ +[Desktop Entry] +Type=ServiceType +X-KDE-ServiceType=KAddressBook/Extension +Comment=KAddressBook Extension Plugin +Comment[af]=KAddressBook uitbrei inprop module +Comment[be]=Дапаўненне K Адраснай кнігі "Пашырэнне" +Comment[bg]=Приставка-разширение за адресника +Comment[bs]=KAddressBook dodatak proširenja +Comment[ca]=Endollable Extension per al KAddressBook +Comment[cs]=Rozšiřující modul pro Knihu adres +Comment[cy]=Ategyn Estyniad KLlyfrCyfeiriadau +Comment[da]=KAddressBook udvidelsesplugin +Comment[de]=Erweiterungsmodul für Adressbuch +Comment[el]=Πρόσθετο επέκτασης του KAddressBook +Comment[eo]=KAddressBook Etendiga Kromaĵo +Comment[es]=Plugin de extensión de KAddressBook +Comment[et]=KDE aadressiraamatu laiendi plugin +Comment[eu]=KAddressBook-en luzapen plugin-a +Comment[fa]=وصلۀ پسوند KAddressBook +Comment[fi]=KAddressbookin laajennusliitännäinen +Comment[fr]=Module d'extension pour KAddressBook +Comment[fy]=KAddressBook taheaksel plugin +Comment[gl]=Engadido de Extensión para KAddressBook +Comment[he]=תוסף הרחבה עבור פנקס הכתובות +Comment[hi]=के-एड्रेस-बुक विस्तार प्लगइन +Comment[hu]=KAddressBook kiegészítő modul +Comment[is]=KAddressbook viðbótar íforrit +Comment[it]=Plugin estensione di KAddressbook +Comment[ja]=KAddressbook 拡張プラグイン +Comment[ka]=KDE წიგნაკის გაფართოების მოდული +Comment[kk]=KAddressBook кеңейту модулі +Comment[km]=កម្មវិធីជំនួយផ្នែកបន្ថែមរបស់ KAddressBook +Comment[lt]=KAddressBook praplėtimo priedas +Comment[mk]=Приклучок за екстензии во КАдресар +Comment[ms]=Plug masuk Sambungan KAddressBook +Comment[nb]=KAddressbook-programtillegg for utvidelser +Comment[nds]=Verwiedernmodüul för KAdressbook +Comment[ne]=केडीई ठेगाना पुस्तिका विस्तार प्लगइन +Comment[nl]=KAddressBook Extensie Plugin +Comment[nn]=Programtillegg for utviding av KDE-adresseboka +Comment[pl]=Wtyczka rozszerzenia dla KAddressBook +Comment[pt]='Plugin' de Extensão do KAddressbook +Comment[pt_BR]=Plug-in de Extensão do KAddressBook +Comment[ro]=Modul de extensie KAddressBook +Comment[ru]=Расширение адресной книги KDE +Comment[sk]=KAddressBook plugin rozšírení +Comment[sl]=Razširitveni vstavek za Adresar +Comment[sr]=Прикључак KAddressBook-а за проширења +Comment[sr@Latn]=Priključak KAddressBook-a za proširenja +Comment[sv]=Kadressbok-utökningsinsticksprogram +Comment[ta]=கேமுகவரிப்புத்தகம் விரிவாக்க சொருகுப்பொருள் +Comment[tg]=Модули вусъатоти китоби адресии KDE +Comment[tr]=KAdresDefteri Uzantı Eklentisi +Comment[uk]=Втулок розширення адресної книги KAddressBook +Comment[zh_CN]=KAddressBook 扩展插件 +Comment[zh_TW]=KAddressBook 延伸外掛程式 + +[PropertyDef::X-KDE-KAddressBook-ExtensionPluginVersion] +Type=int diff --git a/kaddressbook/interfaces/kaddressbook_xxport.desktop b/kaddressbook/interfaces/kaddressbook_xxport.desktop new file mode 100644 index 000000000..fb2b03d0d --- /dev/null +++ b/kaddressbook/interfaces/kaddressbook_xxport.desktop @@ -0,0 +1,62 @@ +[Desktop Entry] +Type=ServiceType +X-KDE-ServiceType=KAddressBook/XXPort +Comment=KAddressBook Import/Export Plugin +Comment[af]=KAddressBook Invoer/Uitvoer inprop module +Comment[be]=Дапаўненне K Адраснай кнігі "Імпарт/Экспарт" +Comment[bg]=Приставка за импортиране/експортиране на данни от адресника +Comment[br]=Lugent enporzh/ezporzh evit KAddressBook +Comment[bs]=KAddressBook dodatak za uvoz/izvoz +Comment[ca]=Endollable d'importació/exportació per a la llibreta d'adreces +Comment[cs]=Modul knihy adres pro import/export +Comment[cy]=Ategyn Mewnforio/Allforio KLlyfrCyfeiriadau +Comment[da]=KAddressBook Import/Eksport-plugin +Comment[de]=Import/Export-Modul für Adressbuch +Comment[el]=Πρόσθετο εισαγωγής/εξαγωγής του KAddressBook +Comment[eo]=KAddressBook Import-/Eksport-Kromaĵo +Comment[es]=Plugin para importar/exportar en KAddressBook +Comment[et]=KDE aadressiraamatu import/eksportplugin +Comment[eu]=KAddressBook-en inportazio/esportazio plugin-a +Comment[fa]=وصلۀ صادرات/واردات KAddressBook +Comment[fi]=KAddressbookin tuonti/vienti-liitännäinen +Comment[fr]=Module d'import / export pour KAddressBook +Comment[fy]=KAddressBook Ymport/Eksport Plugin +Comment[gl]=Extensión de Importación/Exportación para KAddressBook +Comment[he]=תוסף ייבוא/יצוא עבור פנקס הכתובות +Comment[hi]=के-एड्रेस-बुक आयात/निर्यात प्लगइन +Comment[hu]=KAddressBook importálási/exportálási bővítőmodul +Comment[is]=KAddressbook flytja inn/út íforrit +Comment[it]=Plugin importa/esporta di KAddressbook +Comment[ja]=KAddressbook インポート/エクスポートプラグイン +Comment[ka]=წიგნაკის იმპორტ/ექსპორტის მოდული +Comment[kk]=KAddressBook импорт/экспорт модулі +Comment[km]=កម្មវិធីជំនួយនាំចូល/នាំចេញរបស់ KAddressBook +Comment[lt]=KAddressBook importo/eksporto priedas +Comment[mk]=Приклучок за внесување/изнесување во КАдресар +Comment[ms]=Plug masuk Import Eksport KAddressBook +Comment[nb]=KAddressbook-programtillegg for import/eksport +Comment[nds]=Import-/Exportmoduul för KAdressbook +Comment[ne]=केडीई ठेगाना पुस्तिका आयात/निर्यात प्लगइन +Comment[nn]=Programtillegg for importering/ekportering i KDE-adresseboka +Comment[pl]=Wtyczka importu/eksportu dla KAddressBook +Comment[pt]='Plugin' de Importação/Exportação do KAddressbook +Comment[pt_BR]=Plug-in de Importação/Exportação do KAddressBook +Comment[ro]=Modul de import/export pentru KAddressBook +Comment[ru]=Экспорт и импорт адресной книги +Comment[sk]=KAddressBook import/export plugin +Comment[sl]=Vstavek za uvoz in izvoz iz Adresarja +Comment[sr]=Прикључак KAddressBook-а за увоз/извоз +Comment[sr@Latn]=Priključak KAddressBook-a za uvoz/izvoz +Comment[sv]=Kadressbok-insticksprogram för import/export +Comment[ta]=கேமுகவரிப்புத்தகம் ஏற்றுமதி/இறக்குமதி சொருகுப்பொருள் +Comment[tg]=Содирот ва воридоти китоби адрес +Comment[tr]=KAdresDefteri Al/Gönder Eklentisi +Comment[uk]=Втулок імпорту/експорту адресної книги KAddressBook +Comment[uz]=Manzillar daftari uchun import/eksport plagini +Comment[uz@cyrillic]=Манзиллар дафтари учун импорт/экспорт плагини +Comment[zh_CN]=KAddressBook 导入/导出插件 +Comment[zh_TW]=KAddressBook 匯入/匯出外掛程式 + +[PropertyDef::X-KDE-KAddressBook-XXPortPluginVersion] +Type=int + diff --git a/kaddressbook/interfaces/xxport.cpp b/kaddressbook/interfaces/xxport.cpp new file mode 100644 index 000000000..0e9e515c2 --- /dev/null +++ b/kaddressbook/interfaces/xxport.cpp @@ -0,0 +1,128 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <qmap.h> +#include <qsignalmapper.h> + +#include <kaction.h> +#include <kinstance.h> +#include <kmessagebox.h> +#include <kapplication.h> +#include "xxport.h" + +using namespace KAB; + +class XXPort::XXPortPrivate +{ + public: + QSignalMapper *mExportMapper; + QSignalMapper *mImportMapper; + KApplication *mKApp; +}; + +XXPort::XXPort( KABC::AddressBook *ab, QWidget *parent, + const char *name ) + : QObject( parent, name ), mAddressBook( ab ), mParentWidget( parent ), + d( new XXPortPrivate ) +{ + setInstance( new KInstance( "kaddressbook" ) ); + + d->mExportMapper = new QSignalMapper( this ); + d->mImportMapper = new QSignalMapper( this ); + + connect( d->mExportMapper, SIGNAL( mapped( const QString& ) ), + SLOT( slotExportActivated( const QString& ) ) ); + connect( d->mImportMapper, SIGNAL( mapped( const QString& ) ), + SLOT( slotImportActivated( const QString& ) ) ); +} + +XXPort::~XXPort() +{ + delete d; + d = 0; +} + +bool XXPort::exportContacts( const KABC::AddresseeList&, const QString& ) +{ + // do nothing + return false; +} + +KABC::AddresseeList XXPort::importContacts( const QString& ) const +{ + // do nothing + return KABC::AddresseeList(); +} + +void XXPort::createImportAction( const QString &label, const QString &data ) +{ + QString id = "file_import_" + identifier() + ( data.isEmpty() ? QString( "" ) : "_" + data ); + KAction *action = new KAction( label, 0, d->mImportMapper, SLOT( map() ), actionCollection(), id.latin1() ); + + d->mImportMapper->setMapping( action, ( data.isEmpty() ? QString( "<empty>" ) : data ) ); + + setXMLFile( identifier() + "_xxportui.rc" ); +} + +void XXPort::createExportAction( const QString &label, const QString &data ) +{ + QString id = "file_export_" + identifier() + ( data.isEmpty() ? QString( "" ) : "_" + data ); + KAction *action = new KAction( label, 0, d->mExportMapper, SLOT( map() ), actionCollection(), id.latin1() ); + + d->mExportMapper->setMapping( action, ( data.isEmpty() ? QString( "<empty>" ) : data ) ); + + setXMLFile( identifier() + "_xxportui.rc" ); +} + +KABC::AddressBook *XXPort::addressBook() const +{ + return mAddressBook; +} + +QWidget *XXPort::parentWidget() const +{ + return mParentWidget; +} + +void XXPort::setKApplication( KApplication *app ) +{ + d->mKApp = app; +} + +void XXPort::processEvents() const +{ + if ( d->mKApp ) + d->mKApp->processEvents(); +} + +void XXPort::slotExportActivated( const QString &data ) +{ + emit exportActivated( identifier(), ( data == "<empty>" ? QString::null : data ) ); +} + +void XXPort::slotImportActivated( const QString &data ) +{ + emit importActivated( identifier(), ( data == "<empty>" ? QString::null : data ) ); +} + +#include "xxport.moc" diff --git a/kaddressbook/interfaces/xxport.h b/kaddressbook/interfaces/xxport.h new file mode 100644 index 000000000..098688b94 --- /dev/null +++ b/kaddressbook/interfaces/xxport.h @@ -0,0 +1,179 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#ifndef KAB_XXPORT_H +#define KAB_XXPORT_H + +#include <qobject.h> + +#include <kabc/addressbook.h> +#include <kabc/addresseelist.h> +#include <klibloader.h> +#include <kxmlguiclient.h> +#include <kdepimmacros.h> + +#define KAB_XXPORT_PLUGIN_VERSION 1 + +class KApplication; + +/** + K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG() creates the stub for a KAddressbook import/export filter. + @libname filename of the shared library, e.g. libkaddrbk_bookmark_xxport + @XXPortClass the import/export class - derived from the XXPort class + @catalog catalog file to search for translation lookup (NULL if no catalog needed) + @see: K_EXPORT_COMPONENT_FACTORY() + */ +#define K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, catalog ) \ + class KDE_NO_EXPORT localXXPortFactory : public KAB::XXPortFactory { \ + KAB::XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name ) \ + { const char *cat = catalog; \ + if (cat) KGlobal::locale()->insertCatalogue(cat); \ + return new XXPortClass( ab, parent, name ); \ + } \ + }; \ + K_EXPORT_COMPONENT_FACTORY( libname, localXXPortFactory ) + +/** + K_EXPORT_KADDRESSBOOK_XXFILTER() creates the stub for a KAddressbook import/export filter. + @libname filename of the shared library, e.g. libkaddrbk_bookmark_xxport + @XXPortClass the import/export class - derived from the XXPort class + @see: K_EXPORT_COMPONENT_FACTORY() + */ +#define K_EXPORT_KADDRESSBOOK_XXFILTER( libname, XXPortClass ) \ + K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, NULL ) + + +namespace KAB { + +class KDE_EXPORT XXPort : public QObject, virtual public KXMLGUIClient +{ + Q_OBJECT + + public: + XXPort( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); + ~XXPort(); + + /** + Returns the unique identifier of this xxport modul, it should + be the lowercase name of the import/export format e.g. 'vcard' + */ + virtual QString identifier() const = 0; + + /** + Reimplement this method if the XXPortManager shall + pass a sorted list to @ref exportContacts(). + */ + virtual bool requiresSorting() const { return false; } + + /** + set the KApplication pointer. + @see: processEvents() + */ + void setKApplication( KApplication *app ); + + /** + Processes outstanding KApplication events. It should be called + occasionally when the import/export filter is busy performing + a long operation (e.g. reading from slow external devices). + @see: QApplication::processEvents() + */ + void processEvents() const; + + public slots: + /** + Reimplement this method for exporting the contacts. + */ + virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier ); + + /** + Reimplement this method for importing the contacts. + */ + virtual KABC::AddresseeList importContacts( const QString& identifier ) const; + + signals: + /** + Emitted whenever the export action is activated. + The parameter contains the @ref identifier() for + unique identification. + */ + void exportActivated( const QString&, const QString& ); + + /** + Emitted whenever the import action is activated. + The parameter contains the @ref identifier() for + unique identification. + */ + void importActivated( const QString&, const QString& ); + + protected: + /** + Create the import action. The identifier is passed in the import slot. + */ + void createImportAction( const QString &label, const QString &identifier = QString::null ); + + /** + Create the export action. The identifier is passed in the export slot. + */ + void createExportAction( const QString &label, const QString &identifier = QString::null ); + + /** + Returns a pointer to the address book object. + */ + KABC::AddressBook *addressBook() const; + + /** + Returns a pointer to the parent widget. It can be used as parent for + message boxes. + */ + QWidget *parentWidget() const; + + private slots: + void slotImportActivated( const QString& ); + void slotExportActivated( const QString& ); + + private: + KABC::AddressBook *mAddressBook; + QWidget *mParentWidget; + + class XXPortPrivate; + XXPortPrivate *d; +}; + +class XXPortFactory : public KLibFactory +{ + public: + virtual XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent, + const char *name = 0 ) = 0; + + protected: + virtual QObject* createObject( QObject*, const char*, const char*, + const QStringList & ) + { + return 0; + } +}; + + +} /* namespace KAB */ + +#endif |