summaryrefslogtreecommitdiffabout
path: root/kde2file/abdump
Unidiff
Diffstat (limited to 'kde2file/abdump') (more/less context) (ignore whitespace changes)
-rw-r--r--kde2file/abdump/main.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/kde2file/abdump/main.cpp b/kde2file/abdump/main.cpp
index 1ee64f5..9ad78e5 100644
--- a/kde2file/abdump/main.cpp
+++ b/kde2file/abdump/main.cpp
@@ -83,50 +83,48 @@ int main( int argc, char *argv[] )
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 continue; 106 continue;
107 if ( (*it).resource()->readOnly() )
108 continue;
109 KABC::Addressee a = ( *it ); 107 KABC::Addressee a = ( *it );
110 QString vcard = converter.createVCard( a ); 108 QString vcard = converter.createVCard( a );
111 vcard += QString("\r\n"); 109 vcard += QString("\r\n");
112 datastream += vcard; 110 datastream += vcard;
113 } 111 }
114 QFile outFile(fileName); 112 QFile outFile(fileName);
115 if ( outFile.open(IO_WriteOnly) ) { 113 if ( outFile.open(IO_WriteOnly) ) {
116 QTextStream t( &outFile ); // use a text stream 114 QTextStream t( &outFile ); // use a text stream
117 t.setEncoding( QTextStream::UnicodeUTF8 ); 115 t.setEncoding( QTextStream::UnicodeUTF8 );
118 t <<datastream; 116 t <<datastream;
119 t << "\r\n\r\n"; 117 t << "\r\n\r\n";
120 outFile.close(); 118 outFile.close();
121 } 119 }
122 } else { 120 } else {
123 //Addressee::List aList;//parseVCards( const QString& vcard ); 121 //Addressee::List aList;//parseVCards( const QString& vcard );
124 KABC::Addressee::List list; 122 KABC::Addressee::List list;
125 int added = 0, changedC = 0, deleted = 0; 123 int added = 0, changedC = 0, deleted = 0;
126 QFile file( fileName ); 124 QFile file( fileName );
127 if ( file.open( IO_ReadOnly ) ) { 125 if ( file.open( IO_ReadOnly ) ) {
128 QTextStream t( &file ); // use a text stream 126 QTextStream t( &file ); // use a text stream
129 t.setEncoding( QTextStream::UnicodeUTF8 ); 127 t.setEncoding( QTextStream::UnicodeUTF8 );
130 QString data; 128 QString data;
131 data = t.read(); 129 data = t.read();
132 file.close(); 130 file.close();