author | ulf69 <ulf69> | 2004-10-13 21:27:10 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-13 21:27:10 (UTC) |
commit | 737183a5abd7d7b02048e8a939bafd0a8e803918 (patch) (unidiff) | |
tree | ddacf864a06a6669911b1d48862e564399eeb33b /kabc/plugins | |
parent | 7bb6c5f55d29ad4632b1f5c7361eee4c0d8b7cb0 (diff) | |
download | kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.zip kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.tar.gz kdepimpi-737183a5abd7d7b02048e8a939bafd0a8e803918.tar.bz2 |
removal of syncresources
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 7 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedir.h | 2 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 16 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.h | 4 | ||||
-rw-r--r-- | kabc/plugins/ldap/resourceldap.cpp | 7 | ||||
-rw-r--r-- | kabc/plugins/ldap/resourceldap.h | 2 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.cpp | 11 | ||||
-rw-r--r-- | kabc/plugins/opie/resourceopie.h | 4 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 11 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.h | 4 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.cpp | 8 | ||||
-rw-r--r-- | kabc/plugins/sharpdtm/resourcesharpdtm.h | 4 |
12 files changed, 35 insertions, 45 deletions
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index e58e4f7..e2b7b08 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp | |||
@@ -13,120 +13,119 @@ | |||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | #include <sys/stat.h> | 30 | #include <sys/stat.h> |
31 | #ifndef _WIN32_ | 31 | #ifndef _WIN32_ |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | //US #include <kgenericfactory.h> | 42 | //US #include <kgenericfactory.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | #include <klocale.h> | 44 | #include <klocale.h> |
45 | #include <kstandarddirs.h> | 45 | #include <kstandarddirs.h> |
46 | #include <kurlrequester.h> | 46 | #include <kurlrequester.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | 48 | ||
49 | #include "addressbook.h" | 49 | #include "addressbook.h" |
50 | 50 | ||
51 | #include "formatfactory.h" | 51 | #include "formatfactory.h" |
52 | 52 | ||
53 | #include "resourcedirconfig.h" | 53 | #include "resourcedirconfig.h" |
54 | #include "stdaddressbook.h" | 54 | #include "stdaddressbook.h" |
55 | 55 | ||
56 | //US | 56 | //US |
57 | #include <qdir.h> | 57 | #include <qdir.h> |
58 | 58 | ||
59 | #define NO_DIRWATCH | 59 | #define NO_DIRWATCH |
60 | #include "resourcedir.h" | 60 | #include "resourcedir.h" |
61 | #include "syncprefwidget.h" | ||
62 | 61 | ||
63 | //#define ALLOW_LOCKING | 62 | //#define ALLOW_LOCKING |
64 | 63 | ||
65 | using namespace KABC; | 64 | using namespace KABC; |
66 | 65 | ||
67 | extern "C" | 66 | extern "C" |
68 | #ifdef _WIN32_ | 67 | #ifdef _WIN32_ |
69 | __declspec(dllexport) | 68 | __declspec(dllexport) |
70 | #else | 69 | #else |
71 | { | 70 | { |
72 | #endif | 71 | #endif |
73 | 72 | ||
74 | //US void *init_kabc_dir() | 73 | //US void *init_kabc_dir() |
75 | void *init_microkabc_dir() | 74 | void *init_microkabc_dir() |
76 | { | 75 | { |
77 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig, SyncPrefWidgetContainer>(); | 76 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); |
78 | } | 77 | } |
79 | #ifndef _WIN32_ | 78 | #ifndef _WIN32_ |
80 | } | 79 | } |
81 | #endif | 80 | #endif |
82 | 81 | ||
83 | ResourceDir::ResourceDir( const KConfig *config, bool syncable ) | 82 | ResourceDir::ResourceDir( const KConfig *config ) |
84 | : Resource( config, syncable ) | 83 | : Resource( config ) |
85 | { | 84 | { |
86 | QString path; | 85 | QString path; |
87 | 86 | ||
88 | KConfig *cfg = (KConfig *)config; | 87 | KConfig *cfg = (KConfig *)config; |
89 | if ( cfg ) { | 88 | if ( cfg ) { |
90 | //US path = config->readEntry( "FilePath" ); | 89 | //US path = config->readEntry( "FilePath" ); |
91 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); | 90 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); |
92 | //US mFormatName = config->readEntry( "FileFormat" ); | 91 | //US mFormatName = config->readEntry( "FileFormat" ); |
93 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); | 92 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); |
94 | } else { | 93 | } else { |
95 | path = StdAddressBook::directoryName(); | 94 | path = StdAddressBook::directoryName(); |
96 | mFormatName = "vcard"; | 95 | mFormatName = "vcard"; |
97 | } | 96 | } |
98 | 97 | ||
99 | 98 | ||
100 | FormatFactory *factory = FormatFactory::self(); | 99 | FormatFactory *factory = FormatFactory::self(); |
101 | mFormat = factory->format( mFormatName ); | 100 | mFormat = factory->format( mFormatName ); |
102 | 101 | ||
103 | if ( !mFormat ) { | 102 | if ( !mFormat ) { |
104 | mFormatName = "vcard"; | 103 | mFormatName = "vcard"; |
105 | mFormat = factory->format( mFormatName ); | 104 | mFormat = factory->format( mFormatName ); |
106 | } | 105 | } |
107 | 106 | ||
108 | /*US | 107 | /*US |
109 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); | 108 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); |
110 | if (mFormatName == "vcard") | 109 | if (mFormatName == "vcard") |
111 | mFormat = new VCardFormatPlugin2(); | 110 | mFormat = new VCardFormatPlugin2(); |
112 | else if (mFormatName == "binary") | 111 | else if (mFormatName == "binary") |
113 | mFormat = new BinaryFormat(); | 112 | mFormat = new BinaryFormat(); |
114 | else | 113 | else |
115 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); | 114 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); |
116 | */ | 115 | */ |
117 | #ifndef NO_DIRWATCH | 116 | #ifndef NO_DIRWATCH |
118 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); | 117 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); |
119 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); | 118 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); |
120 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); | 119 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); |
121 | #endif | 120 | #endif |
122 | setPath( path ); | 121 | setPath( path ); |
123 | } | 122 | } |
124 | 123 | ||
125 | ResourceDir::~ResourceDir() | 124 | ResourceDir::~ResourceDir() |
126 | { | 125 | { |
127 | delete mFormat; | 126 | delete mFormat; |
128 | mFormat = 0; | 127 | mFormat = 0; |
129 | } | 128 | } |
130 | 129 | ||
131 | void ResourceDir::writeConfig( KConfig *config ) | 130 | void ResourceDir::writeConfig( KConfig *config ) |
132 | { | 131 | { |
diff --git a/kabc/plugins/dir/resourcedir.h b/kabc/plugins/dir/resourcedir.h index 77cd18c..6c1e922 100644 --- a/kabc/plugins/dir/resourcedir.h +++ b/kabc/plugins/dir/resourcedir.h | |||
@@ -4,97 +4,97 @@ | |||
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_RESOURCEDIR_H | 28 | #ifndef KABC_RESOURCEDIR_H |
29 | #define KABC_RESOURCEDIR_H | 29 | #define KABC_RESOURCEDIR_H |
30 | 30 | ||
31 | #include <kconfig.h> | 31 | #include <kconfig.h> |
32 | #include <kdirwatch.h> | 32 | #include <kdirwatch.h> |
33 | 33 | ||
34 | #include <sys/types.h> | 34 | #include <sys/types.h> |
35 | 35 | ||
36 | #include "resource.h" | 36 | #include "resource.h" |
37 | 37 | ||
38 | class QTimer; | 38 | class QTimer; |
39 | 39 | ||
40 | namespace KABC { | 40 | namespace KABC { |
41 | 41 | ||
42 | class FormatPlugin; | 42 | class FormatPlugin; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | @internal | 45 | @internal |
46 | */ | 46 | */ |
47 | class ResourceDir : public Resource | 47 | class ResourceDir : public Resource |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | 50 | ||
51 | public: | 51 | public: |
52 | ResourceDir( const KConfig*, bool syncable ); | 52 | ResourceDir( const KConfig* ); |
53 | ~ResourceDir(); | 53 | ~ResourceDir(); |
54 | 54 | ||
55 | virtual void writeConfig( KConfig* ); | 55 | virtual void writeConfig( KConfig* ); |
56 | 56 | ||
57 | virtual bool doOpen(); | 57 | virtual bool doOpen(); |
58 | virtual void doClose(); | 58 | virtual void doClose(); |
59 | 59 | ||
60 | virtual Ticket *requestSaveTicket(); | 60 | virtual Ticket *requestSaveTicket(); |
61 | 61 | ||
62 | virtual bool load(); | 62 | virtual bool load(); |
63 | virtual bool save( Ticket * ); | 63 | virtual bool save( Ticket * ); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Set path to be used for saving. | 66 | * Set path to be used for saving. |
67 | */ | 67 | */ |
68 | void setPath( const QString & ); | 68 | void setPath( const QString & ); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Return path used for loading and saving the address book. | 71 | * Return path used for loading and saving the address book. |
72 | */ | 72 | */ |
73 | QString path() const; | 73 | QString path() const; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Set the format by name. | 76 | * Set the format by name. |
77 | */ | 77 | */ |
78 | void setFormat( const QString &format ); | 78 | void setFormat( const QString &format ); |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Returns the format name. | 81 | * Returns the format name. |
82 | */ | 82 | */ |
83 | QString format() const; | 83 | QString format() const; |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Remove a addressee from its source. | 86 | * Remove a addressee from its source. |
87 | * This method is mainly called by KABC::AddressBook. | 87 | * This method is mainly called by KABC::AddressBook. |
88 | */ | 88 | */ |
89 | virtual void removeAddressee( const Addressee& addr ); | 89 | virtual void removeAddressee( const Addressee& addr ); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * This method is called by an error handler if the application | 92 | * This method is called by an error handler if the application |
93 | * crashed | 93 | * crashed |
94 | */ | 94 | */ |
95 | virtual void cleanUp(); | 95 | virtual void cleanUp(); |
96 | 96 | ||
97 | protected slots: | 97 | protected slots: |
98 | void pathChanged(); | 98 | void pathChanged(); |
99 | 99 | ||
100 | protected: | 100 | protected: |
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 163f2b4..dc5932f 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp | |||
@@ -6,145 +6,141 @@ | |||
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #ifndef _WIN32_ | 30 | #ifndef _WIN32_ |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qfileinfo.h> | 35 | #include <qfileinfo.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | //US #include <ksavefile.h> | 43 | //US #include <ksavefile.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
46 | 46 | ||
47 | #include "formatfactory.h" | 47 | #include "formatfactory.h" |
48 | 48 | ||
49 | #include "resource.h" | 49 | #include "resource.h" |
50 | #include "resourcefileconfig.h" | 50 | #include "resourcefileconfig.h" |
51 | #include "stdaddressbook.h" | 51 | #include "stdaddressbook.h" |
52 | #define NO_DIRWATCH | 52 | #define NO_DIRWATCH |
53 | #include "resourcefile.h" | 53 | #include "resourcefile.h" |
54 | #include "syncprefwidget.h" | ||
55 | 54 | ||
56 | //#define ALLOW_LOCKING | 55 | //#define ALLOW_LOCKING |
57 | 56 | ||
58 | 57 | ||
59 | 58 | ||
60 | using namespace KABC; | 59 | using namespace KABC; |
61 | 60 | ||
62 | extern "C" | 61 | extern "C" |
63 | #ifdef _WIN32_ | 62 | #ifdef _WIN32_ |
64 | __declspec(dllexport) | 63 | __declspec(dllexport) |
65 | #else | 64 | #else |
66 | { | 65 | { |
67 | #endif | 66 | #endif |
68 | 67 | ||
69 | //US void *init_kabc_file() | 68 | //US void *init_kabc_file() |
70 | void *init_microkabc_file() | 69 | void *init_microkabc_file() |
71 | { | 70 | { |
72 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig, SyncPrefWidgetContainer>(); | 71 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); |
73 | } | 72 | } |
74 | #ifndef _WIN32_ | 73 | #ifndef _WIN32_ |
75 | } | 74 | } |
76 | #endif | 75 | #endif |
77 | 76 | ||
78 | ResourceFile::ResourceFile( const KConfig *config, bool syncable ) | 77 | ResourceFile::ResourceFile( const KConfig *config ) |
79 | : Resource( config, syncable ) , mFormat( 0 ) | 78 | : Resource( config ) , mFormat( 0 ) |
80 | { | 79 | { |
81 | QString fileName, formatName, default_fileName; | 80 | QString fileName, formatName, default_fileName; |
82 | 81 | ||
83 | if (syncable == true) | 82 | default_fileName = StdAddressBook::fileName(); |
84 | default_fileName = "/home/polo/kdepim/apps/kabc/localfile.vcf"; | ||
85 | else | ||
86 | default_fileName = StdAddressBook::fileName(); | ||
87 | 83 | ||
88 | KConfig *cfg = (KConfig *)config; | 84 | KConfig *cfg = (KConfig *)config; |
89 | if ( cfg ) { | 85 | if ( cfg ) { |
90 | fileName = cfg->readEntry( "FileName", default_fileName ); | 86 | fileName = cfg->readEntry( "FileName", default_fileName ); |
91 | formatName = cfg->readEntry( "FileFormat", "vcard" ); | 87 | formatName = cfg->readEntry( "FileFormat", "vcard" ); |
92 | } else { | 88 | } else { |
93 | fileName = default_fileName; | 89 | fileName = default_fileName; |
94 | formatName = "vcard"; | 90 | formatName = "vcard"; |
95 | } | 91 | } |
96 | 92 | ||
97 | init( fileName, formatName ); | 93 | init( fileName, formatName ); |
98 | } | 94 | } |
99 | 95 | ||
100 | ResourceFile::ResourceFile( const QString &fileName, bool syncable , | 96 | ResourceFile::ResourceFile( const QString &fileName , |
101 | const QString &formatName ) | 97 | const QString &formatName ) |
102 | : Resource( 0, syncable ) | 98 | : Resource( 0 ) |
103 | { | 99 | { |
104 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); | 100 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); |
105 | init( fileName, formatName ); | 101 | init( fileName, formatName ); |
106 | } | 102 | } |
107 | 103 | ||
108 | void ResourceFile::init( const QString &fileName, const QString &formatName ) | 104 | void ResourceFile::init( const QString &fileName, const QString &formatName ) |
109 | { | 105 | { |
110 | mFormatName = formatName; | 106 | mFormatName = formatName; |
111 | 107 | ||
112 | FormatFactory *factory = FormatFactory::self(); | 108 | FormatFactory *factory = FormatFactory::self(); |
113 | mFormat = factory->format( mFormatName ); | 109 | mFormat = factory->format( mFormatName ); |
114 | 110 | ||
115 | if ( !mFormat ) { | 111 | if ( !mFormat ) { |
116 | mFormatName = "vcard"; | 112 | mFormatName = "vcard"; |
117 | mFormat = factory->format( mFormatName ); | 113 | mFormat = factory->format( mFormatName ); |
118 | } | 114 | } |
119 | 115 | ||
120 | #ifndef NO_DIRWATCH | 116 | #ifndef NO_DIRWATCH |
121 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 117 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
122 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 118 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
123 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 119 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
124 | #endif | 120 | #endif |
125 | setFileName( fileName ); | 121 | setFileName( fileName ); |
126 | } | 122 | } |
127 | 123 | ||
128 | ResourceFile::~ResourceFile() | 124 | ResourceFile::~ResourceFile() |
129 | { | 125 | { |
130 | delete mFormat; | 126 | delete mFormat; |
131 | mFormat = 0; | 127 | mFormat = 0; |
132 | } | 128 | } |
133 | 129 | ||
134 | void ResourceFile::writeConfig( KConfig *config ) | 130 | void ResourceFile::writeConfig( KConfig *config ) |
135 | { | 131 | { |
136 | 132 | ||
137 | config->setGroup( "Resource_" + identifier() ); | 133 | config->setGroup( "Resource_" + identifier() ); |
138 | Resource::writeConfig( config ); | 134 | Resource::writeConfig( config ); |
139 | 135 | ||
140 | config->writeEntry( "FileName", mFileName ); | 136 | config->writeEntry( "FileName", mFileName ); |
141 | config->writeEntry( "FileFormat", mFormatName ); | 137 | config->writeEntry( "FileFormat", mFormatName ); |
142 | 138 | ||
143 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 139 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
144 | 140 | ||
145 | } | 141 | } |
146 | 142 | ||
147 | Ticket *ResourceFile::requestSaveTicket() | 143 | Ticket *ResourceFile::requestSaveTicket() |
148 | { | 144 | { |
149 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; | 145 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; |
150 | 146 | ||
diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h index 8339340..b4421b2 100644 --- a/kabc/plugins/file/resourcefile.h +++ b/kabc/plugins/file/resourcefile.h | |||
@@ -13,102 +13,102 @@ | |||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #ifndef KABC_RESOURCEFILE_H | 29 | #ifndef KABC_RESOURCEFILE_H |
30 | #define KABC_RESOURCEFILE_H | 30 | #define KABC_RESOURCEFILE_H |
31 | 31 | ||
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <kdirwatch.h> | 33 | #include <kdirwatch.h> |
34 | 34 | ||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | 36 | ||
37 | #include <resource.h> | 37 | #include <resource.h> |
38 | 38 | ||
39 | class QTimer; | 39 | class QTimer; |
40 | class FormatPlugin; | 40 | class FormatPlugin; |
41 | 41 | ||
42 | namespace KABC { | 42 | namespace KABC { |
43 | 43 | ||
44 | //US class FormatPlugin; | 44 | //US class FormatPlugin; |
45 | class ResourceConfigWidget; | 45 | class ResourceConfigWidget; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | @internal | 48 | @internal |
49 | */ | 49 | */ |
50 | class ResourceFile : public Resource | 50 | class ResourceFile : public Resource |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | 55 | ||
56 | /** | 56 | /** |
57 | Constructor. | 57 | Constructor. |
58 | 58 | ||
59 | @param cfg The config object where custom resource settings are stored. | 59 | @param cfg The config object where custom resource settings are stored. |
60 | */ | 60 | */ |
61 | ResourceFile( const KConfig *cfg, bool syncable ); | 61 | ResourceFile( const KConfig *cfg ); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | Construct file resource on file @arg fileName using format @arg formatName. | 64 | Construct file resource on file @arg fileName using format @arg formatName. |
65 | */ | 65 | */ |
66 | ResourceFile( const QString &fileName, bool syncable , const QString &formatName = "vcard" ); | 66 | ResourceFile( const QString &fileName , const QString &formatName = "vcard" ); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Destructor. | 69 | * Destructor. |
70 | */ | 70 | */ |
71 | ~ResourceFile(); | 71 | ~ResourceFile(); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | Writes the config back. | 74 | Writes the config back. |
75 | */ | 75 | */ |
76 | virtual void writeConfig( KConfig *cfg ); | 76 | virtual void writeConfig( KConfig *cfg ); |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Tries to open the file and checks for the proper format. | 79 | * Tries to open the file and checks for the proper format. |
80 | * This method should be called before @ref load(). | 80 | * This method should be called before @ref load(). |
81 | */ | 81 | */ |
82 | virtual bool doOpen(); | 82 | virtual bool doOpen(); |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Closes the file again. | 85 | * Closes the file again. |
86 | */ | 86 | */ |
87 | virtual void doClose(); | 87 | virtual void doClose(); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Requests a save ticket, that is used by @ref save() | 90 | * Requests a save ticket, that is used by @ref save() |
91 | */ | 91 | */ |
92 | virtual Ticket *requestSaveTicket(); | 92 | virtual Ticket *requestSaveTicket(); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Loads all addressees from file to the address book. | 95 | * Loads all addressees from file to the address book. |
96 | * Returns true if all addressees could be loaded otherwise false. | 96 | * Returns true if all addressees could be loaded otherwise false. |
97 | */ | 97 | */ |
98 | virtual bool load(); | 98 | virtual bool load(); |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Saves all addresses from address book to file. | 101 | * Saves all addresses from address book to file. |
102 | * Returns true if all addressees could be saved otherwise false. | 102 | * Returns true if all addressees could be saved otherwise false. |
103 | * | 103 | * |
104 | * @param ticket The ticket returned by @ref requestSaveTicket() | 104 | * @param ticket The ticket returned by @ref requestSaveTicket() |
105 | */ | 105 | */ |
106 | virtual bool save( Ticket *ticket ); | 106 | virtual bool save( Ticket *ticket ); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Set name of file to be used for saving. | 109 | * Set name of file to be used for saving. |
110 | */ | 110 | */ |
111 | void setFileName( const QString & ); | 111 | void setFileName( const QString & ); |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Return name of file used for loading and saving the address book. | 114 | * Return name of file used for loading and saving the address book. |
diff --git a/kabc/plugins/ldap/resourceldap.cpp b/kabc/plugins/ldap/resourceldap.cpp index 17f115d..55c43af 100644 --- a/kabc/plugins/ldap/resourceldap.cpp +++ b/kabc/plugins/ldap/resourceldap.cpp | |||
@@ -1,104 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #include <klineedit.h> | 30 | #include <klineedit.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <kstringhandler.h> | 33 | #include <kstringhandler.h> |
34 | 34 | ||
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | 36 | ||
37 | #include "resourceldap.h" | 37 | #include "resourceldap.h" |
38 | #include "resourceldapconfig.h" | 38 | #include "resourceldapconfig.h" |
39 | #include "syncprefwidget.h" | ||
40 | 39 | ||
41 | using namespace KABC; | 40 | using namespace KABC; |
42 | 41 | ||
43 | extern "C" | 42 | extern "C" |
44 | { | 43 | { |
45 | //US void *init_kabc_ldap() | 44 | //US void *init_kabc_ldap() |
46 | void *init_microkabc_ldap() | 45 | void *init_microkabc_ldap() |
47 | { | 46 | { |
48 | return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig, SyncPrefWidgetContainer>(); | 47 | return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>(); |
49 | } | 48 | } |
50 | } | 49 | } |
51 | 50 | ||
52 | void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); | 51 | void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value ); |
53 | 52 | ||
54 | 53 | ||
55 | ResourceLDAP::ResourceLDAP( const KConfig *config, bool syncable ) | 54 | ResourceLDAP::ResourceLDAP( const KConfig *config ) |
56 | : Resource( config, syncable ), mPort( 389 ), mLdap( 0 ) | 55 | : Resource( config ), mPort( 389 ), mLdap( 0 ) |
57 | { | 56 | { |
58 | KConfig *cfg = (KConfig *)config; | 57 | KConfig *cfg = (KConfig *)config; |
59 | if ( cfg ) { | 58 | if ( cfg ) { |
60 | mUser = cfg->readEntry( "LdapUser" ); | 59 | mUser = cfg->readEntry( "LdapUser" ); |
61 | mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) ); | 60 | mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) ); |
62 | mDn = cfg->readEntry( "LdapDn" ); | 61 | mDn = cfg->readEntry( "LdapDn" ); |
63 | mHost = cfg->readEntry( "LdapHost" ); | 62 | mHost = cfg->readEntry( "LdapHost" ); |
64 | mPort = cfg->readNumEntry( "LdapPort", 389 ); | 63 | mPort = cfg->readNumEntry( "LdapPort", 389 ); |
65 | mFilter = cfg->readEntry( "LdapFilter" ); | 64 | mFilter = cfg->readEntry( "LdapFilter" ); |
66 | mAnonymous = cfg->readBoolEntry( "LdapAnonymous" ); | 65 | mAnonymous = cfg->readBoolEntry( "LdapAnonymous" ); |
67 | 66 | ||
68 | QStringList attributes = cfg->readListEntry( "LdapAttributes" ); | 67 | QStringList attributes = cfg->readListEntry( "LdapAttributes" ); |
69 | for ( uint pos = 0; pos < attributes.count(); pos += 2 ) | 68 | for ( uint pos = 0; pos < attributes.count(); pos += 2 ) |
70 | mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] ); | 69 | mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] ); |
71 | } | 70 | } |
72 | 71 | ||
73 | /** | 72 | /** |
74 | If you want to add new attributes, append them here, add a | 73 | If you want to add new attributes, append them here, add a |
75 | translation string in the ctor of AttributesDialog and | 74 | translation string in the ctor of AttributesDialog and |
76 | handle them in the load() method below. | 75 | handle them in the load() method below. |
77 | These are the default values from | 76 | These are the default values from |
78 | */ | 77 | */ |
79 | if ( mAttributes.count() == 0 ) { | 78 | if ( mAttributes.count() == 0 ) { |
80 | mAttributes.insert( "commonName", "cn" ); | 79 | mAttributes.insert( "commonName", "cn" ); |
81 | mAttributes.insert( "formattedName", "displayName" ); | 80 | mAttributes.insert( "formattedName", "displayName" ); |
82 | mAttributes.insert( "familyName", "sn" ); | 81 | mAttributes.insert( "familyName", "sn" ); |
83 | mAttributes.insert( "givenName", "givenName" ); | 82 | mAttributes.insert( "givenName", "givenName" ); |
84 | mAttributes.insert( "mail", "mail" ); | 83 | mAttributes.insert( "mail", "mail" ); |
85 | mAttributes.insert( "mailAlias", "" ); | 84 | mAttributes.insert( "mailAlias", "" ); |
86 | mAttributes.insert( "phoneNumber", "telephoneNumber" ); | 85 | mAttributes.insert( "phoneNumber", "telephoneNumber" ); |
87 | mAttributes.insert( "uid", "uid" ); | 86 | mAttributes.insert( "uid", "uid" ); |
88 | } | 87 | } |
89 | } | 88 | } |
90 | 89 | ||
91 | void ResourceLDAP::writeConfig( KConfig *config ) | 90 | void ResourceLDAP::writeConfig( KConfig *config ) |
92 | { | 91 | { |
93 | Resource::writeConfig( config ); | 92 | Resource::writeConfig( config ); |
94 | 93 | ||
95 | config->writeEntry( "LdapUser", mUser ); | 94 | config->writeEntry( "LdapUser", mUser ); |
96 | config->writeEntry( "LdapPassword", KStringHandler::obscure( mPassword ) ); | 95 | config->writeEntry( "LdapPassword", KStringHandler::obscure( mPassword ) ); |
97 | config->writeEntry( "LdapDn", mDn ); | 96 | config->writeEntry( "LdapDn", mDn ); |
98 | config->writeEntry( "LdapHost", mHost ); | 97 | config->writeEntry( "LdapHost", mHost ); |
99 | config->writeEntry( "LdapPort", mPort ); | 98 | config->writeEntry( "LdapPort", mPort ); |
100 | config->writeEntry( "LdapFilter", mFilter ); | 99 | config->writeEntry( "LdapFilter", mFilter ); |
101 | config->writeEntry( "LdapAnonymous", mAnonymous ); | 100 | config->writeEntry( "LdapAnonymous", mAnonymous ); |
102 | 101 | ||
103 | QStringList attributes; | 102 | QStringList attributes; |
104 | QMap<QString, QString>::Iterator it; | 103 | QMap<QString, QString>::Iterator it; |
diff --git a/kabc/plugins/ldap/resourceldap.h b/kabc/plugins/ldap/resourceldap.h index 0aad3c1..0625f30 100644 --- a/kabc/plugins/ldap/resourceldap.h +++ b/kabc/plugins/ldap/resourceldap.h | |||
@@ -1,94 +1,94 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_RESOURCELDAP_H | 28 | #ifndef KABC_RESOURCELDAP_H |
29 | #define KABC_RESOURCELDAP_H | 29 | #define KABC_RESOURCELDAP_H |
30 | 30 | ||
31 | 31 | ||
32 | #include <lber.h> | 32 | #include <lber.h> |
33 | #include <ldap.h> | 33 | #include <ldap.h> |
34 | 34 | ||
35 | #include "addressbook.h" | 35 | #include "addressbook.h" |
36 | #include "resource.h" | 36 | #include "resource.h" |
37 | 37 | ||
38 | class KConfig; | 38 | class KConfig; |
39 | 39 | ||
40 | namespace KABC { | 40 | namespace KABC { |
41 | 41 | ||
42 | class ResourceLDAP : public Resource | 42 | class ResourceLDAP : public Resource |
43 | { | 43 | { |
44 | public: | 44 | public: |
45 | 45 | ||
46 | ResourceLDAP( const KConfig*, bool syncable ); | 46 | ResourceLDAP( const KConfig* ); |
47 | 47 | ||
48 | virtual void writeConfig( KConfig* ); | 48 | virtual void writeConfig( KConfig* ); |
49 | 49 | ||
50 | virtual bool doOpen(); | 50 | virtual bool doOpen(); |
51 | virtual void doClose(); | 51 | virtual void doClose(); |
52 | 52 | ||
53 | virtual Ticket *requestSaveTicket(); | 53 | virtual Ticket *requestSaveTicket(); |
54 | 54 | ||
55 | virtual bool load(); | 55 | virtual bool load(); |
56 | virtual bool save( Ticket * ); | 56 | virtual bool save( Ticket * ); |
57 | 57 | ||
58 | virtual void removeAddressee( const Addressee& addr ); | 58 | virtual void removeAddressee( const Addressee& addr ); |
59 | 59 | ||
60 | void setUser( const QString &user ); | 60 | void setUser( const QString &user ); |
61 | QString user() const; | 61 | QString user() const; |
62 | 62 | ||
63 | void setPassword( const QString &password ); | 63 | void setPassword( const QString &password ); |
64 | QString password() const; | 64 | QString password() const; |
65 | 65 | ||
66 | void setDn( const QString &dn ); | 66 | void setDn( const QString &dn ); |
67 | QString dn() const; | 67 | QString dn() const; |
68 | 68 | ||
69 | void setHost( const QString &host ); | 69 | void setHost( const QString &host ); |
70 | QString host() const; | 70 | QString host() const; |
71 | 71 | ||
72 | void setPort( int port ); | 72 | void setPort( int port ); |
73 | int port() const; | 73 | int port() const; |
74 | 74 | ||
75 | void setFilter( const QString &filter ); | 75 | void setFilter( const QString &filter ); |
76 | QString filter() const; | 76 | QString filter() const; |
77 | 77 | ||
78 | void setIsAnonymous( bool value ); | 78 | void setIsAnonymous( bool value ); |
79 | bool isAnonymous() const; | 79 | bool isAnonymous() const; |
80 | 80 | ||
81 | void setAttributes( const QMap<QString, QString> &attributes ); | 81 | void setAttributes( const QMap<QString, QString> &attributes ); |
82 | QMap<QString, QString> attributes() const; | 82 | QMap<QString, QString> attributes() const; |
83 | 83 | ||
84 | private: | 84 | private: |
85 | QString mUser; | 85 | QString mUser; |
86 | QString mPassword; | 86 | QString mPassword; |
87 | QString mDn; | 87 | QString mDn; |
88 | QString mHost; | 88 | QString mHost; |
89 | QString mFilter; | 89 | QString mFilter; |
90 | int mPort; | 90 | int mPort; |
91 | bool mAnonymous; | 91 | bool mAnonymous; |
92 | QMap<QString, QString> mAttributes; | 92 | QMap<QString, QString> mAttributes; |
93 | 93 | ||
94 | LDAP *mLdap; | 94 | LDAP *mLdap; |
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 | |||
@@ -5,127 +5,126 @@ | |||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
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 | ||
59 | using namespace KABC; | 58 | using namespace KABC; |
60 | extern "C" | 59 | extern "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 | ||
68 | ResourceOpie::ResourceOpie( const KConfig *config, bool syncable ) | 67 | ResourceOpie::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 | ||
82 | ResourceOpie::ResourceOpie( const QString &fileName, bool syncable ) | 81 | ResourceOpie::ResourceOpie( const QString &fileName ) |
83 | : Resource( 0, syncable ) | 82 | : Resource( 0 ) |
84 | { | 83 | { |
85 | init( fileName ); | 84 | init( fileName ); |
86 | } | 85 | } |
87 | 86 | ||
88 | void ResourceOpie::init( const QString &fileName ) | 87 | void 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 | ||
99 | ResourceOpie::~ResourceOpie() | 98 | ResourceOpie::~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 | ||
108 | void ResourceOpie::writeConfig( KConfig *config ) | 107 | void ResourceOpie::writeConfig( KConfig *config ) |
109 | { | 108 | { |
110 | Resource::writeConfig( config ); | 109 | Resource::writeConfig( config ); |
111 | 110 | ||
112 | config->writeEntry( "FileName", fileName() ); | 111 | config->writeEntry( "FileName", fileName() ); |
113 | } | 112 | } |
114 | 113 | ||
115 | Ticket *ResourceOpie::requestSaveTicket() | 114 | Ticket *ResourceOpie::requestSaveTicket() |
116 | { | 115 | { |
117 | kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl; | 116 | kdDebug(5700) << "ResourceOpie::requestSaveTicket()" << endl; |
118 | 117 | ||
119 | qDebug("ResourceOpie::requestSaveTicket: %s", fileName().latin1()); | 118 | qDebug("ResourceOpie::requestSaveTicket: %s", fileName().latin1()); |
120 | 119 | ||
121 | if ( !addressBook() ) return 0; | 120 | if ( !addressBook() ) return 0; |
122 | 121 | ||
123 | if ( !lock( fileName() ) ) { | 122 | if ( !lock( fileName() ) ) { |
124 | kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '" | 123 | kdDebug(5700) << "ResourceOpie::requestSaveTicket(): Unable to lock file '" |
125 | << fileName() << "'" << endl; | 124 | << fileName() << "'" << endl; |
126 | return 0; | 125 | return 0; |
127 | } | 126 | } |
128 | return createTicket( this ); | 127 | return createTicket( this ); |
129 | } | 128 | } |
130 | 129 | ||
131 | 130 | ||
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 | |||
@@ -12,102 +12,102 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #ifndef KABC_RESOURCEOPIE_H | 29 | #ifndef KABC_RESOURCEOPIE_H |
30 | #define KABC_RESOURCEOPIE_H | 30 | #define KABC_RESOURCEOPIE_H |
31 | 31 | ||
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <kdirwatch.h> | 33 | #include <kdirwatch.h> |
34 | 34 | ||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | 36 | ||
37 | #include "resource.h" | 37 | #include "resource.h" |
38 | 38 | ||
39 | 39 | ||
40 | class OContactAccess; | 40 | class OContactAccess; |
41 | 41 | ||
42 | namespace KABC { | 42 | namespace KABC { |
43 | 43 | ||
44 | class ResourceConfigWidget; | 44 | class ResourceConfigWidget; |
45 | class OpieConverter; | 45 | class OpieConverter; |
46 | /** | 46 | /** |
47 | @internal | 47 | @internal |
48 | */ | 48 | */ |
49 | class ResourceOpie : public Resource | 49 | class ResourceOpie : public Resource |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | 52 | ||
53 | public: | 53 | public: |
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() |
90 | */ | 90 | */ |
91 | virtual Ticket *requestSaveTicket(); | 91 | virtual Ticket *requestSaveTicket(); |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Loads all addressees from file to the address book. | 94 | * Loads all addressees from file to the address book. |
95 | * Returns true if all addressees could be loaded otherwise false. | 95 | * Returns true if all addressees could be loaded otherwise false. |
96 | */ | 96 | */ |
97 | virtual bool load(); | 97 | virtual bool load(); |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Saves all addresses from address book to file. | 100 | * Saves all addresses from address book to file. |
101 | * Returns true if all addressees could be saved otherwise false. | 101 | * Returns true if all addressees could be saved otherwise false. |
102 | * | 102 | * |
103 | * @param ticket The ticket returned by @ref requestSaveTicket() | 103 | * @param ticket The ticket returned by @ref requestSaveTicket() |
104 | */ | 104 | */ |
105 | virtual bool save( Ticket *ticket ); | 105 | virtual bool save( Ticket *ticket ); |
106 | 106 | ||
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Remove a addressee from its source. | 109 | * Remove a addressee from its source. |
110 | * This method is mainly called by KABC::AddressBook. | 110 | * This method is mainly called by KABC::AddressBook. |
111 | */ | 111 | */ |
112 | virtual void removeAddressee( const Addressee& addr ); | 112 | virtual void removeAddressee( const Addressee& addr ); |
113 | 113 | ||
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index f9cabcb..deb218b 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp | |||
@@ -4,119 +4,118 @@ | |||
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | 30 | ||
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qfileinfo.h> | 33 | #include <qfileinfo.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | //US #include <qtimer.h> | 35 | //US #include <qtimer.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 | #include <qpe/pim/addressbookaccess.h> | 45 | #include <qpe/pim/addressbookaccess.h> |
46 | 46 | ||
47 | 47 | ||
48 | #include "resourceqtopiaconfig.h" | 48 | #include "resourceqtopiaconfig.h" |
49 | #include "stdaddressbook.h" | 49 | #include "stdaddressbook.h" |
50 | 50 | ||
51 | #include "qtopiaconverter.h" | 51 | #include "qtopiaconverter.h" |
52 | #include "syncprefwidget.h" | ||
53 | 52 | ||
54 | #include "resourceqtopia.h" | 53 | #include "resourceqtopia.h" |
55 | 54 | ||
56 | using namespace KABC; | 55 | using namespace KABC; |
57 | extern "C" | 56 | extern "C" |
58 | { | 57 | { |
59 | void *init_microkabc_qtopia() | 58 | void *init_microkabc_qtopia() |
60 | { | 59 | { |
61 | return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig, SyncPrefWidgetContainer>(); | 60 | return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>(); |
62 | } | 61 | } |
63 | } | 62 | } |
64 | 63 | ||
65 | ResourceQtopia::ResourceQtopia( const KConfig *config, bool syncable ) | 64 | ResourceQtopia::ResourceQtopia( const KConfig *config ) |
66 | : Resource( config, syncable ), mConverter (0) | 65 | : Resource( config ), mConverter (0) |
67 | { | 66 | { |
68 | // we can not choose the filename. Therefore use the default to display | 67 | // we can not choose the filename. Therefore use the default to display |
69 | QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; | 68 | QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; |
70 | init( fileName ); | 69 | init( fileName ); |
71 | } | 70 | } |
72 | 71 | ||
73 | ResourceQtopia::ResourceQtopia( const QString &fileName, bool syncable ) | 72 | ResourceQtopia::ResourceQtopia( const QString &fileName ) |
74 | : Resource( 0, syncable ) | 73 | : Resource( 0 ) |
75 | { | 74 | { |
76 | init( fileName ); | 75 | init( fileName ); |
77 | } | 76 | } |
78 | 77 | ||
79 | void ResourceQtopia::init( const QString &fileName ) | 78 | void ResourceQtopia::init( const QString &fileName ) |
80 | { | 79 | { |
81 | 80 | ||
82 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 81 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
83 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 82 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
84 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 83 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
85 | 84 | ||
86 | setFileName( fileName ); | 85 | setFileName( fileName ); |
87 | } | 86 | } |
88 | 87 | ||
89 | ResourceQtopia::~ResourceQtopia() | 88 | ResourceQtopia::~ResourceQtopia() |
90 | { | 89 | { |
91 | if (mConverter != 0) | 90 | if (mConverter != 0) |
92 | delete mConverter; | 91 | delete mConverter; |
93 | 92 | ||
94 | if(mAccess != 0) | 93 | if(mAccess != 0) |
95 | delete mAccess; | 94 | delete mAccess; |
96 | } | 95 | } |
97 | 96 | ||
98 | void ResourceQtopia::writeConfig( KConfig *config ) | 97 | void ResourceQtopia::writeConfig( KConfig *config ) |
99 | { | 98 | { |
100 | Resource::writeConfig( config ); | 99 | Resource::writeConfig( config ); |
101 | } | 100 | } |
102 | 101 | ||
103 | Ticket *ResourceQtopia::requestSaveTicket() | 102 | Ticket *ResourceQtopia::requestSaveTicket() |
104 | { | 103 | { |
105 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket()" << endl; | 104 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket()" << endl; |
106 | 105 | ||
107 | qDebug("ResourceQtopia::requestSaveTicket: %s", fileName().latin1()); | 106 | qDebug("ResourceQtopia::requestSaveTicket: %s", fileName().latin1()); |
108 | 107 | ||
109 | if ( !addressBook() ) return 0; | 108 | if ( !addressBook() ) return 0; |
110 | 109 | ||
111 | if ( !lock( fileName() ) ) { | 110 | if ( !lock( fileName() ) ) { |
112 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket(): Unable to lock file '" | 111 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket(): Unable to lock file '" |
113 | << fileName() << "'" << endl; | 112 | << fileName() << "'" << endl; |
114 | return 0; | 113 | return 0; |
115 | } | 114 | } |
116 | return createTicket( this ); | 115 | return createTicket( this ); |
117 | } | 116 | } |
118 | 117 | ||
119 | 118 | ||
120 | bool ResourceQtopia::doOpen() | 119 | bool ResourceQtopia::doOpen() |
121 | { | 120 | { |
122 | qDebug("ResourceQtopia::doOpen(): %s", fileName().latin1()); | 121 | qDebug("ResourceQtopia::doOpen(): %s", fileName().latin1()); |
diff --git a/kabc/plugins/qtopia/resourceqtopia.h b/kabc/plugins/qtopia/resourceqtopia.h index eace280..ff6350d 100644 --- a/kabc/plugins/qtopia/resourceqtopia.h +++ b/kabc/plugins/qtopia/resourceqtopia.h | |||
@@ -13,102 +13,102 @@ | |||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #ifndef KABC_RESOURCEOPIE_H | 29 | #ifndef KABC_RESOURCEOPIE_H |
30 | #define KABC_RESOURCEOPIE_H | 30 | #define KABC_RESOURCEOPIE_H |
31 | 31 | ||
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <kdirwatch.h> | 33 | #include <kdirwatch.h> |
34 | 34 | ||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | 36 | ||
37 | #include "resource.h" | 37 | #include "resource.h" |
38 | 38 | ||
39 | class AddressBookAccess; | 39 | class AddressBookAccess; |
40 | 40 | ||
41 | namespace KABC { | 41 | namespace KABC { |
42 | 42 | ||
43 | //US class FormatPlugin; | 43 | //US class FormatPlugin; |
44 | class ResourceConfigWidget; | 44 | class ResourceConfigWidget; |
45 | class QtopiaConverter; | 45 | class QtopiaConverter; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | @internal | 48 | @internal |
49 | */ | 49 | */ |
50 | class ResourceQtopia : public Resource | 50 | class ResourceQtopia : public Resource |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | 55 | ||
56 | /** | 56 | /** |
57 | Constructor. | 57 | Constructor. |
58 | 58 | ||
59 | @param cfg The config object where custom resource settings are stored. | 59 | @param cfg The config object where custom resource settings are stored. |
60 | */ | 60 | */ |
61 | ResourceQtopia( const KConfig *cfg, bool syncable ); | 61 | ResourceQtopia( const KConfig *cfg ); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | Construct file resource on file @arg fileName using format @arg formatName. | 64 | Construct file resource on file @arg fileName using format @arg formatName. |
65 | */ | 65 | */ |
66 | ResourceQtopia( const QString &fileName, bool syncable ); | 66 | ResourceQtopia( const QString &fileName ); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Destructor. | 69 | * Destructor. |
70 | */ | 70 | */ |
71 | ~ResourceQtopia(); | 71 | ~ResourceQtopia(); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | Writes the config back. | 74 | Writes the config back. |
75 | */ | 75 | */ |
76 | virtual void writeConfig( KConfig *cfg ); | 76 | virtual void writeConfig( KConfig *cfg ); |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Tries to open the file and checks for the proper format. | 79 | * Tries to open the file and checks for the proper format. |
80 | * This method should be called before @ref load(). | 80 | * This method should be called before @ref load(). |
81 | */ | 81 | */ |
82 | virtual bool doOpen(); | 82 | virtual bool doOpen(); |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Closes the file again. | 85 | * Closes the file again. |
86 | */ | 86 | */ |
87 | virtual void doClose(); | 87 | virtual void doClose(); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Requests a save ticket, that is used by @ref save() | 90 | * Requests a save ticket, that is used by @ref save() |
91 | */ | 91 | */ |
92 | virtual Ticket *requestSaveTicket(); | 92 | virtual Ticket *requestSaveTicket(); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Loads all addressees from file to the address book. | 95 | * Loads all addressees from file to the address book. |
96 | * Returns true if all addressees could be loaded otherwise false. | 96 | * Returns true if all addressees could be loaded otherwise false. |
97 | */ | 97 | */ |
98 | virtual bool load(); | 98 | virtual bool load(); |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Saves all addresses from address book to file. | 101 | * Saves all addresses from address book to file. |
102 | * Returns true if all addressees could be saved otherwise false. | 102 | * Returns true if all addressees could be saved otherwise false. |
103 | * | 103 | * |
104 | * @param ticket The ticket returned by @ref requestSaveTicket() | 104 | * @param ticket The ticket returned by @ref requestSaveTicket() |
105 | */ | 105 | */ |
106 | virtual bool save( Ticket *ticket ); | 106 | virtual bool save( Ticket *ticket ); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Remove a addressee from its source. | 109 | * Remove a addressee from its source. |
110 | * This method is mainly called by KABC::AddressBook. | 110 | * This method is mainly called by KABC::AddressBook. |
111 | */ | 111 | */ |
112 | virtual void removeAddressee( const Addressee& addr ); | 112 | virtual void removeAddressee( const Addressee& addr ); |
113 | 113 | ||
114 | /** | 114 | /** |
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp index c013f52..2cdf4bf 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.cpp +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.cpp | |||
@@ -5,113 +5,111 @@ | |||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
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 | //US #include <qtimer.h> | 36 | //US #include <qtimer.h> |
37 | 37 | ||
38 | #include <kapplication.h> | 38 | #include <kapplication.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <kdebug.h> | 40 | #include <kdebug.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | //US #include <ksavefile.h> | 42 | //US #include <ksavefile.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
45 | 45 | ||
46 | #include <sl/slzdb.h> | 46 | #include <sl/slzdb.h> |
47 | 47 | ||
48 | #include <libkdepim/ksyncprofile.h> | 48 | #include <libkdepim/ksyncprofile.h> |
49 | 49 | ||
50 | #include "resourcesharpdtmconfig.h" | 50 | #include "resourcesharpdtmconfig.h" |
51 | #include "resourcesharpdtm.h" | 51 | #include "resourcesharpdtm.h" |
52 | 52 | ||
53 | #include "syncprefwidget.h" | ||
54 | |||
55 | #include "stdaddressbook.h" | 53 | #include "stdaddressbook.h" |
56 | 54 | ||
57 | #include "sharpdtmconverter.h" | 55 | #include "sharpdtmconverter.h" |
58 | //#define ALLOW_LOCKING | 56 | //#define ALLOW_LOCKING |
59 | using namespace KABC; | 57 | using namespace KABC; |
60 | extern "C" | 58 | extern "C" |
61 | { | 59 | { |
62 | void *init_microkabc_sharpdtm() | 60 | void *init_microkabc_sharpdtm() |
63 | { | 61 | { |
64 | return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig,SyncPrefWidgetContainer>(); | 62 | return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>(); |
65 | } | 63 | } |
66 | } | 64 | } |
67 | 65 | ||
68 | ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable ) | 66 | ResourceSharpDTM::ResourceSharpDTM( const KConfig *config ) |
69 | : Resource( config, syncable ), mConverter (0) | 67 | : Resource( config ), mConverter (0) |
70 | { | 68 | { |
71 | // we can not choose the filename. Therefore use the default to display | 69 | // we can not choose the filename. Therefore use the default to display |
72 | 70 | ||
73 | QString fileName = SlZDataBase::addressbookFileName(); | 71 | QString fileName = SlZDataBase::addressbookFileName(); |
74 | init( fileName ); | 72 | init( fileName ); |
75 | } | 73 | } |
76 | 74 | ||
77 | ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) | 75 | ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable ) |
78 | : Resource( 0, syncable ) | 76 | : Resource( 0, syncable ) |
79 | { | 77 | { |
80 | init( fileName ); | 78 | init( fileName ); |
81 | } | 79 | } |
82 | 80 | ||
83 | void ResourceSharpDTM::init( const QString &fileName ) | 81 | void ResourceSharpDTM::init( const QString &fileName ) |
84 | { | 82 | { |
85 | 83 | ||
86 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 84 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
87 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 85 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
88 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 86 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
89 | 87 | ||
90 | setFileName( fileName ); | 88 | setFileName( fileName ); |
91 | } | 89 | } |
92 | 90 | ||
93 | ResourceSharpDTM::~ResourceSharpDTM() | 91 | ResourceSharpDTM::~ResourceSharpDTM() |
94 | { | 92 | { |
95 | if (mConverter != 0) | 93 | if (mConverter != 0) |
96 | delete mConverter; | 94 | delete mConverter; |
97 | 95 | ||
98 | if(mAccess != 0) | 96 | if(mAccess != 0) |
99 | delete mAccess; | 97 | delete mAccess; |
100 | } | 98 | } |
101 | 99 | ||
102 | void ResourceSharpDTM::writeConfig( KConfig *config ) | 100 | void ResourceSharpDTM::writeConfig( KConfig *config ) |
103 | { | 101 | { |
104 | Resource::writeConfig( config ); | 102 | Resource::writeConfig( config ); |
105 | } | 103 | } |
106 | 104 | ||
107 | Ticket *ResourceSharpDTM::requestSaveTicket() | 105 | Ticket *ResourceSharpDTM::requestSaveTicket() |
108 | { | 106 | { |
109 | 107 | ||
110 | 108 | ||
111 | qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1()); | 109 | qDebug("ResourceSharpDTM::requestSaveTicket: %s", fileName().latin1()); |
112 | 110 | ||
113 | if ( !addressBook() ) return 0; | 111 | if ( !addressBook() ) return 0; |
114 | 112 | ||
115 | #ifdef ALLOW_LOCKING | 113 | #ifdef ALLOW_LOCKING |
116 | if ( !lock( fileName() ) ) { | 114 | if ( !lock( fileName() ) ) { |
117 | qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file "); | 115 | qDebug("ResourceSharpDTM::requestSaveTicket(): Unable to lock file "); |
diff --git a/kabc/plugins/sharpdtm/resourcesharpdtm.h b/kabc/plugins/sharpdtm/resourcesharpdtm.h index f386e69..64d06f9 100644 --- a/kabc/plugins/sharpdtm/resourcesharpdtm.h +++ b/kabc/plugins/sharpdtm/resourcesharpdtm.h | |||
@@ -13,102 +13,102 @@ | |||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #ifndef KABC_RESOURCESHARPDTM_H | 29 | #ifndef KABC_RESOURCESHARPDTM_H |
30 | #define KABC_RESOURCESHARPDTM_H | 30 | #define KABC_RESOURCESHARPDTM_H |
31 | 31 | ||
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <kdirwatch.h> | 33 | #include <kdirwatch.h> |
34 | 34 | ||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | 36 | ||
37 | #include "resource.h" | 37 | #include "resource.h" |
38 | 38 | ||
39 | 39 | ||
40 | class SlZDataBase; | 40 | class SlZDataBase; |
41 | 41 | ||
42 | namespace KABC { | 42 | namespace KABC { |
43 | 43 | ||
44 | class ResourceConfigWidget; | 44 | class ResourceConfigWidget; |
45 | class SharpDTMConverter; | 45 | class SharpDTMConverter; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | @internal | 48 | @internal |
49 | */ | 49 | */ |
50 | class ResourceSharpDTM : public Resource | 50 | class ResourceSharpDTM : public Resource |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | 55 | ||
56 | /** | 56 | /** |
57 | Constructor. | 57 | Constructor. |
58 | 58 | ||
59 | @param cfg The config object where custom resource settings are stored. | 59 | @param cfg The config object where custom resource settings are stored. |
60 | */ | 60 | */ |
61 | ResourceSharpDTM( const KConfig *cfg, bool syncable ); | 61 | ResourceSharpDTM( const KConfig *cfg ); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | Construct file resource on file @arg fileName using format @arg formatName. | 64 | Construct file resource on file @arg fileName using format @arg formatName. |
65 | */ | 65 | */ |
66 | ResourceSharpDTM( const QString &fileName, bool syncable ); | 66 | ResourceSharpDTM( const QString &fileName ); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Destructor. | 69 | * Destructor. |
70 | */ | 70 | */ |
71 | ~ResourceSharpDTM(); | 71 | ~ResourceSharpDTM(); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | Writes the config back. | 74 | Writes the config back. |
75 | */ | 75 | */ |
76 | virtual void writeConfig( KConfig *cfg ); | 76 | virtual void writeConfig( KConfig *cfg ); |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Tries to open the file and checks for the proper format. | 79 | * Tries to open the file and checks for the proper format. |
80 | * This method should be called before @ref load(). | 80 | * This method should be called before @ref load(). |
81 | */ | 81 | */ |
82 | virtual bool doOpen(); | 82 | virtual bool doOpen(); |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Closes the file again. | 85 | * Closes the file again. |
86 | */ | 86 | */ |
87 | virtual void doClose(); | 87 | virtual void doClose(); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Requests a save ticket, that is used by @ref save() | 90 | * Requests a save ticket, that is used by @ref save() |
91 | */ | 91 | */ |
92 | virtual Ticket *requestSaveTicket(); | 92 | virtual Ticket *requestSaveTicket(); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Loads all addressees from file to the address book. | 95 | * Loads all addressees from file to the address book. |
96 | * Returns true if all addressees could be loaded otherwise false. | 96 | * Returns true if all addressees could be loaded otherwise false. |
97 | */ | 97 | */ |
98 | virtual bool load(); | 98 | virtual bool load(); |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Saves all addresses from address book to file. | 101 | * Saves all addresses from address book to file. |
102 | * Returns true if all addressees could be saved otherwise false. | 102 | * Returns true if all addressees could be saved otherwise false. |
103 | * | 103 | * |
104 | * @param ticket The ticket returned by @ref requestSaveTicket() | 104 | * @param ticket The ticket returned by @ref requestSaveTicket() |
105 | */ | 105 | */ |
106 | virtual bool save( Ticket *ticket ); | 106 | virtual bool save( Ticket *ticket ); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Remove a addressee from its source. | 109 | * Remove a addressee from its source. |
110 | * This method is mainly called by KABC::AddressBook. | 110 | * This method is mainly called by KABC::AddressBook. |
111 | */ | 111 | */ |
112 | virtual void removeAddressee( const Addressee& addr ); | 112 | virtual void removeAddressee( const Addressee& addr ); |
113 | 113 | ||
114 | /** | 114 | /** |