summaryrefslogtreecommitdiffabout
path: root/kaddressbook/xxport
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/xxport
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/xxport') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/xxport/csv_xxport.cpp14
-rw-r--r--kaddressbook/xxport/csvimportdialog.cpp66
-rw-r--r--kaddressbook/xxport/csvimportdialog.h12
-rw-r--r--kaddressbook/xxport/kde2_xxport.cpp4
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp20
5 files changed, 60 insertions, 56 deletions
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
@@ -21,25 +21,25 @@
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qfile.h>
#include <qregexp.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <kfiledialog.h>
#ifndef KAB_EMBEDDED
#include <kio/netaccess.h>
#endif //KAB_EMBEDDED
#include <klocale.h>
#include <kmessagebox.h>
#include <ktempfile.h>
#include <kurl.h>
@@ -95,45 +95,45 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString&
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 {
QFile file( url.path() );
- if ( !file.open( IO_WriteOnly ) ) {
+ if ( !file.open( QIODevice::WriteOnly ) ) {
QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" );
KMessageBox::error( parentWidget(), txt.arg( url.path() ) );
return false;
}
doExport( &file, list );
file.close();
return true;
}
#else //KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( "addressbook.csv", i18n("Save file"), parentWidget() );
if ( fileName.isEmpty() )
return false;
QFile file( fileName );
- if ( !file.open( IO_WriteOnly ) ) {
+ if ( !file.open( QIODevice::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;
#endif //KAB_EMBEDDED
@@ -142,25 +142,25 @@ bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString&
KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const
{
CSVImportDialog dlg( addressBook(), parentWidget() );
if ( dlg.exec() )
return dlg.contacts();
else
return KABC::AddresseeList();
}
void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list )
{
- QTextStream t( fp );
+ Q3TextStream t( fp );
t.setCodec( QTextCodec::codecForName("utf8") );
KABC::AddresseeList::ConstIterator iter;
KABC::Field::List fields = addressBook()->fields();
KABC::Field::List::Iterator fieldIter;
bool first = true;
// First output the column headings
for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) {
if ( !first )
t << ",";
@@ -178,17 +178,15 @@ void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list )
for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) {
if ( !first )
t << ",";
t << "\"" << (*fieldIter)->value( addr ) << "\"";
first = false;
}
t << "\n";
}
}
-#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
@@ -18,54 +18,58 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#ifdef DESKTOP_VERSION
#include <qinputdialog.h>
#else
#include <qtcompat/qinputdialog.h>
#endif
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
-#include <qtable.h>
+#include <q3table.h>
#include <qlayout.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3ValueList>
+#include <Q3GridLayout>
#include <kapplication.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <kfiledialog.h>
#include <klineedit.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#ifdef DESKTOP_VERSION
-#include "qtable.h"
+#include "q3table.h"
#else
#include "qcombotableitem.h"
#endif
#include "csvimportdialog.h"
CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
const char * name )
: KDialogBase( Plain, i18n ( "CSV Import Dialog" ), Ok | Cancel | User1 |
User2, Ok, parent, name, true, true ),
mAdjustRows( false ),
mStartLine( 0 ),
mTextQuote( '"' ),
@@ -152,50 +156,50 @@ CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
connect( mUrlRequester, SIGNAL( urlSelected( const QString& ) ),
this, SLOT( setFile( const QString& ) ) );
connect( mUrlRequester->lineEdit(), SIGNAL( textChanged ( const QString& ) ),
this, SLOT( urlChanged( const QString& ) ) );
connect( this, SIGNAL( user1Clicked() ),
this, SLOT( applyTemplate() ) );
connect( this, SIGNAL( user2Clicked() ),
this, SLOT( saveTemplate() ) );
// if ( QApplication::desktop()->width() < 321 )
- QIconSet icon = SmallIcon("filesave");
+ QIcon icon = SmallIcon("filesave");
findButton( User2 )->setIconSet (icon ) ;
icon = SmallIcon("fileopen");
findButton( User1 )->setIconSet (icon ) ;
int wid = findButton( User2 )->sizeHint().height();
findButton( User2 )->setMaximumWidth( wid+4 );
findButton( User1 )->setMaximumWidth( wid+4 );
}
CSVImportDialog::~CSVImportDialog()
{
}
KABC::AddresseeList CSVImportDialog::contacts() const
{
KABC::AddresseeList contacts;
for ( int row = 1; row < mTable->numRows(); ++row ) {
KABC::Addressee a;
bool emptyRow = true;
KABC::Address addrHome( KABC::Address::Home );
KABC::Address addrWork( KABC::Address::Work );
for ( int col = 0; col < mTable->numCols(); ++col ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, col ) );
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, col ) );
if ( !item ) {
qDebug( "ERROR: item cast failed" );
continue;
}
QString value = mTable->text( row, col );
if ( !value.isEmpty() )
emptyRow = false;
switch ( posToType( item->currentItem() ) )
{
@@ -220,25 +224,25 @@ KABC::AddresseeList CSVImportDialog::contacts() const
case Suffix:
a.setSuffix( value );
break;
case NickName:
a.setNickName( value );
break;
case Birthday:
//US
//the generated code had the following format: a.setBirthday( QDate::fromString( value, Qt::ISODate ) );
// 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:
if ( !value.isEmpty() )
a.insertEmail( value, true );
break;
case Role:
a.setRole( value );
break;
case Title:
a.setTitle( value );
break;
@@ -373,44 +377,44 @@ KABC::AddresseeList CSVImportDialog::contacts() const
if ( !emptyRow && !a.isEmpty() )
contacts.append( a );
}
return contacts;
}
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 );
hbox->addWidget( label );
mUrlRequester = new KURLRequester( page );
mUrlRequester->setFilter( "*.csv" );
hbox->addWidget( mUrlRequester );
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 );
mRadioComma = new QRadioButton( i18n( "Comma" ), mDelimiterBox );
mRadioComma->setChecked( true );
delimiterLayout->addWidget( mRadioComma, 0, 0 );
mRadioSemicolon = new QRadioButton( i18n( "Semicolon" ), mDelimiterBox );
delimiterLayout->addWidget( mRadioSemicolon, 0, 1 );
mRadioTab = new QRadioButton( i18n( "Tabulator" ), mDelimiterBox );
delimiterLayout->addWidget( mRadioTab, 1, 0 );
@@ -441,26 +445,26 @@ void CSVImportDialog::initGUI()
label = new QLabel( i18n( "Start at line:" ), page );
layout->addWidget( label, 2, 1 );
label = new QLabel( i18n( "Textquote:" ), page );
layout->addWidget( label, 2, 0 );
label = new QLabel( i18n( "Codec:" ), page );
layout->addWidget( label, 2, 2 );
mIgnoreDuplicates = new QCheckBox( page );
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
setButtonText( User1, i18n( "Apply Template" ) );
setButtonText( User2, i18n( "Save Template" ) );
*/
enableButtonOK( false );
findButton( User1 )->setEnabled( false );
findButton( User2 )->setEnabled( false );
@@ -474,68 +478,68 @@ void CSVImportDialog::initGUI()
void CSVImportDialog::fillTable()
{
int row, column;
bool lastCharDelimiter = false;
bool ignoreDups = mIgnoreDuplicates->isChecked();
enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD,
S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START;
QChar x;
QString field = "";
// store previous assignment
- QValueList<int> mTypeOld = mTypeStore;
+ Q3ValueList<int> mTypeOld = mTypeStore;
mTypeStore.clear();
for ( column = 0; column < mTable->numCols(); ++column ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) );
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, column ) );
if ( !item || mClearTypeStore )
mTypeStore.append( typeToPos( Undefined ) );
else if ( item )
mTypeStore.append( item->currentItem() );
}
clearTable();
row = column = 1;
if ( mComboCodec->currentItem () == 0 ) {
mData = QString::fromUtf8( mFileArray.data() );
} else if ( mComboCodec->currentItem () == 1 ) {
mData = QString::fromLatin1( mFileArray.data() );
} else {
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;
while ( !inputStream.atEnd() ) {
inputStream >> x; // read one char
if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly
switch ( state ) {
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;
} else if ( x == '\n' ) {
++row;
column = 1;
} else {
field += x;
state = S_MAYBE_NORMAL_FIELD;
}
break;
case S_QUOTED_FIELD :
@@ -552,81 +556,81 @@ void CSVImportDialog::fillTable()
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
field += x;
}
break;
case S_MAYBE_END_OF_QUOTED_FIELD :
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' ) {
++row;
column = 1;
} else {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
state = S_END_OF_QUOTED_FIELD;
}
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' ) {
++row;
column = 1;
} else {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
state = S_END_OF_QUOTED_FIELD;
}
break;
case S_MAYBE_NORMAL_FIELD :
if ( x == mTextQuote ) {
field = "";
state = S_QUOTED_FIELD;
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' ) {
++row;
column = 1;
} else {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
field += x;
}
}
- if ( x != mDelimiter )
+ if ( QString(x) != mDelimiter )
lastCharDelimiter = false;
if ( column > maxColumn )
maxColumn = column;
}
// file with only one line without '\n'
if ( field.length() > 0 ) {
setText( row - mStartLine + 1, column, field );
++row;
field = "";
}
@@ -640,25 +644,25 @@ void CSVImportDialog::fillTable()
while ( iii < count ) {
keys << "dummy";
++iii;
}
QMap<QString, uint>::ConstIterator it;
for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it)
keys[( it.data() )] = it.key();
//US end
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 ] );
else
item->setCurrentItem( typeToPos( Undefined ) );
mTable->adjustColumn( column );
}
}
void CSVImportDialog::clearTable()
{
@@ -755,25 +759,25 @@ void CSVImportDialog::textquoteSelected( const QString& mark )
void CSVImportDialog::lineSelected( const QString& line )
{
mStartLine = line.toInt() - 1;
fillTable();
}
void CSVImportDialog::slotOk()
{
bool assigned = false;
for ( int column = 0; column < mTable->numCols(); ++column ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0,
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0,
column ) );
if ( item && posToType( item->currentItem() ) != Undefined )
assigned = true;
}
if ( assigned )
KDialogBase::slotOk();
else
KMessageBox::sorry( this, i18n( "You have to assign at least one column." ) );
}
void CSVImportDialog::applyTemplate()
@@ -827,25 +831,25 @@ void CSVImportDialog::applyTemplate()
textquoteSelected( mComboQuote->currentText() );
// create the column map
config.setGroup( "csv column map" );
for ( uint i = 0; i < numColumns; ++i ) {
int col = config.readNumEntry( QString::number( i ) );
columnMap.insert( i, col );
}
// apply the column map
for ( uint column = 0; column < columnMap.count(); ++column ) {
int type = columnMap[ column ];
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0,
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0,
column ) );
if ( item )
item->setCurrentItem( typeToPos( type ) );
}
}
void CSVImportDialog::saveTemplate()
{
/*US
QString fileName = KFileDialog::getSaveFileName(
locateLocal( "data", QString( kapp->name() ) + "/csv-templates/" ),
"*.desktop", this );
@@ -869,25 +873,25 @@ void CSVImportDialog::saveTemplate()
config.setGroup( "General" );
config.writeEntry( "Columns", mTable->numCols() );
config.writeEntry( "DelimiterType", mDelimiterBox->id( mDelimiterBox->selected() ) );
config.writeEntry( "DelimiterOther", mDelimiterEdit->text() );
config.writeEntry( "QuoteType", mComboQuote->currentItem() );
config.setGroup( "Misc" );
config.writeEntry( "Name", name );
config.setGroup( "csv column map" );
for ( uint column = 0; column < mTable->numCols(); ++column ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0,
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0,
column ) );
if ( item )
config.writeEntry( QString::number( column ), posToType(
item->currentItem() ) );
else
config.writeEntry( QString::number( column ), 0 );
}
config.sync();
}
QString CSVImportDialog::getText( int row, int col )
@@ -925,25 +929,25 @@ int CSVImportDialog::typeToPos( uint type ) const
void CSVImportDialog::ignoreDuplicatesChanged( int )
{
fillTable();
}
void CSVImportDialog::setFile( const QString &fileName )
{
if ( fileName.isEmpty() )
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;
}
mFileArray = file.readAll();
file.close();
mClearTypeStore = true;
clearTable();
mTable->setNumCols( 0 );
mTable->setNumRows( 0 );
@@ -955,15 +959,15 @@ void CSVImportDialog::setFile( const QString &fileName )
void CSVImportDialog::urlChanged( const QString &file )
{
bool state = !file.isEmpty();
enableButtonOK( state );
findButton( User1 )->setEnabled( state );
findButton( User2 )->setEnabled( state );
}
-#ifndef KAB_EMBEDDED
-#include <csvimportdialog.moc>
+#ifndef KAB_EMBEDDED_
+#include <moc_csvimportdialog.cpp>
#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
@@ -24,35 +24,35 @@ Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef CSV_IMPORT_DLG_H
#define CSV_IMPORT_DLG_H
#include <kabc/addressbook.h>
#include <kabc/addresseelist.h>
#include <kdialogbase.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
class KURLRequester;
-class QButtonGroup;
+class Q3ButtonGroup;
class QComboBox;
class QCheckBox;
class QLineEdit;
class QPushButton;
class QRadioButton;
-class QTable;
+class Q3Table;
class CSVImportDialog : public KDialogBase
{
Q_OBJECT
public:
CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 );
~CSVImportDialog();
KABC::AddresseeList contacts() const;
@@ -76,26 +76,26 @@ class CSVImportDialog : public KDialogBase
private:
enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName,
Prefix, Suffix, NickName, Birthday,
HomeAddressStreet, HomeAddressLocality, HomeAddressRegion,
HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel,
BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion,
BusinessAddressPostalCode, BusinessAddressCountry,
BusinessAddressLabel,
HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, MobileWorkPhone,
Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL, Categories
};
- QTable* mTable;
- QButtonGroup* mDelimiterBox;
+ Q3Table* mTable;
+ Q3ButtonGroup* mDelimiterBox;
QRadioButton* mRadioComma;
QRadioButton* mRadioSemicolon;
QRadioButton* mRadioTab;
QRadioButton* mRadioSpace;
QRadioButton* mRadioOther;
QLineEdit* mDelimiterEdit;
QComboBox* mComboLine;
QComboBox* mComboQuote;
QComboBox* mComboCodec;
QCheckBox* mIgnoreDuplicates;
KURLRequester* mUrlRequester;
@@ -110,17 +110,17 @@ class CSVImportDialog : public KDialogBase
int typeToPos( uint type ) const;
bool mAdjustRows;
int mStartLine;
QChar mTextQuote;
QString mDelimiter;
QString mData;
QByteArray mFileArray;
QMap<QString, uint> mTypeMap;
KABC::AddressBook *mAddressBook;
int mCustomCounter;
bool mClearTypeStore;
- QValueList<int> mTypeStore;
+ Q3ValueList<int> mTypeStore;
};
#endif
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
@@ -107,15 +107,15 @@ KABC::AddresseeList KDE2XXPort::importContacts( const QString& ) const
} else if ( result == KMessageBox::No )
proc << "kab2kabc";
else
kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl;
proc.start( KProcess::Block );
addressBook()->load();
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
@@ -20,26 +20,28 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kabc/vcardconverter.h>
#include <kabc/vcardparser/vcardtool.h>
#include <kfiledialog.h>
#ifndef KAB_EMBEDDED
#include <kio/netaccess.h>
#endif //KAB_EMBEDDED
#include <klocale.h>
#include <kmessagebox.h>
#include <ktempfile.h>
#include <kurl.h>
@@ -93,32 +95,32 @@ bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString
name = "addressbook.vcf";
#ifndef KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( name );
#else //KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() );
#endif //KAB_EMBEDDED
if ( fileName.isEmpty() )
return false;
QFile outFile( fileName );
- if ( !outFile.open( IO_WriteOnly ) ) {
+ if ( !outFile.open( QIODevice::WriteOnly ) ) {
QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
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 ) {
KABC::VCardConverter converter;
QString vcard;
KABC::VCardConverter::Version version;
if ( data == "v21" )
version = KABC::VCardConverter::v2_1;
else
version = KABC::VCardConverter::v3_0;
@@ -144,25 +146,25 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const
if ( XXPortManager::importURL.isEmpty() )
{
url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() );
}
else
url = XXPortManager::importURL;
if ( url.isEmpty() )
return addrList;
QString caption( i18n( "vCard Import Failed" ) );
if ( KIO::NetAccess::download( url, fileName ) ) {
QFile file( fileName );
- file.open( IO_ReadOnly );
+ file.open( QIODevice::ReadOnly );
QByteArray rawData = file.readAll();
file.close();
QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
addrList = parseVCard( data );
if ( !url.isLocalFile() )
KIO::NetAccess::removeTempFile( fileName );
} else {
QString text = i18n( "<qt>Unable to access <b>%1</b>.</qt>" );
KMessageBox::error( parentWidget(), text.arg( url.url() ), caption );
@@ -187,26 +189,26 @@ KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const
if ( !fi.isFile() )
return addrList;
}
else
{
//US url = XXPortManager::importURL;
qDebug("VCardXXPort::importContacts Urls at the moment not supported");
if ( url.isEmpty() )
return addrList;
}
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
while ( start < rawData.size()-2 ) {
if ( rawData.at( start ) == '\r' )
if ( rawData.at( start+1 ) == '\n' )
if ( rawData.at( start+2 ) == ' ' ) {
rawData.remove(start,3);
--start;
}
++start;
}
@@ -258,15 +260,15 @@ KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const
KMessageBox::sorry( parentWidget(), text );
}
}
*/
if ( addrList.isEmpty() ) {
QString text = i18n( "The selected file does not\ninclude a valid vCard.\nPlease check the file and try again.\n" );
KMessageBox::sorry( parentWidget(), text );
}
return addrList;
}
-#ifndef KAB_EMBEDDED
-#include "vcard_xxport.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_vcard_xxport.cpp"
#endif //KAB_EMBEDDED