diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:22:56 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:22:56 +0000 |
commit | 7346aee26bf190a7e70333c40fab4caca847cd27 (patch) | |
tree | 4b019b434f88dcc3eeaafe1d3f26240b4c4718e8 /kaddressbook-plugins/xxports/gmx | |
parent | 23a3d3aa5b44cbdf305495919866d9dbf4f6da54 (diff) | |
download | tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.tar.gz tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1157634 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kaddressbook-plugins/xxports/gmx')
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/gmx_xxport.cpp | 76 | ||||
-rw-r--r-- | kaddressbook-plugins/xxports/gmx/gmx_xxport.h | 10 |
2 files changed, 43 insertions, 43 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") diff --git a/kaddressbook-plugins/xxports/gmx/gmx_xxport.h b/kaddressbook-plugins/xxports/gmx/gmx_xxport.h index 9ced4da..607455c 100644 --- a/kaddressbook-plugins/xxports/gmx/gmx_xxport.h +++ b/kaddressbook-plugins/xxports/gmx/gmx_xxport.h @@ -32,16 +32,16 @@ class GMXXXPort : public KAB::XXPort Q_OBJECT public: - GMXXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); + GMXXXPort( KABC::AddressBook *ab, TQWidget *parent, const char *name = 0 ); - QString identifier() const { return "gmx"; } + TQString identifier() const { return "gmx"; } public slots: - bool exportContacts( const KABC::AddresseeList &list, const QString &data ); - KABC::AddresseeList importContacts( const QString &data ) const; + bool exportContacts( const KABC::AddresseeList &list, const TQString &data ); + KABC::AddresseeList importContacts( const TQString &data ) const; private: - void doExport( QFile *fp, const KABC::AddresseeList &list ); + void doExport( TQFile *fp, const KABC::AddresseeList &list ); }; #endif |