From a08aff328d4393031d5ba7d622c2b05705a89d73 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Wed, 04 Jul 2007 11:23:42 +0000 Subject: initial public commit of qt4 port --- (limited to 'kaddressbook/xxport') diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp index 7281003..ed5807f 100644 --- a/kaddressbook/xxport/csv_xxport.cpp +++ b/kaddressbook/xxport/csv_xxport.cpp @@ -30,7 +30,7 @@ $Id$ #include #include -#include +#include #include #include @@ -104,7 +104,7 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() ); } else { QFile file( url.path() ); - if ( !file.open( IO_WriteOnly ) ) { + if ( !file.open( QIODevice::WriteOnly ) ) { QString txt = i18n( "Unable to open file %1." ); KMessageBox::error( parentWidget(), txt.arg( url.path() ) ); return false; @@ -124,7 +124,7 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& return false; QFile file( fileName ); - if ( !file.open( IO_WriteOnly ) ) { + if ( !file.open( QIODevice::WriteOnly ) ) { QString txt = i18n( "Unable to open file %1." ); KMessageBox::error( parentWidget(), txt.arg( fileName ) ); return false; @@ -151,7 +151,7 @@ KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) { - QTextStream t( fp ); + Q3TextStream t( fp ); t.setCodec( QTextCodec::codecForName("utf8") ); KABC::AddresseeList::ConstIterator iter; @@ -187,8 +187,6 @@ void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) } } -#ifndef KAB_EMBEDDED -#include "csv_xxport.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_csv_xxport.cpp" #endif //KAB_EMBEDDED - - diff --git a/kaddressbook/xxport/csvimportdialog.cpp b/kaddressbook/xxport/csvimportdialog.cpp index 862241e..7959cac 100644 --- a/kaddressbook/xxport/csvimportdialog.cpp +++ b/kaddressbook/xxport/csvimportdialog.cpp @@ -27,7 +27,7 @@ $Id$ */ -#include +#include #include #include #ifdef DESKTOP_VERSION @@ -39,10 +39,14 @@ $Id$ #include #include #include -#include +#include #include -#include +#include #include +//Added by qt3to4: +#include +#include +#include #include #include @@ -56,7 +60,7 @@ $Id$ #include #ifdef DESKTOP_VERSION -#include "qtable.h" +#include "q3table.h" #else #include "qcombotableitem.h" #endif @@ -161,7 +165,7 @@ CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent, this, SLOT( saveTemplate() ) ); // if ( QApplication::desktop()->width() < 321 ) - QIconSet icon = SmallIcon("filesave"); + QIcon icon = SmallIcon("filesave"); findButton( User2 )->setIconSet (icon ) ; icon = SmallIcon("fileopen"); @@ -186,7 +190,7 @@ KABC::AddresseeList CSVImportDialog::contacts() const KABC::Address addrWork( KABC::Address::Work ); for ( int col = 0; col < mTable->numCols(); ++col ) { - QComboTableItem *item = static_cast( mTable->item( 0, col ) ); + Q3ComboTableItem *item = static_cast( mTable->item( 0, col ) ); if ( !item ) { qDebug( "ERROR: item cast failed" ); @@ -229,7 +233,7 @@ KABC::AddresseeList CSVImportDialog::contacts() const // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? { QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate - a.setBirthday(dt); + a.setBirthday(QDateTime(dt)); } break; case Email: @@ -382,9 +386,9 @@ void CSVImportDialog::initGUI() { QWidget* page = plainPage(); - QGridLayout *layout = new QGridLayout( page, 1, 1, marginHintSmall(), + Q3GridLayout *layout = new Q3GridLayout( page, 1, 1, marginHintSmall(), spacingHintSmall() ); - QHBoxLayout *hbox = new QHBoxLayout(); + Q3HBoxLayout *hbox = new Q3HBoxLayout(); hbox->setSpacing( spacingHint() ); QLabel *label = new QLabel( i18n( "File to import:" ), page ); @@ -397,11 +401,11 @@ void CSVImportDialog::initGUI() layout->addMultiCellLayout( hbox, 0, 0, 0, 2 ); // Delimiter: comma, semicolon, tab, space, other - mDelimiterBox = new QButtonGroup( i18n( "Delimiter" ), page ); + mDelimiterBox = new Q3ButtonGroup( i18n( "Delimiter" ), page ); mDelimiterBox->setColumnLayout( 0, Qt::Vertical ); mDelimiterBox->layout()->setSpacing( spacingHint() ); mDelimiterBox->layout()->setMargin( marginHint() ); - QGridLayout *delimiterLayout = new QGridLayout( mDelimiterBox->layout() ); + Q3GridLayout *delimiterLayout = new Q3GridLayout( mDelimiterBox->layout() ); delimiterLayout->setAlignment( Qt::AlignTop ); layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 2 ); @@ -450,8 +454,8 @@ void CSVImportDialog::initGUI() mIgnoreDuplicates->setText( i18n( "Ignore duplicate delimiters" ) ); layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 2 ); - mTable = new QTable( 0, 0, page ); - mTable->setSelectionMode( QTable::NoSelection ); + mTable = new Q3Table( 0, 0, page ); + mTable->setSelectionMode( Q3Table::NoSelection ); //mTable->horizontalHeader()->hide(); layout->addMultiCellWidget( mTable, 5, 5, 0, 2 ); /*US @@ -483,11 +487,11 @@ void CSVImportDialog::fillTable() QString field = ""; // store previous assignment - QValueList mTypeOld = mTypeStore; + Q3ValueList mTypeOld = mTypeStore; mTypeStore.clear(); for ( column = 0; column < mTable->numCols(); ++column ) { - QComboTableItem *item = static_cast( mTable->item( 0, column ) ); + Q3ComboTableItem *item = static_cast( mTable->item( 0, column ) ); if ( !item || mClearTypeStore ) mTypeStore.append( typeToPos( Undefined ) ); @@ -506,14 +510,14 @@ void CSVImportDialog::fillTable() mData = QString::fromLocal8Bit( mFileArray.data() ); } - QTextStream inputStream( mData, IO_ReadOnly ); + Q3TextStream inputStream( mData, QIODevice::ReadOnly ); if ( mComboCodec->currentItem () == 0 ) { - inputStream.setEncoding( QTextStream::UnicodeUTF8 ); + inputStream.setEncoding( Q3TextStream::UnicodeUTF8 ); } else if ( mComboCodec->currentItem () == 1 ) { - inputStream.setEncoding( QTextStream::Latin1 ); + inputStream.setEncoding( Q3TextStream::Latin1 ); } else { - inputStream.setEncoding( QTextStream::Locale ); + inputStream.setEncoding( Q3TextStream::Locale ); } int maxColumn = 0; @@ -526,7 +530,7 @@ void CSVImportDialog::fillTable() case S_START : if ( x == mTextQuote ) { state = S_QUOTED_FIELD; - } else if ( x == mDelimiter ) { + } else if ( QString(x) == mDelimiter ) { if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) ) ++column; lastCharDelimiter = true; @@ -561,7 +565,7 @@ void CSVImportDialog::fillTable() if ( x == mTextQuote ) { field += x; state = S_QUOTED_FIELD; - } else if ( x == mDelimiter || x == '\n' ) { + } else if ( QString(x) == mDelimiter || x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { @@ -578,7 +582,7 @@ void CSVImportDialog::fillTable() } break; case S_END_OF_QUOTED_FIELD : - if ( x == mDelimiter || x == '\n' ) { + if ( QString(x) == mDelimiter || x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { @@ -601,7 +605,7 @@ void CSVImportDialog::fillTable() break; } case S_NORMAL_FIELD : - if ( x == mDelimiter || x == '\n' ) { + if ( QString(x) == mDelimiter || x == '\n' ) { setText( row - mStartLine + 1, column, field ); field = ""; if ( x == '\n' ) { @@ -617,7 +621,7 @@ void CSVImportDialog::fillTable() field += x; } } - if ( x != mDelimiter ) + if ( QString(x) != mDelimiter ) lastCharDelimiter = false; if ( column > maxColumn ) @@ -649,7 +653,7 @@ void CSVImportDialog::fillTable() for ( column = 0; column < mTable->numCols(); ++column ) { //US QComboTableItem *item = new QComboTableItem( mTable, mTypeMap.keys() ); - QComboTableItem *item = new QComboTableItem( mTable, keys ); + Q3ComboTableItem *item = new Q3ComboTableItem( mTable, keys ); mTable->setItem( 0, column, item ); if ( column < mTypeStore.count() ) item->setCurrentItem( mTypeStore[ column ] ); @@ -764,7 +768,7 @@ void CSVImportDialog::slotOk() bool assigned = false; for ( int column = 0; column < mTable->numCols(); ++column ) { - QComboTableItem *item = static_cast( mTable->item( 0, + Q3ComboTableItem *item = static_cast( mTable->item( 0, column ) ); if ( item && posToType( item->currentItem() ) != Undefined ) assigned = true; @@ -836,7 +840,7 @@ void CSVImportDialog::applyTemplate() // apply the column map for ( uint column = 0; column < columnMap.count(); ++column ) { int type = columnMap[ column ]; - QComboTableItem *item = static_cast( mTable->item( 0, + Q3ComboTableItem *item = static_cast( mTable->item( 0, column ) ); if ( item ) item->setCurrentItem( typeToPos( type ) ); @@ -878,7 +882,7 @@ void CSVImportDialog::saveTemplate() config.setGroup( "csv column map" ); for ( uint column = 0; column < mTable->numCols(); ++column ) { - QComboTableItem *item = static_cast( mTable->item( 0, + Q3ComboTableItem *item = static_cast( mTable->item( 0, column ) ); if ( item ) config.writeEntry( QString::number( column ), posToType( @@ -934,7 +938,7 @@ void CSVImportDialog::setFile( const QString &fileName ) return; QFile file( fileName ); - if ( !file.open( IO_ReadOnly ) ) { + if ( !file.open( QIODevice::ReadOnly ) ) { KMessageBox::sorry( this, i18n( "Cannot open input file!" ) ); file.close(); return; @@ -964,6 +968,6 @@ void CSVImportDialog::urlChanged( const QString &file ) } -#ifndef KAB_EMBEDDED -#include +#ifndef KAB_EMBEDDED_ +#include #endif //KAB_EMBEDDED diff --git a/kaddressbook/xxport/csvimportdialog.h b/kaddressbook/xxport/csvimportdialog.h index 2661420..520f3fa 100644 --- a/kaddressbook/xxport/csvimportdialog.h +++ b/kaddressbook/xxport/csvimportdialog.h @@ -33,17 +33,17 @@ $Id$ #include #include -#include +#include class KURLRequester; -class QButtonGroup; +class Q3ButtonGroup; class QComboBox; class QCheckBox; class QLineEdit; class QPushButton; class QRadioButton; -class QTable; +class Q3Table; class CSVImportDialog : public KDialogBase { @@ -85,8 +85,8 @@ class CSVImportDialog : public KDialogBase Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL, Categories }; - QTable* mTable; - QButtonGroup* mDelimiterBox; + Q3Table* mTable; + Q3ButtonGroup* mDelimiterBox; QRadioButton* mRadioComma; QRadioButton* mRadioSemicolon; QRadioButton* mRadioTab; @@ -119,7 +119,7 @@ class CSVImportDialog : public KDialogBase KABC::AddressBook *mAddressBook; int mCustomCounter; bool mClearTypeStore; - QValueList mTypeStore; + Q3ValueList mTypeStore; }; diff --git a/kaddressbook/xxport/kde2_xxport.cpp b/kaddressbook/xxport/kde2_xxport.cpp index 03efc1b..72d3fc2 100644 --- a/kaddressbook/xxport/kde2_xxport.cpp +++ b/kaddressbook/xxport/kde2_xxport.cpp @@ -116,6 +116,6 @@ KABC::AddresseeList KDE2XXPort::importContacts( const QString& ) const return KABC::AddresseeList(); } -#ifndef KAB_EMBEDDED -#include "kde2_xxport.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_kde2_xxport.cpp" #endif //KAB_EMBEDDED diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp index 9a8fa68..64b9071 100644 --- a/kaddressbook/xxport/vcard_xxport.cpp +++ b/kaddressbook/xxport/vcard_xxport.cpp @@ -29,8 +29,10 @@ */ #include -#include +#include #include +//Added by qt3to4: +#include #include #include @@ -102,14 +104,14 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString return false; QFile outFile( fileName ); - if ( !outFile.open( IO_WriteOnly ) ) { + if ( !outFile.open( QIODevice::WriteOnly ) ) { QString text = i18n( "Unable to open file %1 for export." ); KMessageBox::error( parentWidget(), text.arg( fileName ) ); return false; } - QTextStream t( &outFile ); - t.setEncoding( QTextStream::UnicodeUTF8 ); + Q3TextStream t( &outFile ); + t.setEncoding( Q3TextStream::UnicodeUTF8 ); KABC::Addressee::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { @@ -153,7 +155,7 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const if ( KIO::NetAccess::download( url, fileName ) ) { QFile file( fileName ); - file.open( IO_ReadOnly ); + file.open( QIODevice::ReadOnly ); QByteArray rawData = file.readAll(); file.close(); @@ -196,8 +198,8 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const } QFile file( fileName ); - if ( file.open( IO_ReadOnly ) ) { - QCString rawData ( file.readAll().data(),file.size()+1); + if ( file.open( QIODevice::ReadOnly ) ) { + Q3CString rawData ( file.readAll().data(),file.size()+1); file.close(); int start = 0; #ifndef DESKTOP_VERSION @@ -267,6 +269,6 @@ KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const } -#ifndef KAB_EMBEDDED -#include "vcard_xxport.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_vcard_xxport.cpp" #endif //KAB_EMBEDDED -- cgit v0.9.0.2