summaryrefslogtreecommitdiffabout
path: root/kde2file/abdump/main.cpp
Unidiff
Diffstat (limited to 'kde2file/abdump/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kde2file/abdump/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/kde2file/abdump/main.cpp b/kde2file/abdump/main.cpp
index b359cfe..824d054 100644
--- a/kde2file/abdump/main.cpp
+++ b/kde2file/abdump/main.cpp
@@ -81,49 +81,50 @@ int main( int argc, char *argv[] )
81 KCmdLineArgs::init( argc, argv, &aboutData, true ); 81 KCmdLineArgs::init( argc, argv, &aboutData, true );
82 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. 82 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
83 83
84 KInstance ins ( progName ); 84 KInstance ins ( progName );
85 85
86 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 86 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
87 87
88 bool read = false; 88 bool read = false;
89 if ( args->isSet( "read" ) ) { 89 if ( args->isSet( "read" ) ) {
90 read = true; 90 read = true;
91 qDebug("read "); 91 qDebug("read ");
92 } 92 }
93 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; 93 QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf";
94 94
95 KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self(); 95 KABC::StdAddressBook* standardAddressBook = KABC::StdAddressBook::self();
96 standardAddressBook->setAutomaticSave( false ); 96 standardAddressBook->setAutomaticSave( false );
97 qDebug("************************************* "); 97 qDebug("************************************* ");
98 qDebug("***************kdeABdump************* "); 98 qDebug("***************kdeABdump************* ");
99 qDebug("************************************* "); 99 qDebug("************************************* ");
100 if ( !read ) { 100 if ( !read ) {
101 KABC::AddressBook::Iterator it; 101 KABC::AddressBook::Iterator it;
102 KABC::VCardConverter converter; 102 KABC::VCardConverter converter;
103 QString datastream; 103 QString datastream;
104 for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) { 104 for( it = standardAddressBook->begin(); it != standardAddressBook->end(); ++it ) {
105 if ( (*it).isEmpty() || ! (*it).resource() ) 105 // if ( (*it).isEmpty() || ! (*it).resource() )
106 if ( (*it).isEmpty() )
106 continue; 107 continue;
107 KABC::Addressee a = ( *it ); 108 KABC::Addressee a = ( *it );
108 QString vcard = converter.createVCard( a ); 109 QString vcard = converter.createVCard( a );
109 vcard += QString("\r\n"); 110 vcard += QString("\r\n");
110 datastream += vcard; 111 datastream += vcard;
111 } 112 }
112 QFile outFile(fileName); 113 QFile outFile(fileName);
113 if ( outFile.open(IO_WriteOnly) ) { 114 if ( outFile.open(IO_WriteOnly) ) {
114 QTextStream t( &outFile ); // use a text stream 115 QTextStream t( &outFile ); // use a text stream
115 t.setEncoding( QTextStream::UnicodeUTF8 ); 116 t.setEncoding( QTextStream::UnicodeUTF8 );
116 t <<datastream; 117 t <<datastream;
117 t << "\r\n\r\n"; 118 t << "\r\n\r\n";
118 outFile.close(); 119 outFile.close();
119 } 120 }
120 } else { 121 } else {
121 //Addressee::List aList;//parseVCards( const QString& vcard ); 122 //Addressee::List aList;//parseVCards( const QString& vcard );
122 KABC::Addressee::List list; 123 KABC::Addressee::List list;
123 int added = 0, changedC = 0, deleted = 0; 124 int added = 0, changedC = 0, deleted = 0;
124 QFile file( fileName ); 125 QFile file( fileName );
125 if ( file.open( IO_ReadOnly ) ) { 126 if ( file.open( IO_ReadOnly ) ) {
126 QTextStream t( &file ); // use a text stream 127 QTextStream t( &file ); // use a text stream
127 t.setEncoding( QTextStream::UnicodeUTF8 ); 128 t.setEncoding( QTextStream::UnicodeUTF8 );
128 QString data; 129 QString data;
129 data = t.read(); 130 data = t.read();