summaryrefslogtreecommitdiffabout
path: root/kabc/plugins/opie
Unidiff
Diffstat (limited to 'kabc/plugins/opie') (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/opie/resourceopie.cpp11
-rw-r--r--kabc/plugins/opie/resourceopie.h4
2 files changed, 7 insertions, 8 deletions
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp
index 22237dc..f610b38 100644
--- a/kabc/plugins/opie/resourceopie.cpp
+++ b/kabc/plugins/opie/resourceopie.cpp
@@ -29,79 +29,78 @@ $Id$
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <unistd.h> 30#include <unistd.h>
31 31
32#include <qdir.h> 32#include <qdir.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qfileinfo.h> 34#include <qfileinfo.h>
35#include <qregexp.h> 35#include <qregexp.h>
36 36
37#include <kapplication.h> 37#include <kapplication.h>
38#include <kconfig.h> 38#include <kconfig.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41//US #include <ksavefile.h> 41//US #include <ksavefile.h>
42#include <kstandarddirs.h> 42#include <kstandarddirs.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44 44
45//US #include "formatfactory.h" 45//US #include "formatfactory.h"
46//US #include <qpe/qpeapplication.h> 46//US #include <qpe/qpeapplication.h>
47 47
48#include <opie/ocontactaccess.h> 48#include <opie/ocontactaccess.h>
49#include <opie/ocontactaccessbackend_xml.h> 49#include <opie/ocontactaccessbackend_xml.h>
50 50
51#include "resourceopieconfig.h" 51#include "resourceopieconfig.h"
52#include "stdaddressbook.h" 52#include "stdaddressbook.h"
53#include "syncprefwidget.h"
54 53
55#include "opieconverter.h" 54#include "opieconverter.h"
56 55
57#include "resourceopie.h" 56#include "resourceopie.h"
58 57
59using namespace KABC; 58using namespace KABC;
60extern "C" 59extern "C"
61{ 60{
62 void *init_microkabc_opie() 61 void *init_microkabc_opie()
63 { 62 {
64 return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig, SyncPrefWidgetContainer>(); 63 return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>();
65 } 64 }
66} 65}
67 66
68ResourceOpie::ResourceOpie( const KConfig *config, bool syncable ) 67ResourceOpie::ResourceOpie( const KConfig *config )
69 : Resource( config, syncable ), mAccess(0), mConverter (0) 68 : Resource( config ), mAccess(0), mConverter (0)
70{ 69{
71 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; 70 QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
72 71
73 KConfig *cfg = (KConfig *)config; 72 KConfig *cfg = (KConfig *)config;
74 if ( cfg ) { 73 if ( cfg ) {
75 fileName = cfg->readEntry( "FileName", fileName ); 74 fileName = cfg->readEntry( "FileName", fileName );
76 75
77 } 76 }
78 77
79 init( fileName ); 78 init( fileName );
80} 79}
81 80
82ResourceOpie::ResourceOpie( const QString &fileName, bool syncable ) 81ResourceOpie::ResourceOpie( const QString &fileName )
83 : Resource( 0, syncable ) 82 : Resource( 0 )
84{ 83{
85 init( fileName ); 84 init( fileName );
86} 85}
87 86
88void ResourceOpie::init( const QString &fileName ) 87void ResourceOpie::init( const QString &fileName )
89{ 88{
90 qDebug("ResourceOpie::init()"); 89 qDebug("ResourceOpie::init()");
91 90
92 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); 91 connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
93 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); 92 connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
94 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); 93 connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
95 94
96 setFileName( fileName ); 95 setFileName( fileName );
97} 96}
98 97
99ResourceOpie::~ResourceOpie() 98ResourceOpie::~ResourceOpie()
100{ 99{
101 if (mConverter != 0) 100 if (mConverter != 0)
102 delete mConverter; 101 delete mConverter;
103 102
104 if(mAccess != 0) 103 if(mAccess != 0)
105 delete mAccess; 104 delete mAccess;
106} 105}
107 106
diff --git a/kabc/plugins/opie/resourceopie.h b/kabc/plugins/opie/resourceopie.h
index d5b4ebd..9d05c70 100644
--- a/kabc/plugins/opie/resourceopie.h
+++ b/kabc/plugins/opie/resourceopie.h
@@ -36,54 +36,54 @@ $Id$
36 36
37#include "resource.h" 37#include "resource.h"
38 38
39 39
40class OContactAccess; 40class OContactAccess;
41 41
42namespace KABC { 42namespace KABC {
43 43
44class ResourceConfigWidget; 44class ResourceConfigWidget;
45class OpieConverter; 45class OpieConverter;
46/** 46/**
47 @internal 47 @internal
48*/ 48*/
49class ResourceOpie : public Resource 49class ResourceOpie : public Resource
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53public: 53public:
54 54
55 /** 55 /**
56 Constructor. 56 Constructor.
57 57
58 @param cfg The config object where custom resource settings are stored. 58 @param cfg The config object where custom resource settings are stored.
59 */ 59 */
60 ResourceOpie( const KConfig *cfg, bool syncable ); 60 ResourceOpie( const KConfig *cfg );
61 61
62 /** 62 /**
63 Construct file resource on file @arg fileName using format @arg formatName. 63 Construct file resource on file @arg fileName using format @arg formatName.
64 */ 64 */
65 ResourceOpie( const QString &fileName, bool syncable ); 65 ResourceOpie( const QString &fileName );
66 66
67 /** 67 /**
68 * Destructor. 68 * Destructor.
69 */ 69 */
70 ~ResourceOpie(); 70 ~ResourceOpie();
71 71
72 /** 72 /**
73 Writes the config back. 73 Writes the config back.
74 */ 74 */
75 virtual void writeConfig( KConfig *cfg ); 75 virtual void writeConfig( KConfig *cfg );
76 76
77 /** 77 /**
78 * Tries to open the file and checks for the proper format. 78 * Tries to open the file and checks for the proper format.
79 * This method should be called before @ref load(). 79 * This method should be called before @ref load().
80 */ 80 */
81 virtual bool doOpen(); 81 virtual bool doOpen();
82 82
83 /** 83 /**
84 * Closes the file again. 84 * Closes the file again.
85 */ 85 */
86 virtual void doClose(); 86 virtual void doClose();
87 87
88 /** 88 /**
89 * Requests a save ticket, that is used by @ref save() 89 * Requests a save ticket, that is used by @ref save()