diff options
Diffstat (limited to 'kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp')
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp b/kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp index 524ad70..4a492f0 100644 --- a/kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp +++ b/kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp @@ -29,8 +29,8 @@ For further information please visit http://www.gmx.com */ -#include <qfile.h> -#include <qmap.h> +#include <tqfile.h> +#include <tqmap.h> #include <kfiledialog.h> #include <kio/netaccess.h> @@ -48,46 +48,46 @@ K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libkaddrbk_gmx_xxport, GMXXXPort, "libka #define GMX_FILESELECTION_STRING "*.gmxa|" + i18n( "GMX addressbook file (*.gmxa)" ) -GMXXXPort::GMXXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) +GMXXXPort::GMXXXPort( KABC::AddressBook *ab, TQWidget *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 ) +static bool checkDateTime( const TQString &dateStr, TQDateTime &dt ) { if (dateStr.isEmpty()) return false; - dt = QDateTime::fromString(dateStr, Qt::ISODate); + dt = TQDateTime::fromString(dateStr, Qt::ISODate); if (dt.isValid() && dt.date().year()>1901) return true; - dt.setDate(QDate()); + dt.setDate(TQDate()); return false; } /* import */ -KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const +KABC::AddresseeList GMXXXPort::importContacts( const TQString& ) const { KABC::AddresseeList addrList; - QString fileName = KFileDialog::getOpenFileName( ":xxport_gmx", + TQString fileName = KFileDialog::getOpenFileName( ":xxport_gmx", GMX_FILESELECTION_STRING, 0 ); if ( fileName.isEmpty() ) return addrList; - QFile file( fileName ); + TQFile file( fileName ); if ( !file.open( IO_ReadOnly ) ) { - QString msg = i18n( "<qt>Unable to open <b>%1</b> for reading.</qt>" ); + TQString 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; + TQDateTime dt; + TQTextStream gmxStream( &file ); + gmxStream.setEncoding( TQTextStream::Latin1 ); + TQString line, line2; line = gmxStream.readLine(); line2 = gmxStream.readLine(); if (!line.startsWith("AB_ADDRESSES:") || !line2.startsWith("Address_id")) { @@ -95,15 +95,15 @@ KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const return addrList; } - QStringList strList; - typedef QMap<QString, KABC::Addressee *> AddressMap; + TQStringList strList; + typedef TQMap<TQString, 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); + strList = TQStringList::split('#', line, true); if (strList.count() >= 11) break; line.append('\n'); @@ -143,7 +143,7 @@ KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const while (!line.startsWith("####") && !gmxStream.atEnd()) { while (1) { - strList = QStringList::split('#', line, true); + strList = TQStringList::split('#', line, true); if (strList.count() >= 21) break; line.append('\n'); @@ -152,7 +152,7 @@ KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const KABC::Addressee *addr = addrMap[strList[0]]; if (addr) { - for ( QStringList::Iterator it = strList.begin(); it != strList.end(); ++it ) + for ( TQStringList::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) @@ -204,7 +204,7 @@ KABC::AddresseeList GMXXXPort::importContacts( const QString& ) const /* export */ -bool GMXXXPort::exportContacts( const KABC::AddresseeList &list, const QString& ) +bool GMXXXPort::exportContacts( const KABC::AddresseeList &list, const TQString& ) { KURL url = KFileDialog::getSaveURL( ":xxport_gmx", GMX_FILESELECTION_STRING ); if ( url.isEmpty() ) @@ -213,7 +213,7 @@ bool GMXXXPort::exportContacts( const KABC::AddresseeList &list, const QString& if ( !url.isLocalFile() ) { KTempFile tmpFile; if ( tmpFile.status() != 0 ) { - QString txt = i18n( "<qt>Unable to open file <b>%1</b>.%2.</qt>" ); + TQString 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; @@ -224,11 +224,11 @@ bool GMXXXPort::exportContacts( const KABC::AddresseeList &list, const QString& return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); } else { - QString filename = url.path(); - QFile file( filename ); + TQString filename = url.path(); + TQFile file( filename ); if ( !file.open( IO_WriteOnly ) ) { - QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); + TQString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ); KMessageBox::error( parentWidget(), txt.arg( filename ) ); return false; } @@ -240,25 +240,25 @@ bool GMXXXPort::exportContacts( const KABC::AddresseeList &list, const QString& } } -static const QString dateString( const QDateTime &dt ) +static const TQString dateString( const TQDateTime &dt ) { if (!dt.isValid()) - return QString::fromLatin1("1000-01-01 00:00:00"); - QString d(dt.toString(Qt::ISODate)); + return TQString::fromLatin1("1000-01-01 00:00:00"); + TQString 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 ) +void GMXXXPort::doExport( TQFile *fp, const KABC::AddresseeList &list ) { if (!fp || !list.count()) return; - QTextStream t( fp ); - t.setEncoding( QTextStream::Latin1 ); + TQTextStream t( fp ); + t.setEncoding( TQTextStream::Latin1 ); KABC::AddresseeList::ConstIterator it; - typedef QMap<int, const KABC::Addressee *> AddressMap; + typedef TQMap<int, const KABC::Addressee *> AddressMap; AddressMap addrMap; const KABC::Addressee *addr; @@ -267,7 +267,7 @@ void GMXXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) "Change_date,Status,Address_link_id,Categories\n"; int no = 0; - const QChar DELIM('#'); + const TQChar DELIM('#'); for ( it = list.begin(); it != list.end(); ++it ) { addr = &(*it); if (addr->isEmpty()) @@ -309,8 +309,8 @@ void GMXXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) cell = addr->phoneNumber(KABC::PhoneNumber::Cell); } - const QStringList emails = addr->emails(); - QString email; + const TQStringList emails = addr->emails(); + TQString email; if (emails.count()>record_id) email = emails[record_id]; t << no << DELIM // Address_id @@ -324,13 +324,13 @@ void GMXXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) << 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 + << ((record_id==0)?addr->url().url():TQString::null) << DELIM // Homepage + << ((record_id==0)?addr->role():TQString::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 + << ((record_id==0)?addr->organization():TQString::null) << DELIM // Company + << ((record_id==0)?addr->custom("KADDRESSBOOK", "X-Department"):TQString::null) << DELIM // Department << dateString(addr->revision()) << DELIM // Change_date << 5 << DELIM // Preferred << 1 << endl; // Status (should always be "1") |