From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kaddressbook/xxport/vcard_xxport.cpp | 98 ++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'kaddressbook/xxport/vcard_xxport.cpp') diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index 9fb36827..85cf8c76 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -21,12 +21,12 @@ without including the source code for Qt in the source distribution. */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -56,7 +56,7 @@ class VCardViewerDialog : public KDialogBase { public: VCardViewerDialog( const KABC::Addressee::List &list, - QWidget *parent, const char *name = 0 ); + TQWidget *parent, const char *name = 0 ); KABC::Addressee::List contacts() const; @@ -78,7 +78,7 @@ class VCardViewerDialog : public KDialogBase class VCardExportSelectionDialog : public KDialogBase { public: - VCardExportSelectionDialog( QWidget *parent, const char *name = 0 ); + VCardExportSelectionDialog( TQWidget *parent, const char *name = 0 ); ~VCardExportSelectionDialog(); bool exportPrivateFields() const; @@ -87,13 +87,13 @@ class VCardExportSelectionDialog : public KDialogBase bool exportEncryptionKeys() const; private: - QCheckBox *mPrivateBox; - QCheckBox *mBusinessBox; - QCheckBox *mOtherBox; - QCheckBox *mEncryptionKeys; + TQCheckBox *mPrivateBox; + TQCheckBox *mBusinessBox; + TQCheckBox *mOtherBox; + TQCheckBox *mEncryptionKeys; }; -VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) +VCardXXPort::VCardXXPort( KABC::AddressBook *ab, TQWidget *parent, const char *name ) : KAB::XXPort( ab, parent, name ) { createImportAction( i18n( "Import vCard..." ) ); @@ -101,7 +101,7 @@ VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *na createExportAction( i18n( "Export vCard 3.0..." ), "v30" ); } -bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const QString &data ) +bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const TQString &data ) { KABC::VCardConverter converter; KURL url; @@ -122,10 +122,10 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const QSt else ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v3_0 ) ); } else { - QString msg = i18n( "You have selected a list of contacts, shall they be " + TQString msg = i18n( "You have selected a list of contacts, shall they be " "exported to several files?" ); - switch ( KMessageBox::questionYesNo( parentWidget(), msg, QString::null, i18n("Export to Several Files"), i18n("Export to One File") ) ) { + switch ( KMessageBox::questionYesNo( parentWidget(), msg, TQString::null, i18n("Export to Several Files"), i18n("Export to One File") ) ) { case KMessageBox::Yes: { KURL baseUrl = KFileDialog::getExistingURL(); if ( baseUrl.isEmpty() ) @@ -134,15 +134,15 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const QSt KABC::AddresseeList::ConstIterator it; uint counter = 0; for ( it = list.begin(); it != list.end(); ++it ) { - QString testUrl; + TQString testUrl; if ( (*it).givenName().isEmpty() && (*it).familyName().isEmpty() ) testUrl = baseUrl.url() + "/" + (*it).organization(); else testUrl = baseUrl.url() + "/" + (*it).givenName() + "_" + (*it).familyName(); - if ( KIO::NetAccess::exists( testUrl + (counter == 0 ? "" : QString::number( counter )) + ".vcf", false, parentWidget() ) ) { + if ( KIO::NetAccess::exists( testUrl + (counter == 0 ? "" : TQString::number( counter )) + ".vcf", false, parentWidget() ) ) { counter++; - url = testUrl + QString::number( counter ) + ".vcf"; + url = testUrl + TQString::number( counter ) + ".vcf"; } else url = testUrl + ".vcf"; @@ -176,9 +176,9 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const QSt return ok; } -KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const +KABC::AddresseeList VCardXXPort::importContacts( const TQString& ) const { - QString fileName; + TQString fileName; KABC::AddresseeList addrList; KURL::List urls; @@ -186,7 +186,7 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const addrList = parseVCard( XXPortManager::importData ); else { if ( XXPortManager::importURL.isEmpty() ) - urls = KFileDialog::getOpenURLs( QString::null, "*.vcf|vCards", parentWidget(), + urls = KFileDialog::getOpenURLs( TQString::null, "*.vcf|vCards", parentWidget(), i18n( "Select vCard to Import" ) ); else urls.append( XXPortManager::importURL ); @@ -194,31 +194,31 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const if ( urls.count() == 0 ) return addrList; - QString caption( i18n( "vCard Import Failed" ) ); + TQString caption( i18n( "vCard Import Failed" ) ); bool anyFailures = false; KURL::List::Iterator it; for ( it = urls.begin(); it != urls.end(); ++it ) { if ( KIO::NetAccess::download( *it, fileName, parentWidget() ) ) { - QFile file( fileName ); + TQFile file( fileName ); if ( file.open( IO_ReadOnly ) ) { - QByteArray rawData = file.readAll(); + TQByteArray rawData = file.readAll(); file.close(); if ( rawData.size() > 0 ) addrList += parseVCard( rawData ); KIO::NetAccess::removeTempFile( fileName ); } else { - QString text = i18n( "When trying to read the vCard, there was an error opening the file '%1': %2" ); + TQString text = i18n( "When trying to read the vCard, there was an error opening the file '%1': %2" ); text = text.arg( (*it).url() ); - text = text.arg( kapp->translate( "QFile", + text = text.arg( kapp->translate( "TQFile", file.errorString().latin1() ) ); KMessageBox::error( parentWidget(), text, caption ); anyFailures = true; } } else { - QString text = i18n( "Unable to access vCard: %1" ); + TQString text = i18n( "Unable to access vCard: %1" ); text = text.arg( KIO::NetAccess::lastErrorString() ); KMessageBox::error( parentWidget(), text, caption ); anyFailures = true; @@ -243,20 +243,20 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const return addrList; } -KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const +KABC::AddresseeList VCardXXPort::parseVCard( const TQString &data ) const { KABC::VCardConverter converter; return converter.parseVCards( data ); } -bool VCardXXPort::doExport( const KURL &url, const QString &data ) +bool VCardXXPort::doExport( const KURL &url, const TQString &data ) { KTempFile tmpFile; tmpFile.setAutoDelete( true ); - QTextStream stream( tmpFile.file() ); - stream.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream stream( tmpFile.file() ); + stream.setEncoding( TQTextStream::UnicodeUTF8 ); stream << data; tmpFile.close(); @@ -364,7 +364,7 @@ KABC::AddresseeList VCardXXPort::filterContacts( const KABC::AddresseeList &addr void VCardXXPort::addKey( KABC::Addressee &addr, KABC::Key::Types type ) { - QString fingerprint = addr.custom( "KADDRESSBOOK", + TQString fingerprint = addr.custom( "KADDRESSBOOK", (type == KABC::Key::PGP ? "OPENPGPFP" : "SMIMEFP") ); if ( fingerprint.isEmpty() ) return; @@ -398,23 +398,23 @@ void VCardXXPort::addKey( KABC::Addressee &addr, KABC::Key::Types type ) // ---------- VCardViewer Dialog ---------------- // VCardViewerDialog::VCardViewerDialog( const KABC::Addressee::List &list, - QWidget *parent, const char *name ) + TQWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "Import vCard" ), Yes | No | Apply | Cancel, Yes, parent, name, true, true, KStdGuiItem::no(), KStdGuiItem::yes() ), mContacts( list ) { - QFrame *page = plainPage(); - QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); + TQFrame *page = plainPage(); + TQVBoxLayout *layout = new TQVBoxLayout( page, marginHint(), spacingHint() ); - QLabel *label = new QLabel( i18n( "Do you want to import this contact in your address book?" ), page ); - QFont font = label->font(); + TQLabel *label = new TQLabel( i18n( "Do you want to import this contact in your address book?" ), page ); + TQFont font = label->font(); font.setBold( true ); label->setFont( font ); layout->addWidget( label ); mView = new KPIM::AddresseeView( page ); mView->enableLinks( 0 ); - mView->setVScrollBarMode( QScrollView::Auto ); + mView->setVScrollBarMode( TQScrollView::Auto ); layout->addWidget( mView ); setButtonText( Apply, i18n( "Import All..." ) ); @@ -459,39 +459,39 @@ void VCardViewerDialog::slotUser2() void VCardViewerDialog::slotApply() { - QDialog::accept(); + TQDialog::accept(); } void VCardViewerDialog::slotCancel() { mContacts.clear(); - QDialog::accept(); + TQDialog::accept(); } // ---------- VCardExportSelection Dialog ---------------- // -VCardExportSelectionDialog::VCardExportSelectionDialog( QWidget *parent, +VCardExportSelectionDialog::VCardExportSelectionDialog( TQWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "Select vCard Fields" ), Ok | Cancel, Ok, parent, name, true, true ) { - QFrame *page = plainPage(); + TQFrame *page = plainPage(); - QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); + TQVBoxLayout *layout = new TQVBoxLayout( page, marginHint(), spacingHint() ); - QLabel *label = new QLabel( i18n( "Select the fields which shall be exported in the vCard." ), page ); + TQLabel *label = new TQLabel( i18n( "Select the fields which shall be exported in the vCard." ), page ); layout->addWidget( label ); - mPrivateBox = new QCheckBox( i18n( "Private fields" ), page ); + mPrivateBox = new TQCheckBox( i18n( "Private fields" ), page ); layout->addWidget( mPrivateBox ); - mBusinessBox = new QCheckBox( i18n( "Business fields" ), page ); + mBusinessBox = new TQCheckBox( i18n( "Business fields" ), page ); layout->addWidget( mBusinessBox ); - mOtherBox = new QCheckBox( i18n( "Other fields" ), page ); + mOtherBox = new TQCheckBox( i18n( "Other fields" ), page ); layout->addWidget( mOtherBox ); - mEncryptionKeys = new QCheckBox( i18n( "Encryption keys" ), page ); + mEncryptionKeys = new TQCheckBox( i18n( "Encryption keys" ), page ); layout->addWidget( mEncryptionKeys ); KConfig config( "kaddressbookrc" ); -- cgit v1.2.3