summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/file/resourcefile.cpp
Unidiff
Diffstat (limited to 'kabc/plugins/file/resourcefile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/file/resourcefile.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index d98efc8..da2e4d7 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -63,32 +63,35 @@ __declspec(dllexport)
63{ 63{
64#endif 64#endif
65 65
66//US void *init_kabc_file() 66//US void *init_kabc_file()
67 void *init_microkabc_file() 67 void *init_microkabc_file()
68 { 68 {
69 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig, SyncPrefWidget>(); 69 return new KRES::PluginFactory<ResourceFile,ResourceFileConfig, SyncPrefWidgetContainer>();
70 } 70 }
71#ifndef _WIN32_ 71#ifndef _WIN32_
72} 72}
73#endif 73#endif
74 74
75ResourceFile::ResourceFile( const KConfig *config, bool syncable ) 75ResourceFile::ResourceFile( const KConfig *config, bool syncable )
76 : Resource( config, syncable ) , mFormat( 0 ) 76 : Resource( config, syncable ) , mFormat( 0 )
77{ 77{
78 QString fileName, formatName; 78 QString fileName, formatName, default_fileName;
79
80 if (syncable == true)
81 default_fileName = "/home/polo/kdepim/apps/kabc/localfile.vcf";
82 else
83 default_fileName = StdAddressBook::fileName();
79 84
80 KConfig *cfg = (KConfig *)config; 85 KConfig *cfg = (KConfig *)config;
81 if ( cfg ) { 86 if ( cfg ) {
82 fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() ); 87 fileName = cfg->readEntry( "FileName", default_fileName );
83 formatName = cfg->readEntry( "FileFormat", "vcard" ); 88 formatName = cfg->readEntry( "FileFormat", "vcard" );
84// qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() );
85 } else { 89 } else {
86 fileName = StdAddressBook::fileName(); 90 fileName = default_fileName;
87 formatName = "vcard"; 91 formatName = "vcard";
88// qDebug("ResourceFile::ResourceFile : 2 %s, %s", fileName.latin1(), formatName.latin1() );
89 } 92 }
90 93
91 init( fileName, formatName ); 94 init( fileName, formatName );
92} 95}
93 96
94ResourceFile::ResourceFile( const QString &fileName, bool syncable , 97ResourceFile::ResourceFile( const QString &fileName, bool syncable ,
@@ -108,25 +111,12 @@ void ResourceFile::init( const QString &fileName, const QString &formatName )
108 111
109 if ( !mFormat ) { 112 if ( !mFormat ) {
110 mFormatName = "vcard"; 113 mFormatName = "vcard";
111 mFormat = factory->format( mFormatName ); 114 mFormat = factory->format( mFormatName );
112 } 115 }
113 116
114/*US
115//US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1());
116 if (mFormatName == "vcard") {
117 mFormat = new VCardFormatPlugin2();
118// qDebug("ResourceFile::init format VCardFormatPlugin2");
119 }
120 else if (mFormatName == "binary") {
121 mFormat = new BinaryFormat();
122// qDebug("ResourceFile::init format BinaryFormat");
123 }
124 else
125 qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1());
126*/
127 117
128 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 118 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
129 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 119 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
130 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 120 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
131 121
132 setFileName( fileName ); 122 setFileName( fileName );