Commit fa0d4ad8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Move plugins in specific application. It will help us to split it in the future

parent 86ccc05d
......@@ -205,3 +205,5 @@ install(FILES
install(FILES data/kaddressbook_themes.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} )
install(DIRECTORY printing/grantlee/themes/ DESTINATION ${KDE_INSTALL_DATADIR}/kaddressbook/printing/themes/ )
add_subdirectory(kontactplugin)
include_directories(${CMAKE_SOURCE_DIR}/kaddressbook)
set(kontact_kaddressbookplugin_PART_SRCS
kaddressbook_plugin.cpp
)
qt5_add_dbus_interfaces(kontact_kaddressbookplugin_PART_SRCS ${CMAKE_SOURCE_DIR}/kaddressbook/org.kde.kaddressbook.xml)
add_library(kontact_kaddressbookplugin MODULE ${kontact_kaddressbookplugin_PART_SRCS})
target_link_libraries(kontact_kaddressbookplugin KF5::KontactInterface)
install(TARGETS kontact_kaddressbookplugin DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(FILES kaddressbookplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/kontact)
install(FILES kaddressbook.setdlg DESTINATION ${KDE_INSTALL_DATADIR}/kontact/ksettingsdialog)
[KAddressBook]
Name=Contacts
Name[af]=Kontakte
Name[ar]=جهات الإتصال
Name[be]=Кантакты
Name[bg]=Contacts
Name[br]=Darempredoù
Name[bs]=Kontakti
Name[ca]=Contactes
Name[ca@valencia]=Contactes
Name[cs]=Kontakty
Name[cy]=Cysylltau
Name[da]=Kontakter
Name[de]=Kontakte
Name[el]=Επαφές
Name[en_GB]=Contacts
Name[eo]=Kontaktoj
Name[es]=Contactos
Name[et]=Kontaktid
Name[eu]=Kontaktuak
Name[fa]=تماسها
Name[fi]=Yhteystiedot
Name[fr]=Contacts
Name[fy]=Adressen
Name[ga]=Teagmhálacha
Name[gl]=Contactos
Name[he]=אנשי קשר
Name[hu]=Névjegyek
Name[ia]=Contactos
Name[is]=Tengiliðir
Name[it]=Contatti
Name[ja]=連絡先
Name[ka]=კონტაქტები
Name[kk]=Контакттар
Name[km]=ទំនាក់ទំនង
Name[ko]=연락처
Name[lt]=Kontaktai
Name[lv]=Kontakti
Name[mai]=संपर्क
Name[mk]=Контакти
Name[mr]=संपर्क
Name[ms]=Orang hubungan
Name[nb]=Contacts
Name[nds]=Kontakten
Name[ne]=सम्पर्क
Name[nl]=Adressen
Name[nn]=Kontaktar
Name[pa]=ਸੰਪਰਕ
Name[pl]=Wizytówki
Name[pt]=Contactos
Name[pt_BR]=Contatos
Name[ro]=Contacte
Name[ru]=Контакты
Name[se]=Oktavuođat
Name[sk]=Kontakty
Name[sl]=Stiki
Name[sr]=Контакти
Name[sr@ijekavian]=Контакти
Name[sr@ijekavianlatin]=Kontakti
Name[sr@latin]=Kontakti
Name[sv]=Kontakter
Name[ta]=தொடர்புகள்
Name[tg]=Алоқот
Name[th]=ที่อยู่ติดต่อ
Name[tr]=Kişiler
Name[ug]=ئالاقەداشلار
Name[uk]=Контакти
Name[uz]=Aloqalar
Name[uz@cyrillic]=Алоқалар
Name[wa]=Contaks
Name[x-test]=xxContactsxx
Name[zh_CN]=联系人
Name[zh_TW]=聯絡人
Comment=Address Book Component
Comment[af]=Adres boek komponent
Comment[ar]=مكون دفتر العناوين
Comment[bg]=Модул за адресника
Comment[bs]=Komponenta knjige adresa
Comment[ca]=Component de llibreta d'adreces
Comment[ca@valencia]=Component de llibreta d'adreces
Comment[cs]=Komponenta knihy adres
Comment[da]=Adressebogskomponent
Comment[de]=Adressbuch-Komponente
Comment[el]=Συστατικό βιβλίου διευθύνσεων
Comment[en_GB]=Address Book Component
Comment[eo]=Adreslibra Komponanto
Comment[es]=Componente de la libreta de direcciones
Comment[et]=Aadressiraamatu komponent
Comment[eu]=Helbide-liburu osagaia
Comment[fa]=مؤلفه کتاب نشانی
Comment[fi]=Osoitekirja
Comment[fr]=Composant de carnet d'adresses
Comment[fy]=Adresboekkomponint
Comment[ga]=Comhpháirt Leabhair Seoltaí
Comment[gl]=Compoñente do Caderno de Enderezos
Comment[he]=רכיב פנקס כתובות
Comment[hu]=Címjegyzék-komponens
Comment[ia]=Componente de adressario
Comment[is]=Vistfangahluti
Comment[it]=Componente rubrica indirizzi
Comment[ja]=アドレス帳コンポーネント
Comment[ka]=წიგნაკის კომპონენტი
Comment[kk]=Адрестік кітапша компоненті
Comment[km]=សមាសភាគ​សៀវភៅ​អាសយដ្ឋាន
Comment[ko]=주소록 구성 요소
Comment[lt]=Adresų knygelės komponentas
Comment[lv]=Adrešu grāmatas komponente
Comment[mk]=Компонента за адресар
Comment[mr]=पत्ता पुस्तक घटक
Comment[ms]=Komponen Buku Alamat
Comment[nb]=Adressebok-komponent
Comment[nds]=Adressbook-Komponent
Comment[ne]=ठेगाना पुस्तिका अवयव
Comment[nl]=Adresboekcomponent
Comment[nn]=Adressebok-komponent
Comment[pa]=ਐਡਰੈੱਸ ਬੁੱਕ ਭਾਗ
Comment[pl]=Składnik książki adresowej
Comment[pt]=Componente de Livro de Endereços
Comment[pt_BR]=Componente de Livro de endereços
Comment[ro]=Componentă pentru Carte de adrese
Comment[ru]=Компонент «Адресная книга»
Comment[sk]=Komponent adresára
Comment[sl]=Komponenta za adresar
Comment[sr]=Компонента адресара
Comment[sr@ijekavian]=Компонента адресара
Comment[sr@ijekavianlatin]=Komponenta adresara
Comment[sr@latin]=Komponenta adresara
Comment[sv]=Adressbokskomponent
Comment[ta]=முகவரிப்புத்தக பகுதி
Comment[tr]=Adres Defteri Bileşeni
Comment[uk]=Компонент адресної книги
Comment[wa]=Componint calpin d' adresses
Comment[x-test]=xxAddress Book Componentxx
Comment[zh_CN]=地址簿组件
Comment[zh_TW]=通訊錄元件
Weight=300
Icon=kaddressbook
/*
This file is part of KAddressBook Kontact Plugin.
Copyright (c) 2009-2015 Laurent Montel <montel@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.
*/
#include "kaddressbook_plugin.h"
#include "kaddressbook_options.h"
#include "kaddressbookinterface.h"
#include <KontactInterface/Core>
#include <QAction>
#include <KActionCollection>
#include <KCmdLineArgs>
#include <QDebug>
#include <KLocalizedString>
#include <QIcon>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusReply>
#include <QStandardPaths>
EXPORT_KONTACT_PLUGIN(KAddressBookPlugin, kaddressbook)
KAddressBookPlugin::KAddressBookPlugin(KontactInterface::Core *core, const QVariantList &)
: KontactInterface::Plugin(core, core, "kaddressbook")
{
#pragma message("port QT5")
//QT5 setComponentData( KontactPluginFactory::componentData() );
QAction *action =
new QAction(QIcon::fromTheme(QStringLiteral("contact-new")),
i18nc("@action:inmenu", "New Contact..."), this);
actionCollection()->addAction(QStringLiteral("new_contact"), action);
connect(action, &QAction::triggered, this, &KAddressBookPlugin::slotNewContact);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
//action->setHelpText(
// i18nc( "@info:status", "Create a new contact" ) );
action->setWhatsThis(
i18nc("@info:whatsthis",
"You will be presented with a dialog where you can create a new contact."));
insertNewAction(action);
action =
new QAction(QIcon::fromTheme(QStringLiteral("user-group-new")),
i18nc("@action:inmenu", "New Contact Group..."), this);
actionCollection()->addAction(QStringLiteral("new_contactgroup"), action);
connect(action, &QAction::triggered, this, &KAddressBookPlugin::slotNewContactGroup);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G));
//action->setHelpText(
// i18nc( "@info:status", "Create a new contact group" ) );
action->setWhatsThis(
i18nc("@info:whatsthis",
"You will be presented with a dialog where you can create a new contact group."));
insertNewAction(action);
QAction *syncAction =
new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")),
i18nc("@action:inmenu", "Sync Contacts"), this);
actionCollection()->addAction(QStringLiteral("kaddressbook_sync"), syncAction);
connect(syncAction, &QAction::triggered, this, &KAddressBookPlugin::slotSyncContacts);
//syncAction->setHelpText(
// i18nc( "@info:status", "Synchronize groupware contacts" ) );
syncAction->setWhatsThis(
i18nc("@info:whatsthis",
"Choose this option to synchronize your groupware contacts."));
insertSyncAction(syncAction);
mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher(
new KontactInterface::UniqueAppHandlerFactory<KAddressBookUniqueAppHandler>(), this);
}
KAddressBookPlugin::~KAddressBookPlugin()
{
}
void KAddressBookPlugin::slotNewContact()
{
KParts::ReadOnlyPart *part = createPart();
if (!part) {
return;
}
if (part->metaObject()->indexOfMethod("newContact()") == -1) {
qWarning() << "KAddressBook part is missing slot newContact()";
return;
}
QMetaObject::invokeMethod(part, "newContact");
}
void KAddressBookPlugin::slotNewContactGroup()
{
KParts::ReadOnlyPart *part = createPart();
if (!part) {
return;
}
if (part->metaObject()->indexOfMethod("newGroup()") == -1) {
qWarning() << "KAddressBook part is missing slot newGroup()";
return;
}
QMetaObject::invokeMethod(part, "newGroup");
}
QString KAddressBookPlugin::tipFile() const
{
// TODO: tips file
//QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kaddressbook/tips");
QString file;
return file;
}
KParts::ReadOnlyPart *KAddressBookPlugin::createPart()
{
KParts::ReadOnlyPart *part = loadPart();
if (!part) {
return Q_NULLPTR;
}
// disable the Ctrl+N shortcut, as it is used by Kontact already
if (part->action("akonadi_contact_create")) {
QAction *newAction = qobject_cast<QAction *>(part->action("akonadi_contact_create"));
if (newAction) {
newAction->setShortcut(QKeySequence());
}
}
return part;
}
bool KAddressBookPlugin::isRunningStandalone() const
{
return mUniqueAppWatcher->isRunningStandalone();
}
QStringList KAddressBookPlugin::invisibleToolbarActions() const
{
QStringList actions;
actions << QStringLiteral("akonadi_contact_create") << QStringLiteral("akonadi_contact_group_create");
return actions;
}
void KAddressBookPlugin::shortcutChanged()
{
KParts::ReadOnlyPart *localPart = part();
if (localPart) {
if (localPart->metaObject()->indexOfMethod("updateQuickSearchText()") == -1) {
qWarning() << "KAddressBook part is missing slot updateQuickSearchText()";
return;
}
QMetaObject::invokeMethod(localPart, "updateQuickSearchText");
}
}
void KAddressBookPlugin::slotSyncContacts()
{
#if 0
QDBusMessage message =
QDBusMessage::createMethodCall("org.kde.kmail", "/Groupware",
"org.kde.kmail.groupware",
"triggerSync");
message << QString("Contact");
QDBusConnection::sessionBus().send(message);
#else
qWarning() << QStringLiteral(" Need to port to AKONADI: KAddressBookPlugin::slotSyncNotes");
#endif
}
void KAddressBookUniqueAppHandler::loadCommandLineOptions()
{
KCmdLineArgs::addCmdLineOptions(kaddressbook_options());
}
int KAddressBookUniqueAppHandler::newInstance()
{
// Ensure part is loaded
(void)plugin()->part();
org::kde::kaddressbook kaddressbook(QStringLiteral("org.kde.kaddressbook"), QStringLiteral("/KAddressBook"), QDBusConnection::sessionBus());
QDBusReply<bool> reply = kaddressbook.handleCommandLine();
return KontactInterface::UniqueAppHandler::newInstance();
}
#include "kaddressbook_plugin.moc"
/*
This file is part of KAddressBook Kontact Plugin.
Copyright (c) 2009-2015 Laurent Montel <montel@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.
*/
#ifndef KADDRESSBOOK_PLUGIN_H
#define KADDRESSBOOK_PLUGIN_H
#include <KontactInterface/UniqueAppHandler>
namespace KontactInterface
{
class Plugin;
}
class KAddressBookUniqueAppHandler : public KontactInterface::UniqueAppHandler
{
public:
explicit KAddressBookUniqueAppHandler(KontactInterface::Plugin *plugin)
: KontactInterface::UniqueAppHandler(plugin) {}
void loadCommandLineOptions() Q_DECL_OVERRIDE;
int newInstance() Q_DECL_OVERRIDE;
};
class KAddressBookPlugin : public KontactInterface::Plugin
{
Q_OBJECT
public:
KAddressBookPlugin(KontactInterface::Core *core, const QVariantList &);
~KAddressBookPlugin();
QString tipFile() const Q_DECL_OVERRIDE;
bool isRunningStandalone() const Q_DECL_OVERRIDE;
int weight() const Q_DECL_OVERRIDE
{
return 300;
}
QStringList invisibleToolbarActions() const Q_DECL_OVERRIDE;
void shortcutChanged() Q_DECL_OVERRIDE;
protected:
KParts::ReadOnlyPart *createPart() Q_DECL_OVERRIDE;
private Q_SLOTS:
void slotNewContact();
void slotNewContactGroup();
void slotSyncContacts();
private:
KontactInterface::UniqueAppWatcher *mUniqueAppWatcher;
};
#endif
[Desktop Entry]
Type=Service
Icon=kaddressbook
X-KDE-ServiceTypes=Kontact/Plugin,KPluginInfo
X-KDE-Library=kontact_kaddressbookplugin
X-KDE-KontactPluginVersion=10
X-KDE-KontactPartLibraryName=kaddressbookpart
X-KDE-KontactPartExecutableName=kaddressbook
X-KDE-KontactPartLoadOnStart=false
X-KDE-KontactPluginHasSummary=false
X-KDE-PluginInfo-Name=kontact_kaddressbookplugin
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-PluginInfo-AllowEmptySettings=true
Comment=Kontact KAddressBook Plugin
Comment[af]=Kontact adresboek inprop module
Comment[ar]=ملحق دفتر عناوين Kontact
Comment[be]=Утулка Kontact KAddressBook
Comment[bg]=Приставка за адресника
Comment[br]=Lugent Kontact KAddressBook
Comment[bs]=Kontact KAddressBook dodatak
Comment[ca]=Connector de la llibreta d'adreces pel Kontact
Comment[ca@valencia]=Connector de la llibreta d'adreces per a Kontact
Comment[cs]=Modul Knihy adres pro Kontact
Comment[cy]=Ategyn KLlyfrCyfeiriadau Kontact
Comment[da]=Kontact KAddressbook-plugin
Comment[de]=Adressbuch-Modul für Kontact
Comment[el]=Πρόσθετο KAddressBook του Kontact
Comment[en_GB]=Kontact KAddressBook Plugin
Comment[es]=Complemento de KAddressBook para Kontact
Comment[et]=Kontacti KDE aadressiraamatu plugin
Comment[eu]=Kontact-en KAddressBook plugin-a
Comment[fa]=وصله کتاب نشانی Kontact
Comment[fi]=Kontactin KAddressBook-liitännäinen
Comment[fr]=Module KAddressBook pour Kontact
Comment[fy]=Kontact KAddressBook-plugin
Comment[ga]=Breiseán KAddressBook Kontact
Comment[gl]=Engadido do KAddressBook para o Kontact
Comment[hu]=Kontact-bővítőmodul a KAddressbookhoz
Comment[ia]=Plug-in pro Kontact KAddressBook
Comment[is]=Kontact KAddressBook íforrit
Comment[it]=Estensione per Kontact di KAddressbook
Comment[ja]=Kontact KAddressbook プラグイン
Comment[ka]=Kontact წიგნაკის მოდული
Comment[kk]=Kontact-тың KAddressBook плагині
Comment[km]=កម្មវិធី​ជំនួយ KAddressBook ក្នុង Kontact
Comment[ko]=Kontact KAddressBook 플러그인
Comment[lt]=Kontact KAddressBook įskiepis
Comment[lv]=Kontact KAddressBook spraudnis
Comment[mk]=Приклучок за КАдресар во Контакт
Comment[mr]=कॉन्टेक्ट के-एड्रेस-बूक प्लगइन
Comment[ms]=Plugin KAddressBook Kontact
Comment[nb]=Kontact programtillegg for KAddressbook
Comment[nds]=KAdressbook-Moduul för Kontact
Comment[ne]=केडीई सम्पर्क ठेगाना पुस्तिका प्लगइन
Comment[nl]=Kontact KAddressBook-plug-in
Comment[nn]=Kontakt-programtillegg for KDE-adresseboka
Comment[pl]=Wtyczka Kontact do współpracy z KAddressBook
Comment[pt]='Plugin' do KAddressbook para o Kontact
Comment[pt_BR]=Plugin do KAddressBook para o Kontact
Comment[ro]=Modul KAddressBook pentru Kontact
Comment[ru]=Адресная книга
Comment[se]=Kontact, KDE-čujuhusgirjji lassemoduvla
Comment[sk]=Kontact KAddressBook Plugin
Comment[sl]=Vstavek Adresarja za Kontact
Comment[sr]=Прикључак Контакта за К‑адресар
Comment[sr@ijekavian]=Прикључак Контакта за К‑адресар
Comment[sr@ijekavianlatin]=Priključak Kontacta za K‑adresar
Comment[sr@latin]=Priključak Kontacta za K‑adresar
Comment[sv]=Kontact-insticksprogram för adressbok
Comment[ta]= கேமுகவரிப்புத்தக சொருகுப்பொருளை தொடர்பு கொள்
Comment[tg]=Модули Kontact барои дастрасӣ ба китоби адресӣ
Comment[tr]=Kontact KAdresDefteri Eklentisi
Comment[uk]=Додаток адресної книги Kontact
Comment[uz]=Kontact uchun KAddressBook plagini
Comment[uz@cyrillic]=Kontact учун KAddressBook плагини
Comment[wa]=Module KAddressBook di Kontact
Comment[x-test]=xxKontact KAddressBook Pluginxx
Comment[zh_CN]=Kontact KAddressbook 插件
Comment[zh_TW]=Kontact KAddressBook 外掛程式
Name=Contacts
Name[af]=Kontakte
Name[ar]=جهات الإتصال
Name[be]=Кантакты
Name[bg]=Contacts
Name[br]=Darempredoù
Name[bs]=Kontakti
Name[ca]=Contactes
Name[ca@valencia]=Contactes
Name[cs]=Kontakty
Name[cy]=Cysylltau
Name[da]=Kontakter
Name[de]=Kontakte
Name[el]=Επαφές
Name[en_GB]=Contacts
Name[eo]=Kontaktoj
Name[es]=Contactos
Name[et]=Kontaktid
Name[eu]=Kontaktuak
Name[fa]=تماسها
Name[fi]=Yhteystiedot
Name[fr]=Contacts
Name[fy]=Adressen
Name[ga]=Teagmhálacha
Name[gl]=Contactos
Name[he]=אנשי קשר
Name[hu]=Névjegyek
Name[ia]=Contactos
Name[is]=Tengiliðir
Name[it]=Contatti
Name[ja]=連絡先
Name[ka]=კონტაქტები
Name[kk]=Контакттар
Name[km]=ទំនាក់ទំនង
Name[ko]=연락처
Name[lt]=Kontaktai
Name[lv]=Kontakti
Name[mai]=संपर्क
Name[mk]=Контакти
Name[mr]=संपर्क
Name[ms]=Orang hubungan
Name[nb]=Contacts
Name[nds]=Kontakten
Name[ne]=सम्पर्क
Name[nl]=Adressen
Name[nn]=Kontaktar
Name[pa]=ਸੰਪਰਕ
Name[pl]=Wizytówki
Name[pt]=Contactos
Name[pt_BR]=Contatos
Name[ro]=Contacte
Name[ru]=Контакты
Name[se]=Oktavuođat
Name[sk]=Kontakty
Name[sl]=Stiki
Name[sr]=Контакти
Name[sr@ijekavian]=Контакти
Name[sr@ijekavianlatin]=Kontakti
Name[sr@latin]=Kontakti
Name[sv]=Kontakter
Name[ta]=தொடர்புகள்
Name[tg]=Алоқот
Name[th]=ที่อยู่ติดต่อ
Name[tr]=Kişiler
Name[ug]=ئالاقەداشلار
Name[uk]=Контакти
Name[uz]=Aloqalar
Name[uz@cyrillic]=Алоқалар
Name[wa]=Contaks
Name[x-test]=xxContactsxx
Name[zh_CN]=联系人
Name[zh_TW]=聯絡人
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment