diff options
Diffstat (limited to 'kaddressbook-plugins/xxports/kworldclock')
5 files changed, 296 insertions, 0 deletions
diff --git a/kaddressbook-plugins/xxports/kworldclock/Makefile.am b/kaddressbook-plugins/xxports/kworldclock/Makefile.am new file mode 100644 index 0000000..ee28aa6 --- /dev/null +++ b/kaddressbook-plugins/xxports/kworldclock/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = libkaddrbk_geo_xxport.la + +servicedir = $(kde_servicesdir)/kaddressbook +service_DATA = geo_xxport.desktop + +libkaddrbk_geo_xxport_la_SOURCES = geo_xxport.cpp +libkaddrbk_geo_xxport_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkaddrbk_geo_xxport_la_LIBADD = $(LIB_KDEUI) -lkabc -lkabinterfaces +libkaddrbk_geo_xxport_la_METASOURCES = AUTO + +rc_DATA = geo_xxportui.rc +rcdir = $(kde_datadir)/kaddressbook + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/libkaddrbk_geo_xxport.pot diff --git a/kaddressbook-plugins/xxports/kworldclock/geo_xxport.cpp b/kaddressbook-plugins/xxports/kworldclock/geo_xxport.cpp new file mode 100644 index 0000000..a2440aa --- /dev/null +++ b/kaddressbook-plugins/xxports/kworldclock/geo_xxport.cpp @@ -0,0 +1,114 @@ +/* + 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 <kconfig.h> +#include <klocale.h> +#include <kglobal.h> +#include <kstandarddirs.h> + +#include <float.h> + +#include "geo_xxport.h" + +class FlagInfo +{ + public: + double latitude; + double longitude; + QColor color; +}; + +K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libkaddrbk_geo_xxport, GeoXXPort, "libkaddrbk_geo_xxport" ) + +GeoXXPort::GeoXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) + : KAB::XXPort( ab, parent, name ) +{ + createExportAction( i18n( "Export Geo Data..." ) ); +} + +bool GeoXXPort::exportContacts( const KABC::AddresseeList &list, const QString& ) +{ + KConfig config( "kworldclockrc" ); + + // At first we read all exiting flags and compare it with ours to + // avoid duplicated flags + int flags = config.readNumEntry( "Flags", 0 ); + QValueList<FlagInfo> availableFlags; + + if ( flags != 0 ) { + for ( int i = 0; i < flags; ++i ) { + FlagInfo info; + info.latitude = config.readDoubleNumEntry( QString( "Flag_%1_Latitude" ).arg( i ) ); + info.longitude = config.readDoubleNumEntry( QString( "Flag_%1_Longitude" ).arg( i ) ); + info.color = config.readColorEntry( QString( "Flag_%1_Color" ).arg( i ) ); + + availableFlags.append( info ); + } + } + + + QValueList<FlagInfo> flagList; + KABC::AddresseeList::ConstIterator addrIt; + for ( addrIt = list.begin(); addrIt != list.end(); ++addrIt ) { + KABC::Geo geo( (*addrIt).geo() ); + if ( !geo.isValid() ) + continue; + + bool available = false; + QValueList<FlagInfo>::Iterator it; + for ( it = availableFlags.begin(); it != availableFlags.end(); ++it ) { + if ( !( KABS( (*it).latitude - geo.latitude() ) > DBL_EPSILON ) && + !( KABS( (*it).longitude - geo.longitude() ) > DBL_EPSILON ) ) { + available = true; + break; + } + } + + if ( !available ) { + FlagInfo info; + info.latitude = geo.latitude(); + info.longitude = geo.longitude(); + info.color = QColor( 0, 255, 0 ); + + flagList.append( info ); + } + } + + if ( flagList.count() == 0 ) // nothing to export + return true; + + flagList += availableFlags; + + int startVal = 0; + QValueList<FlagInfo>::Iterator it; + for ( it = flagList.begin(); it != flagList.end(); ++it, ++startVal ) { + config.writeEntry( QString( "Flag_%1_Color" ).arg( startVal ), (*it).color ); + config.writeEntry( QString( "Flag_%1_Latitude" ).arg( startVal ), (*it).latitude ); + config.writeEntry( QString( "Flag_%1_Longitude" ).arg( startVal ), (*it).longitude ); + } + config.writeEntry( "Flags", startVal ); + + return true; +} + +#include "geo_xxport.moc" diff --git a/kaddressbook-plugins/xxports/kworldclock/geo_xxport.desktop b/kaddressbook-plugins/xxports/kworldclock/geo_xxport.desktop new file mode 100644 index 0000000..9202d85 --- /dev/null +++ b/kaddressbook-plugins/xxports/kworldclock/geo_xxport.desktop @@ -0,0 +1,112 @@ +[Desktop Entry] +X-KDE-Library=libkaddrbk_geo_xxport +Name=KAB KWorldClock XXPort Plugin +Name[az]=KAB KWorldClock XXPort Əlavəsi +Name[br]=Lugent KAB KWorldClock XXPort +Name[ca]=Connector KWorldClock XXPort per a KAB +Name[cs]=Exportní modul do KWorldClock +Name[cy]=Ategyn XXPort KClocByd KAB +Name[de]=Adressbuch/Weltuhr-Exportmodul +Name[el]=Πρόσθετο KAB KWorldClock XXPort +Name[eo]=KAB KMondhorloĝo porta kromaĵo +Name[es]=Complemento KAB KWorldClock XXPort +Name[et]=KAB KWorldClock eksportplugin +Name[eu]=KAB KWorldClock XXPort plugina +Name[fa]=وصلۀ KAB KWorldClock XXPort +Name[fi]=KAB-maailmakellon XXPort-liitännäinen +Name[fr]=Module d'export KAB vers KWorldClock +Name[fy]=KAB KWorldClock XXPort-plugin +Name[ga]=Breiseán KAB KWorldClock XXPort +Name[gl]=Plugin de XXPort de KWorldClock para KAB +Name[he]=תוסף XXPort של KAB עבור KWorldClock +Name[hi]=केएबी के-वर्ल्डक्लॉक XXपोर्ट प्लगइन +Name[hr]=KAB KWorldClock XXPort dodatak +Name[hu]=KAB KWorldClock XXPort bővítőmodul +Name[is]=KAB KWorldClock XXPort íforrit +Name[it]=Plugin per KAB KWorldClock XXPort +Name[ja]=KAB KWorldClock XXPort プラグイン +Name[ka]=KAB KWorldClock XXPort მოდული +Name[kk]=KAB KWorldClock XXPort плагин модулі +Name[km]=កម្មវិធីជំនួយ KAB KWorldClock XXPort +Name[lt]=KAB KWorldClock XXPort priedas +Name[mk]=Приклучок KAB KWorldClock XXPort +Name[nds]=KWorldClock-Moduul för KAdressbook +Name[ne]=KAB KWorldClock XXपोर्ट प्लगइन +Name[nl]=KAB KWorldClock XXPort-plugin +Name[nn]=Programtillegg KAB KWorldClock XXPort +Name[pa]=KAB KWorldClock XXPort ਪਲੱਗਇਨ +Name[pl]=Wtyczka eksportu danych KAB do KWorldClock +Name[pt]='Plugin' de XXPort do KWorldClock para o KAB +Name[pt_BR]=Plug-Ins do KWorldClock do Kab +Name[ro]=Modul de exportare KAB-KWorldClock +Name[ru]=Модуль KAB KWorldClock XXPort +Name[sk]=Module KWorldClock pre KAB +Name[sl]=Vstavek za KAB v KWorldClock XXPort +Name[sr]=XXPort прикључак KAB-а за KWorldClock +Name[sr@Latn]=XXPort priključak KAB-a za KWorldClock +Name[sv]=Adressbokens överföringsinsticksprogram för Världsklockan +Name[ta]=KAB கேஉலக கடிகாரம் XXPort சொருகு சாதனம் +Name[tg]=Модули KAB KWorldClock XXPort +Name[tr]=KAB Dünya Saati XXPort Plugin'i +Name[uk]=Втулок KAB KWorldClock XXPort +Name[uz]=KAB KWorldClock XXPort plagini +Name[uz@cyrillic]=KAB KWorldClock XXPort плагини +Name[vi]=Bổ sung XXPort KWorldClock KAB +Name[zh_CN]=KAB KWorldClock XXPort 插件 +Name[zh_TW]=KAB KWorldClock XXPort 外掛程式 +Comment=Plugin to export the geo data of contacts as flags in KWorldClock +Comment[az]=KWorldClock-da əlaqələrin geo mə'lumatını ixrac etmək üçün əlavə +Comment[bg]=Приставка за експортиране на геодезни данни от адресника като флагове на KWorldClock +Comment[ca]=Connector per a exportar les dades geogràfiques de contactes en kworldclock com a banderes +Comment[cs]=Modul pro export geo dat kontaktů jako značek pro KWorldClock +Comment[cy]=Ategyn i allforio data daearyddol cysylltau fel baneri yn KClocByd +Comment[da]=Plugin til at eksportere geo-data af kontakter som flag til KWorldClock +Comment[de]=Modul zum Export der Standortpositionen der Kontakte als Flaggen in KWorldClock +Comment[el]=Πρόσθετο για εξαγωγή των γεωγραφικών δεδομένων των επαφών σαν σημαίες στο KWorldClock +Comment[es]=Complemento para exportar datos geográficos de los contactos como banderas en KWorldClock +Comment[et]=Plugin, mis ekspordib KWorldClocki aadressiraamatus leiduvate isikute asukoha lipukestena +Comment[eu]=KWorldClock-eko kontaktuen datu geografikoak bandera gisa esportatzeko plugina +Comment[fa]=وصله برای صادرات دادههای جغرافیایی تماسها به عنوان پرچمهای KWorldClock +Comment[fi]=Liitännäinen maantieteellisten koordinaattien siirtämiseen KWorldClock sovellukseen +Comment[fr]=Module externe pour exporter les données géographiques des contacts sous forme de drapeaux dans KWorldClock +Comment[fy]=Plugin foar it eksportearjen fan de geografyske gegevens fan kontakten as flaggen yn KWorldClock +Comment[ga]=Breiseán a easpórtálann na sonraí geografacha de theagmhálacha mar bhratacha i KWorldClock +Comment[gl]=Un plugin para exportar os dados xeográficos dos contactos como bandeiras en KWorldClock +Comment[hi]=कान्टेक्ट के भौगोलिक डाटा को के-वर्ल्डक्लॉक में फ्लेग्स की तरह निर्यात करने का प्लगइन +Comment[hr]=Dodatak za izvoz geografskih podataka kontakata u obliku zastava u KWorldClock +Comment[hu]=Bővítőmodul a névjegyek földrajzi adatainak KWorldClock-ba való exportálásához (jelzők formájában) +Comment[is]=Íforrit sem flytur út landupplýsingar um staðsetningar fyrir KWorldClock +Comment[it]=Plugin per esportare geo data dei contatti come bandiere in KWorldClock +Comment[ja]=KWorldClock の旗を地図データの接点にエクスポートするプラグイン +Comment[ka]=geo მონაცემების დასაექსპორტებელი მოდული, როგორიცაა KWorldClock-ში დროშები +Comment[kk]=Контакттардың географикалық мәліметтерін KWorldClock-тың жалауша түрінде экспорттайтын плагин модулі +Comment[km]=កម្មវិធីជំនួយដើម្បីនាំចេញទិន្ន័យភូមិសាស្ត្រនៃទំនាក់ទំនងជាទង់នៅក្នុង KWorldClock +Comment[lt]=Priedas kontaktų geografinių duomenų eksportavimui KWorldClock +Comment[mk]=Приклучок за изнесување на географски податоци на контактите како знамиња во KWorldClock +Comment[ms]=Plug masuk intuk eksport data geo hubungan sebagai tanda dalam KWorldClock +Comment[nb]=Modul som eksporterer geografiske data om kontakter som flagg i KWorldClock +Comment[nds]=Moduul för't Exporteren vun Kontakten-Standöörd as Flaggen binnen "KWorldClock" +Comment[ne]=KWorldClock मा झण्डा अनुरुपका सम्पर्कका geo डाट निर्यात गर्ने प्लगइन +Comment[nl]=Plugin voor het exporteren van de geografische gegevens van contacten als vlaggen in KWorldClock +Comment[nn]=Programtillegg for å eksportera geografiske data frå kontaktar til flagg i KWorldClock +Comment[pl]=Wtyczka do eksportu danych geograficznych z wizytówek jako flag w KWorldClock +Comment[pt]=Um 'plugin' para exportar os dados geográficos dos contactos como bandeiras no KWorldClock +Comment[pt_BR]=Plugin para exportar dados geográficos de contatos, como sinais no Kworldclock +Comment[ro]=Modul care exportă datele geografice din adresele de contact ca fanioane în KWorldClock +Comment[ru]=Модуль для экспорта географических координат контактов как флагов в KWorldClock +Comment[sk]=Modul pre export geografických dát kontaktov ako vlajok pre KWorldClock +Comment[sl]=Vstavek za izvoz zemljepisnih podatkov iz naslovov kot zastavice v KWorldClock +Comment[sr]=Прикључак за извоз географских података контаката као застава у KWorldClock-у +Comment[sr@Latn]=Priključak za izvoz geografskih podataka kontakata kao zastava u KWorldClock-u +Comment[sv]=Insticksprogram för export av geografisk data som flaggor i Världsklockan +Comment[ta]=கேஉலக கடிகாரத்தில் கொடிகளாக உள்ள தொடர்புகளின் ஜியோ தகவலை ஏற்றுவதற்கு சொருகு சாதனம் +Comment[tg]=Модул барои содироти маълумотҳои алоқаи ҷуғрофӣ мисли байрақчаҳо дар KWorldClock +Comment[tr]=KWorldClock'taki bayrakların geo veri bağlantılarını ihraç etmek için Plugin +Comment[uk]=Втулок для експортування географічних даних контактів як прапорці в KWorldClock +Comment[vi]=Bổ sung xuất khẩu dữ liệu địa lý của liên lạc dạng cờ trong đồng hồ thế giới KWorldClock +Comment[zh_CN]=将联系人的地理数据导出为 KWorldClock 中旗帜的插件 +Comment[zh_TW]=匯出 GEO 聯絡人資料為 KWorldClock 旗標 +Type=Service +ServiceTypes=KAddressBook/XXPort +X-KDE-KAddressBook-XXPortPluginVersion=1 + diff --git a/kaddressbook-plugins/xxports/kworldclock/geo_xxport.h b/kaddressbook-plugins/xxports/kworldclock/geo_xxport.h new file mode 100644 index 0000000..d3b560a --- /dev/null +++ b/kaddressbook-plugins/xxports/kworldclock/geo_xxport.h @@ -0,0 +1,42 @@ +/* + 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 GEO_XXPORT_H +#define GEO_XXPORT_H + +#include <kaddressbook/xxport.h> + +class GeoXXPort : public KAB::XXPort +{ + Q_OBJECT + + public: + GeoXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); + + QString identifier() const { return "geo"; } + + public slots: + bool exportContacts( const KABC::AddresseeList &list, const QString &data ); +}; + +#endif diff --git a/kaddressbook-plugins/xxports/kworldclock/geo_xxportui.rc b/kaddressbook-plugins/xxports/kworldclock/geo_xxportui.rc new file mode 100644 index 0000000..4b5ead3 --- /dev/null +++ b/kaddressbook-plugins/xxports/kworldclock/geo_xxportui.rc @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<!DOCTYPE gui> +<gui name="geo_xxport" version="1"> +<MenuBar> + <Menu name="file"><text>&File</text> + <Menu name="file_export"><text>&Export</text> + <Action name="file_export_geo"/> + </Menu> + </Menu> +</MenuBar> +</gui> |