diff options
Diffstat (limited to 'kaddressbook-plugins/xxports')
-rw-r--r-- | kaddressbook-plugins/xxports/Makefile.am | 1 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/Makefile.am | 18 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp | 346 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/gmx_xxport.desktop | 109 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/gmx_xxport.h | 47 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/gmx_xxportui.rc | 14 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/kworldclock/Makefile.am | 17 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/kworldclock/geo_xxport.cpp | 114 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/kworldclock/geo_xxport.desktop | 112 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/kworldclock/geo_xxport.h | 42 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/kworldclock/geo_xxportui.rc | 11 |
11 files changed, 831 insertions, 0 deletions
diff --git a/kaddressbook-plugins/xxports/Makefile.am b/kaddressbook-plugins/xxports/Makefile.am new file mode 100644 index 0000000..7501d2a --- /dev/null +++ b/kaddressbook-plugins/xxports/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = kworldclock gmx diff --git a/kaddressbook-plugins/xxports/gmx/Makefile.am b/kaddressbook-plugins/xxports/gmx/Makefile.am new file mode 100644 index 0000000..facdd37 --- /dev/null +++ b/kaddressbook-plugins/xxports/gmx/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = libkaddrbk_gmx_xxport.la + +servicedir = $(kde_servicesdir)/kaddressbook +service_DATA = gmx_xxport.desktop + +libkaddrbk_gmx_xxport_la_SOURCES = gmx_xxport.cpp +libkaddrbk_gmx_xxport_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) -no-undefined +libkaddrbk_gmx_xxport_la_LIBADD = $(LIB_KDEUI) -lkabc -lkabinterfaces +libkaddrbk_gmx_xxport_la_METASOURCES = AUTO + +rc_DATA = gmx_xxportui.rc +rcdir = $(kde_datadir)/kaddressbook + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/libkaddrbk_gmx_xxport.pot + diff --git a/kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp b/kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp new file mode 100644 index 0000000..524ad70 --- /dev/null +++ b/kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp @@ -0,0 +1,346 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2003 - 2004 Helge Deller <deller@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + 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. + + + Description: + This import/export filter reads and writes addressbook entries in the + gmx format which is natively used by the german freemail provider GMX. + The big advantage of this format is, that it stores it's information + very consistent and makes parsing pretty simple. Furthermore, most + information needed by KABC is available when compared to other formats. + For further information please visit http://www.gmx.com +*/ + +#include <qfile.h> +#include <qmap.h> + +#include <kfiledialog.h> +#include <kio/netaccess.h> +#include <klocale.h> +#include <kmdcodec.h> +#include <kmessagebox.h> +#include <ktempfile.h> +#include <kurl.h> + +#include <kdebug.h> + +#include "gmx_xxport.h" + +K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libkaddrbk_gmx_xxport, GMXXXPort, "libkaddrbk_gmx_xxport" ) + +#define GMX_FILESELECTION_STRING "*.gmxa|" + i18n( "GMX addressbook file (*.gmxa)" ) + +GMXXXPort::GMXXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) + : KAB::XXPort( ab, parent, name ) +{ + createImportAction( i18n( "Import GMX Address Book..." ) ); + createExportAction( i18n( "Export GMX Address Book..." ) ); +} + +static bool checkDateTime( const QString &dateStr, QDateTime &dt ) +{ + if (dateStr.isEmpty()) + return false; + dt = QDateTime::fromString(dateStr, Qt::ISODate); + if (dt.isValid() && dt.date().year()>1901) + return true; + dt.setDate(QDate()); + return false; +} + +/* import */ + +KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const +{ + KABC::AddresseeList addrList; + + QString fileName = KFileDialog::getOpenFileName( ":xxport_gmx", + GMX_FILESELECTION_STRING, 0 ); + if ( fileName.isEmpty() ) + return addrList; + + QFile file( fileName ); + if ( !file.open( IO_ReadOnly ) ) { + QString msg = i18n( "<qt>Unable to open <b>%1</b> for reading.</qt>" ); + KMessageBox::error( parentWidget(), msg.arg( fileName ) ); + return addrList; + } + + QDateTime dt; + QTextStream gmxStream( &file ); + gmxStream.setEncoding( QTextStream::Latin1 ); + QString line, line2; + line = gmxStream.readLine(); + line2 = gmxStream.readLine(); + if (!line.startsWith("AB_ADDRESSES:") || !line2.startsWith("Address_id")) { + KMessageBox::error( parentWidget(), i18n("%1 is not a GMX address book file.").arg(fileName) ); + return addrList; + } + + QStringList strList; + typedef QMap<QString, KABC::Addressee *> AddressMap; + AddressMap addrMap; + + // "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments,Change_date,Status,Address_link_id,Categories" + line = gmxStream.readLine(); + while (!line.startsWith("####") && !gmxStream.atEnd()) { + while (1) { + strList = QStringList::split('#', line, true); + if (strList.count() >= 11) + break; + line.append('\n'); + line.append(gmxStream.readLine()); + }; + + KABC::Addressee *addr = new KABC::Addressee; + addr->setNickName(strList[1]); + addr->setGivenName(strList[2]); + addr->setFamilyName(strList[3]); + addr->setTitle(strList[4]); + + if (addr->formattedName().isEmpty()) + addr->setFormattedName(addr->realName()); + + if (checkDateTime(strList[5],dt)) addr->setBirthday(dt); + addr->setNote(strList[6]); + if (checkDateTime(strList[7],dt)) addr->setRevision(dt); + // addr->setStatus(strList[8]); Status + // addr->xxx(strList[9]); Address_link_id + // addr->setCategory(strList[10]); Categories + addrMap[strList[0]] = addr; + + line = gmxStream.readLine(); + } + + // now read the address records + line = gmxStream.readLine(); + if (!line.startsWith("AB_ADDRESS_RECORDS:")) { + kdWarning() << "Could not find address records!\n"; + return addrList; + } + // Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile,Mobile_type,Email, + // Homepage,Position,Comments,Record_type_id,Record_type,Company,Department,Change_date,Preferred,Status + line = gmxStream.readLine(); + line = gmxStream.readLine(); + + while (!line.startsWith("####") && !gmxStream.atEnd()) { + while (1) { + strList = QStringList::split('#', line, true); + if (strList.count() >= 21) + break; + line.append('\n'); + line.append(gmxStream.readLine()); + }; + + KABC::Addressee *addr = addrMap[strList[0]]; + if (addr) { + for ( QStringList::Iterator it = strList.begin(); it != strList.end(); ++it ) + *it = (*it).simplifyWhiteSpace(); + // strList[1] = Record_id (numbered item, ignore here) + int id = strList[14].toInt(); // Record_type_id (0=work,1=home,2=other) + int type = (id==0) ? KABC::Address::Work : KABC::Address::Home; + if (!strList[19].isEmpty() && strList[19].toInt()!=0) + type |= KABC::Address::Pref; // Preferred address (seems to be bitfield for telephone Prefs) + KABC::Address adr = addr->address(type); + adr.setStreet(strList[2]); + adr.setCountry(strList[3]); + adr.setPostalCode(strList[4]); + adr.setLocality(strList[5]); + addr->insertPhoneNumber( KABC::PhoneNumber(strList[6], KABC::PhoneNumber::Home) ); + addr->insertPhoneNumber( KABC::PhoneNumber(strList[7], KABC::PhoneNumber::Fax) ); + int celltype = KABC::PhoneNumber::Cell; + // strList[9]=Mobile_type // always 0 or -1(default phone). + if (strList[9].toInt()) celltype |= KABC::PhoneNumber::Pref; + addr->insertPhoneNumber( KABC::PhoneNumber(strList[8], celltype) ); + addr->insertEmail(strList[10]); + if (!strList[11].isEmpty()) addr->setUrl(strList[11]); + if (!strList[12].isEmpty()) addr->setRole(strList[12]); + // strList[13]=Comments + // strList[14]=Record_type_id (0,1,2) - see above + // strList[15]=Record_type (name of this additional record entry) + if (!strList[16].isEmpty()) addr->setOrganization(strList[16]); // Company + if (!strList[17].isEmpty()) addr->insertCustom( + "KADDRESSBOOK", "X-Department", strList[17]); // Department + if (checkDateTime(strList[18],dt)) addr->setRevision(dt); // Change_date + // strList[19]=Preferred (see above) + // strList[20]=Status (should always be "1") + addr->insertAddress(adr); + } else { + kdWarning() << "unresolved line: " << line << endl; + } + + line = gmxStream.readLine(); + } + + // now add the addresses to to addrList + for ( AddressMap::Iterator it = addrMap.begin(); it != addrMap.end(); ++it ) { + KABC::Addressee *addr = it.data(); + addrList.append(*addr); + delete addr; + } + + file.close(); + return addrList; +} + + +/* export */ + +bool GMXXXPort::exportContacts( const KABC::AddresseeList &list, const QString& ) +{ + KURL url = KFileDialog::getSaveURL( ":xxport_gmx", GMX_FILESELECTION_STRING ); + if ( url.isEmpty() ) + return true; + + if ( !url.isLocalFile() ) { + KTempFile tmpFile; + if ( tmpFile.status() != 0 ) { + QString txt = i18n( "<qt>Unable to open file <b>%1</b>.%2.</qt>" ); + KMessageBox::error( parentWidget(), txt.arg( url.url() ) + .arg( strerror( tmpFile.status() ) ) ); + return false; + } + + doExport( tmpFile.file(), list ); + tmpFile.close(); + + return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); + } else { + QString filename = url.path(); + QFile file( filename ); + + if ( !file.open( IO_WriteOnly ) ) { + QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); + KMessageBox::error( parentWidget(), txt.arg( filename ) ); + return false; + } + + doExport( &file, list ); + file.close(); + + return true; + } +} + +static const QString dateString( const QDateTime &dt ) +{ + if (!dt.isValid()) + return QString::fromLatin1("1000-01-01 00:00:00"); + QString d(dt.toString(Qt::ISODate)); + d[10] = ' '; // remove the "T" in the middle of the string + return d; +} + +void GMXXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) +{ + if (!fp || !list.count()) + return; + + QTextStream t( fp ); + t.setEncoding( QTextStream::Latin1 ); + + KABC::AddresseeList::ConstIterator it; + typedef QMap<int, const KABC::Addressee *> AddressMap; + AddressMap addrMap; + const KABC::Addressee *addr; + + t << "AB_ADDRESSES:\n"; + t << "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments," + "Change_date,Status,Address_link_id,Categories\n"; + + int no = 0; + const QChar DELIM('#'); + for ( it = list.begin(); it != list.end(); ++it ) { + addr = &(*it); + if (addr->isEmpty()) + continue; + addrMap[++no] = addr; + t << no << DELIM // Address_id + << addr->nickName() << DELIM // Nickname + << addr->givenName() << DELIM // Firstname + << addr->familyName() << DELIM // Lastname + << addr->title() << DELIM // Title + << dateString(addr->birthday()) << DELIM // Birthday + << addr->note() /*.replace('\n',"\r\n")*/ << DELIM // Comments + << dateString(addr->revision()) << DELIM // Change_date + << "1##0\n"; // Status, Address_link_id, Categories + } + + t << "####\n"; + t << "AB_ADDRESS_RECORDS:\n"; + t << "Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile," + "Mobile_type,Email,Homepage,Position,Comments,Record_type_id,Record_type," + "Company,Department,Change_date,Preferred,Status\n"; + + no = 1; + while ( (addr = addrMap[no]) != NULL ) { + for (unsigned int record_id=0; record_id<3; record_id++) { + + KABC::Address address; + KABC::PhoneNumber phone, fax, cell; + + + if (record_id == 0) { + address = addr->address(KABC::Address::Work); + phone = addr->phoneNumber(KABC::PhoneNumber::Work); + fax = addr->phoneNumber(KABC::PhoneNumber::Fax); + cell = addr->phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Cell); + } else { + address = addr->address(KABC::Address::Home); + phone = addr->phoneNumber(KABC::PhoneNumber::Home); + cell = addr->phoneNumber(KABC::PhoneNumber::Cell); + } + + const QStringList emails = addr->emails(); + QString email; + if (emails.count()>record_id) email = emails[record_id]; + + t << no << DELIM // Address_id + << record_id << DELIM // Record_id + << address.street() << DELIM // Street + << address.country() << DELIM // Country + << address.postalCode() << DELIM // Zipcode + << address.locality() << DELIM // City + << phone.number() << DELIM // Phone + << fax.number() << DELIM // Fax + << cell.number() << DELIM // Mobile + << ((cell.type()&KABC::PhoneNumber::Pref)?-1:0) << DELIM // Mobile_type + << email << DELIM // Email + << ((record_id==0)?addr->url().url():QString::null) << DELIM // Homepage + << ((record_id==0)?addr->role():QString::null) << DELIM // Position + << DELIM // Comments + << record_id << DELIM // Record_type_id (0,1,2) - see above + << DELIM // Record_type (name of this additional record entry) + << ((record_id==0)?addr->organization():QString::null) << DELIM // Company + << ((record_id==0)?addr->custom("KADDRESSBOOK", "X-Department"):QString::null) << DELIM // Department + << dateString(addr->revision()) << DELIM // Change_date + << 5 << DELIM // Preferred + << 1 << endl; // Status (should always be "1") + } + + ++no; + }; + + t << "####"; +} + +#include "gmx_xxport.moc" + diff --git a/kaddressbook-plugins/xxports/gmx/gmx_xxport.desktop b/kaddressbook-plugins/xxports/gmx/gmx_xxport.desktop new file mode 100644 index 0000000..1b31521 --- /dev/null +++ b/kaddressbook-plugins/xxports/gmx/gmx_xxport.desktop @@ -0,0 +1,109 @@ +[Desktop Entry] +X-KDE-Library=libkaddrbk_gmx_xxport +Name=KAB GMX XXPort Plugin +Name[br]=Lugent XXPorzh GMX KAB +Name[ca]=Connector GMX XXPort per a KAB +Name[cs]=KAB GMX XXPort modul +Name[de]=GMX Adressbuchmodul +Name[el]=Πρόσθετο KAB GMX XXPort +Name[eo]=KAB GMX porta kromaĵo +Name[es]=Complemento KAB KWorldClock XXPort +Name[et]=KAB GMX eksport/importplugin +Name[eu]=KAB GMX XXPort plugina +Name[fa]=وصلۀ KAB GMX XXPort +Name[fi]=KAB-GMX XXPort-liitännäinen +Name[fr]=Module d'XXportation GMX KAB +Name[fy]=KAB GMX XXPort-plugin +Name[ga]=Breiseán KAB GMX XXPort +Name[gl]=Plugin XXPort GMX de KAB +Name[he]= תוסיף יבוא/ייצוא של KAB GMX +Name[hi]=केएबी जीएमएक्स एक्सएक्स-पोर्ट प्लगइन +Name[hr]=KAB GMX XXPort dodatak +Name[hu]=KAB GMX XXPort bővítőmodul +Name[is]=KAB GMX XXPort íforrit +Name[it]=Plugin per KAB GMX XXPort +Name[ja]=KAB KWorldClock XXPort プラグイン +Name[ka]=KAB GMX XXPort მოდული +Name[kk]=KAB GMX XXPort плагин модулі +Name[km]=កម្មវិធីជំនួយ KAB GMX XXPort +Name[lt]=KAB GMX XXPort priedas +Name[mk]=Приклучок KAB GMX XXPort +Name[nb]=Programtillegg for KAB GMX XXPort +Name[nds]=GMX-Moduul för KAdressbook +Name[ne]=KAB GMX XX पोर्ट प्लगइन +Name[nl]=KAB GMX XXPort-plugin +Name[nn]=Programtillegg KAB GMX XXPort +Name[pa]=KAB GMX XXPort ਪਲੱਗਇਨ +Name[pl]=Wtyczka KAB GMX XXPort +Name[pt]='Plugin' XXPort GMX do KAB +Name[pt_BR]=Plug-in GMX para o Livro de Endereços +Name[ru]=Модуль KAB GMX XXPort +Name[sk]=KAB GMX XXPort modul +Name[sl]=Vstavek KAB GMX XXPort +Name[sr]=XXPort прикључак KAB-а за GMX +Name[sr@Latn]=XXPort priključak KAB-a za GMX +Name[sv]=Adressbokens överföringsinsticksprogram för GMX +Name[ta]=KAB GMX XXமுனைய சொருகுப்பொருள் +Name[tr]=KAB GMX XXPort Eklentisi +Name[uk]=Втулок KAB GMX XXPort +Name[uz]=KAB GMX XXPort plagini +Name[uz@cyrillic]=KAB GMX XXPort плагини +Name[vi]=Bổ sung XXPort GMX KAB +Name[zh_CN]=KAB GMX XXPort 插件 +Name[zh_TW]=KAB GMX XXPort 外掛程式 +Comment=Plugin to import and export contacts in GMX's addressbook format +Comment[bg]=Приставка за импортиране и експортиране на контакти от адресник във формат GMX +Comment[ca]=Connector per a importar i exportar contactes en el format de llibreta d'adreces GMX +Comment[cs]=Modul pro export kontaktů v adresářovém formátu GMX +Comment[da]=Plugin til at importere og eksportere kontakter i GMX's adressebogsformat +Comment[de]=Modul zum Import und Export von Kontaktdaten im Adressbuchformat von GMX +Comment[el]=Πρόσθετο για εισαγωγή και εξαγωγή επαφών στη μορφή του βιβλίου διευθύνσεων του GMX +Comment[eo]=Kromaĵo por enporti kaj elporti kontaktojn en GMX-a adreslibra formato +Comment[es]=Complemento para importar y exportar contactos en el formato GMX de la libreta de direcciones +Comment[et]=Plugin, mis impordib ja ekspordib kontakte GMX aadressiraamatu vormingust/vormingusse +Comment[eu]=GMX formatuan dauden helbide liburuxkak inportatu eta esportatzeko plugina +Comment[fa]=وصله برای واردات و صادرات تماسها در قالب کتاب نشانی GMX +Comment[fi]=Sovelma GMX-osoitekirjamuodossa olevien tietueiden tuontiin ja vientiin +Comment[fr]=Module externe permettant d'importer et d'exporter des contacts avec le format du carnet d'adresses GMX +Comment[fy]=Plugin foar it ym-en eksportearjen fan kontakten út it adresboekformaat fan GMX +Comment[ga]=Breiseán chun teagmhálacha i bhformáid leabhair seoltaí GMX a iompórtáil agus a easpórtáil +Comment[gl]=Un plugin para importar e exportar contactos no formato de libro de enderezos GMX +Comment[he]= תוסף לייבוא וייצוא של אנשי קשר בפורמט פנקס הכתובות של GMX +Comment[hi]=जीएमएक्स पता पुस्तिका फार्मेट में सम्पर्कों को आयात और निर्यात करने का प्लगइन +Comment[hr]=Dodatak za uvoz i izvoz kontakata u oblikovanju GMX adresara +Comment[hu]=Bővítőmodul GMX formátumú névjegyek importálásához és exportálásához +Comment[is]=Íforrit sem flytur inn og út tengiliði í GMX vistfangasniði +Comment[it]=Plugin per importare ed esportare contatti in formato GXM +Comment[ja]=KWorldClock の旗を GMX 形式の地図データでインポート、エクスポートするプラグイン +Comment[ka]=GMX's მისამართთა წიგნის ფორმატში კონტაქტების იმპორტის და ექსპორტის მოდული +Comment[kk]=GMX адрестік кітапша пішіміне контакттарды импорт және экспорттау +Comment[km]=កម្មវិធីជំនួយដើម្បីនាំចូល និងនាំចេញទំនាក់ទំនងនៅក្នុងទ្រង់ទ្រាយសៀវភៅអាសយដ្ឋានរបស់ GMX +Comment[lt]=Priedas GMX formato adresų knygutės eksportavimui ir importavimui +Comment[mk]=Приклучок за внесување и изнесување на контакти во GMX-формат на адресар +Comment[ms]=Plugin akan mengimport dan mengeksport hubungan dalam format buku alamat GMX +Comment[nb]=Modul som eksporterer kontakter i adressebok-formatet til GMX +Comment[nds]=Moduul för't Im- un Exporteren vun Kontakten in GMX-Adressbookformaat +Comment[ne]=जीएमएक्सको ठेगाना पुस्तक ढाँचामा सम्पर्क आयात र निर्यात गर्ने प्लगइन +Comment[nl]=Plugin voor het im-en exporteren van contacten uit het adresboekformaat van GMX +Comment[nn]=Programtillegg for å importera og eksportera kontaktar i GMX-adressebokformatet +Comment[pl]=Wtyczka do importu i eksportu kontaktów z formatu książki adresowej GMX +Comment[pt]=Um 'plugin' para importar e exportar contactos no formato de livro de endereços GMX +Comment[pt_BR]=Plug-in para exportar e importar contatos usando o formato de livro de endereços GMX +Comment[ru]=Модуль для экспорта и импорта контактов в формат адресной книги GMX +Comment[sk]=Modul pre import a export kontaktov v GMX formáte adresára +Comment[sl]=Vstavek za uvoz in izvoz stikov v obliko adresarja GMX +Comment[sr]=Прикључак за увоз и извоз контаката у формату GMX-овог адресара +Comment[sr@Latn]=Priključak za uvoz i izvoz kontakata u formatu GMX-ovog adresara +Comment[sv]=Insticksprogram för import och export av kontakter med GMX adressboksformat +Comment[ta]=GMX's முகவரிப்புத்தக வடிவத்தில் உள்ள தொடர்புகளை ஏற்ற, இறக்க சொருகுப்பொருள் +Comment[tr]=GMX'in adresdefteri biçimindeki bağlantıları ekleme ve oluşturma eklentisi +Comment[uk]=Втулок для імпортування та експортування контактів у форматі адресної книги GMX +Comment[uz]=Aloqalarni GMX manzillar daftari formatida eksport-import qilish vositasi +Comment[uz@cyrillic]=Алоқаларни GMX манзиллар дафтари форматида экспорт-импорт қилиш воситаси +Comment[vi]=Bổ sung nhập/xuất khẩu liên lạc định dạng sổ địa chỉ của GMX +Comment[zh_CN]=以 GMX 的地址簿格式导入和导出联系人 +Comment[zh_TW]=匯入/匯出 GMX 通訊錄格式的外掛程式 +Type=Service +ServiceTypes=KAddressBook/XXPort +X-KDE-KAddressBook-XXPortPluginVersion=1 + diff --git a/kaddressbook-plugins/xxports/gmx/gmx_xxport.h b/kaddressbook-plugins/xxports/gmx/gmx_xxport.h new file mode 100644 index 0000000..9ced4da --- /dev/null +++ b/kaddressbook-plugins/xxports/gmx/gmx_xxport.h @@ -0,0 +1,47 @@ +/* + This file is part of KAddressbook. + Copyright (c) 2000 - 2003 Oliver Strutynski <olistrut@gmx.de> + 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 GMX_XXPORT_H +#define GMX_XXPORT_H + +#include <kaddressbook/xxport.h> + +class GMXXXPort : public KAB::XXPort +{ + Q_OBJECT + + public: + GMXXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); + + QString identifier() const { return "gmx"; } + + public slots: + bool exportContacts( const KABC::AddresseeList &list, const QString &data ); + KABC::AddresseeList importContacts( const QString &data ) const; + + private: + void doExport( QFile *fp, const KABC::AddresseeList &list ); +}; + +#endif diff --git a/kaddressbook-plugins/xxports/gmx/gmx_xxportui.rc b/kaddressbook-plugins/xxports/gmx/gmx_xxportui.rc new file mode 100644 index 0000000..9239d6b --- /dev/null +++ b/kaddressbook-plugins/xxports/gmx/gmx_xxportui.rc @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!DOCTYPE gui> +<gui name="gmx_xxport" version="1"> +<MenuBar> + <Menu name="file"><text>&File</text> + <Menu name="file_import"><text>&Import</text> + <Action name="file_import_gmx"/> + </Menu> + <Menu name="file_export"><text>&Export</text> + <Action name="file_export_gmx"/> + </Menu> + </Menu> +</MenuBar> +</gui> 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> |