-rw-r--r-- | kabc/plugins/dir/dir.pro | 5 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 11 | ||||
-rw-r--r-- | kabc/plugins/file/file.pro | 5 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 10 |
4 files changed, 28 insertions, 3 deletions
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro index 3db201f..0023029 100644 --- a/kabc/plugins/dir/dir.pro +++ b/kabc/plugins/dir/dir.pro | |||
@@ -1,29 +1,34 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_dir | 5 | TARGET = microkabc_dir |
6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat | 6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat |
7 | DESTDIR = ../../../bin | 7 | DESTDIR = ../../../bin |
8 | #LIBS += -lmicrokde -lmicrokabc | 8 | #LIBS += -lmicrokde -lmicrokabc |
9 | #LIBS += -L$(QPEDIR)/lib | 9 | #LIBS += -L$(QPEDIR)/lib |
10 | 10 | ||
11 | INTERFACES = \ | 11 | INTERFACES = \ |
12 | 12 | ||
13 | HEADERS = \ | 13 | HEADERS = \ |
14 | resourcedir.h \ | 14 | resourcedir.h \ |
15 | resourcedirconfig.h | 15 | resourcedirconfig.h |
16 | 16 | ||
17 | SOURCES = \ | 17 | SOURCES = \ |
18 | resourcedir.cpp \ | 18 | resourcedir.cpp \ |
19 | resourcedirconfig.cpp | 19 | resourcedirconfig.cpp |
20 | 20 | ||
21 | unix : { | 21 | unix : { |
22 | OBJECTS_DIR = obj/unix | 22 | OBJECTS_DIR = obj/unix |
23 | MOC_DIR = moc/unix | 23 | MOC_DIR = moc/unix |
24 | } | 24 | } |
25 | win32: { | 25 | win32: { |
26 | CONFIG += dll | ||
26 | DEFINES += _WIN32_ | 27 | DEFINES += _WIN32_ |
27 | OBJECTS_DIR = obj/win | 28 | OBJECTS_DIR = obj/win |
28 | MOC_DIR = moc/win | 29 | MOC_DIR = moc/win |
30 | LIBS += ../../../bin/microkdepim.lib | ||
31 | LIBS += ../../../bin/microkcal.lib | ||
32 | LIBS += ../../../bin/microkde.lib | ||
33 | LIBS += ../../../bin/microkabc.lib | ||
29 | } \ No newline at end of file | 34 | } \ No newline at end of file |
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index 6ea2f4b..3cb5179 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp | |||
@@ -33,125 +33,132 @@ $Id$ | |||
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 | 47 | ||
48 | #include "addressbook.h" | 48 | #include "addressbook.h" |
49 | 49 | ||
50 | #include "formatfactory.h" | 50 | #include "formatfactory.h" |
51 | 51 | ||
52 | #include "resourcedirconfig.h" | 52 | #include "resourcedirconfig.h" |
53 | #include "stdaddressbook.h" | 53 | #include "stdaddressbook.h" |
54 | 54 | ||
55 | //US | 55 | //US |
56 | #include <qdir.h> | 56 | #include <qdir.h> |
57 | //US #include "../../formats/vcardformatplugin2.h" | 57 | //US #include "../../formats/vcardformatplugin2.h" |
58 | //US #include "../../formats/binaryformat.h" | 58 | //US #include "../../formats/binaryformat.h" |
59 | 59 | ||
60 | #include "resourcedir.h" | 60 | #include "resourcedir.h" |
61 | 61 | ||
62 | using namespace KABC; | 62 | using namespace KABC; |
63 | 63 | ||
64 | extern "C" | 64 | extern "C" |
65 | #ifdef _WIN32_ | ||
66 | __declspec(dllexport) | ||
67 | #else | ||
65 | { | 68 | { |
69 | #endif | ||
70 | |||
66 | //US void *init_kabc_dir() | 71 | //US void *init_kabc_dir() |
67 | void *init_microkabc_dir() | 72 | void *init_microkabc_dir() |
68 | { | 73 | { |
69 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); | 74 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); |
70 | } | 75 | } |
76 | #ifndef _WIN32_ | ||
71 | } | 77 | } |
72 | 78 | #endif | |
73 | 79 | ||
74 | ResourceDir::ResourceDir( const KConfig *config ) | 80 | ResourceDir::ResourceDir( const KConfig *config ) |
75 | : Resource( config ) | 81 | : Resource( config ) |
76 | { | 82 | { |
77 | QString path; | 83 | QString path; |
78 | 84 | ||
79 | KConfig *cfg = (KConfig *)config; | 85 | KConfig *cfg = (KConfig *)config; |
80 | if ( cfg ) { | 86 | if ( cfg ) { |
81 | //US path = config->readEntry( "FilePath" ); | 87 | //US path = config->readEntry( "FilePath" ); |
82 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); | 88 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); |
83 | //US mFormatName = config->readEntry( "FileFormat" ); | 89 | //US mFormatName = config->readEntry( "FileFormat" ); |
84 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); | 90 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); |
85 | } else { | 91 | } else { |
86 | path = StdAddressBook::directoryName(); | 92 | path = StdAddressBook::directoryName(); |
87 | mFormatName = "vcard"; | 93 | mFormatName = "vcard"; |
88 | } | 94 | } |
89 | 95 | ||
90 | 96 | ||
91 | FormatFactory *factory = FormatFactory::self(); | 97 | FormatFactory *factory = FormatFactory::self(); |
92 | mFormat = factory->format( mFormatName ); | 98 | mFormat = factory->format( mFormatName ); |
93 | 99 | ||
94 | if ( !mFormat ) { | 100 | if ( !mFormat ) { |
95 | mFormatName = "vcard"; | 101 | mFormatName = "vcard"; |
96 | mFormat = factory->format( mFormatName ); | 102 | mFormat = factory->format( mFormatName ); |
97 | } | 103 | } |
98 | 104 | ||
99 | /*US | 105 | /*US |
100 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); | 106 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); |
101 | if (mFormatName == "vcard") | 107 | if (mFormatName == "vcard") |
102 | mFormat = new VCardFormatPlugin2(); | 108 | mFormat = new VCardFormatPlugin2(); |
103 | else if (mFormatName == "binary") | 109 | else if (mFormatName == "binary") |
104 | mFormat = new BinaryFormat(); | 110 | mFormat = new BinaryFormat(); |
105 | else | 111 | else |
106 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); | 112 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); |
107 | */ | 113 | */ |
108 | 114 | ||
109 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods | 115 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods |
110 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); | 116 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); |
111 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); | 117 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); |
112 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); | 118 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); |
113 | */ | 119 | */ |
114 | 120 | ||
115 | setPath( path ); | 121 | setPath( path ); |
116 | } | 122 | } |
117 | 123 | ||
118 | ResourceDir::~ResourceDir() | 124 | ResourceDir::~ResourceDir() |
119 | { | 125 | { |
120 | delete mFormat; | 126 | delete mFormat; |
121 | mFormat = 0; | 127 | mFormat = 0; |
122 | } | 128 | } |
123 | 129 | ||
124 | void ResourceDir::writeConfig( KConfig *config ) | 130 | void ResourceDir::writeConfig( KConfig *config ) |
125 | { | 131 | { |
132 | config->setGroup( "Resource_" + identifier() ); | ||
126 | Resource::writeConfig( config ); | 133 | Resource::writeConfig( config ); |
127 | 134 | ||
128 | config->writeEntry( "FilePath", mPath ); | 135 | config->writeEntry( "FilePath", mPath ); |
129 | config->writeEntry( "FileFormat", mFormatName ); | 136 | config->writeEntry( "FileFormat", mFormatName ); |
130 | } | 137 | } |
131 | 138 | ||
132 | Ticket *ResourceDir::requestSaveTicket() | 139 | Ticket *ResourceDir::requestSaveTicket() |
133 | { | 140 | { |
134 | kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; | 141 | kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; |
135 | 142 | ||
136 | if ( !addressBook() ) return 0; | 143 | if ( !addressBook() ) return 0; |
137 | 144 | ||
138 | if ( !lock( mPath ) ) { | 145 | if ( !lock( mPath ) ) { |
139 | kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" | 146 | kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" |
140 | << mPath << "'" << endl; | 147 | << mPath << "'" << endl; |
141 | return 0; | 148 | return 0; |
142 | } | 149 | } |
143 | return createTicket( this ); | 150 | return createTicket( this ); |
144 | } | 151 | } |
145 | 152 | ||
146 | 153 | ||
147 | bool ResourceDir::doOpen() | 154 | bool ResourceDir::doOpen() |
148 | { | 155 | { |
149 | QDir dir( mPath ); | 156 | QDir dir( mPath ); |
150 | if ( !dir.exists() ) { // no directory available | 157 | if ( !dir.exists() ) { // no directory available |
151 | return dir.mkdir( dir.path() ); | 158 | return dir.mkdir( dir.path() ); |
152 | } else { | 159 | } else { |
153 | QString testName = dir.entryList( QDir::Files )[0]; | 160 | QString testName = dir.entryList( QDir::Files )[0]; |
154 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory | 161 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory |
155 | return true; | 162 | return true; |
156 | 163 | ||
157 | QFile file( mPath + "/" + testName ); | 164 | QFile file( mPath + "/" + testName ); |
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro index a5ade93..7cf7c58 100644 --- a/kabc/plugins/file/file.pro +++ b/kabc/plugins/file/file.pro | |||
@@ -1,30 +1,35 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_file | 5 | TARGET = microkabc_file |
6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat | 6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat |
7 | 7 | ||
8 | DESTDIR = ../../../bin | 8 | DESTDIR = ../../../bin |
9 | #LIBS += -lmicrokde -lmicrokabc | 9 | #LIBS += -lmicrokde -lmicrokabc |
10 | #LIBS += -L$(QPEDIR)/lib | 10 | #LIBS += -L$(QPEDIR)/lib |
11 | 11 | ||
12 | INTERFACES = \ | 12 | INTERFACES = \ |
13 | 13 | ||
14 | HEADERS = \ | 14 | HEADERS = \ |
15 | resourcefile.h \ | 15 | resourcefile.h \ |
16 | resourcefileconfig.h | 16 | resourcefileconfig.h |
17 | 17 | ||
18 | SOURCES = \ | 18 | SOURCES = \ |
19 | resourcefile.cpp \ | 19 | resourcefile.cpp \ |
20 | resourcefileconfig.cpp | 20 | resourcefileconfig.cpp |
21 | 21 | ||
22 | unix : { | 22 | unix : { |
23 | OBJECTS_DIR = obj/unix | 23 | OBJECTS_DIR = obj/unix |
24 | MOC_DIR = moc/unix | 24 | MOC_DIR = moc/unix |
25 | } | 25 | } |
26 | win32: { | 26 | win32: { |
27 | CONFIG += dll | ||
27 | DEFINES += _WIN32_ | 28 | DEFINES += _WIN32_ |
28 | OBJECTS_DIR = obj/win | 29 | OBJECTS_DIR = obj/win |
29 | MOC_DIR = moc/win | 30 | MOC_DIR = moc/win |
31 | LIBS += ../../../bin/microkdepim.lib | ||
32 | LIBS += ../../../bin/microkcal.lib | ||
33 | LIBS += ../../../bin/microkde.lib | ||
34 | LIBS += ../../../bin/microkabc.lib | ||
30 | } \ No newline at end of file | 35 | } \ No newline at end of file |
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 4b4c935..2d20706 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp | |||
@@ -29,72 +29,78 @@ $Id$ | |||
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 | 45 | ||
46 | #include "formatfactory.h" | 46 | #include "formatfactory.h" |
47 | 47 | ||
48 | #include "resource.h" | 48 | #include "resource.h" |
49 | #include "resourcefileconfig.h" | 49 | #include "resourcefileconfig.h" |
50 | #include "stdaddressbook.h" | 50 | #include "stdaddressbook.h" |
51 | 51 | ||
52 | //US #include "../../formats/vcardformatplugin2.h" | 52 | //US #include "../../formats/vcardformatplugin2.h" |
53 | //US #include "../../formats/binaryformat.h" | 53 | //US #include "../../formats/binaryformat.h" |
54 | 54 | ||
55 | 55 | ||
56 | #include "resourcefile.h" | 56 | #include "resourcefile.h" |
57 | 57 | ||
58 | using namespace KABC; | 58 | using namespace KABC; |
59 | 59 | ||
60 | extern "C" | 60 | extern "C" |
61 | #ifdef _WIN32_ | ||
62 | __declspec(dllexport) | ||
63 | #else | ||
61 | { | 64 | { |
65 | #endif | ||
66 | |||
62 | //US void *init_kabc_file() | 67 | //US void *init_kabc_file() |
63 | void *init_microkabc_file() | 68 | void *init_microkabc_file() |
64 | { | 69 | { |
65 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); | 70 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); |
66 | } | 71 | } |
72 | #ifndef _WIN32_ | ||
67 | } | 73 | } |
68 | 74 | #endif | |
69 | 75 | ||
70 | ResourceFile::ResourceFile( const KConfig *config ) | 76 | ResourceFile::ResourceFile( const KConfig *config ) |
71 | : Resource( config ) , mFormat( 0 ) | 77 | : Resource( config ) , mFormat( 0 ) |
72 | { | 78 | { |
73 | QString fileName, formatName; | 79 | QString fileName, formatName; |
74 | 80 | ||
75 | KConfig *cfg = (KConfig *)config; | 81 | KConfig *cfg = (KConfig *)config; |
76 | if ( cfg ) { | 82 | if ( cfg ) { |
77 | fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() ); | 83 | fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() ); |
78 | formatName = cfg->readEntry( "FileFormat", "vcard" ); | 84 | formatName = cfg->readEntry( "FileFormat", "vcard" ); |
79 | // qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() ); | 85 | // qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() ); |
80 | } else { | 86 | } else { |
81 | fileName = StdAddressBook::fileName(); | 87 | fileName = StdAddressBook::fileName(); |
82 | formatName = "vcard"; | 88 | formatName = "vcard"; |
83 | // qDebug("ResourceFile::ResourceFile : 2 %s, %s", fileName.latin1(), formatName.latin1() ); | 89 | // qDebug("ResourceFile::ResourceFile : 2 %s, %s", fileName.latin1(), formatName.latin1() ); |
84 | } | 90 | } |
85 | 91 | ||
86 | init( fileName, formatName ); | 92 | init( fileName, formatName ); |
87 | } | 93 | } |
88 | 94 | ||
89 | ResourceFile::ResourceFile( const QString &fileName, | 95 | ResourceFile::ResourceFile( const QString &fileName, |
90 | const QString &formatName ) | 96 | const QString &formatName ) |
91 | : Resource( 0 ) | 97 | : Resource( 0 ) |
92 | { | 98 | { |
93 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); | 99 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); |
94 | init( fileName, formatName ); | 100 | init( fileName, formatName ); |
95 | } | 101 | } |
96 | 102 | ||
97 | void ResourceFile::init( const QString &fileName, const QString &formatName ) | 103 | void ResourceFile::init( const QString &fileName, const QString &formatName ) |
98 | { | 104 | { |
99 | mFormatName = formatName; | 105 | mFormatName = formatName; |
100 | 106 | ||
@@ -108,64 +114,66 @@ void ResourceFile::init( const QString &fileName, const QString &formatName ) | |||
108 | 114 | ||
109 | /*US | 115 | /*US |
110 | //US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1()); | 116 | //US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1()); |
111 | if (mFormatName == "vcard") { | 117 | if (mFormatName == "vcard") { |
112 | mFormat = new VCardFormatPlugin2(); | 118 | mFormat = new VCardFormatPlugin2(); |
113 | // qDebug("ResourceFile::init format VCardFormatPlugin2"); | 119 | // qDebug("ResourceFile::init format VCardFormatPlugin2"); |
114 | } | 120 | } |
115 | else if (mFormatName == "binary") { | 121 | else if (mFormatName == "binary") { |
116 | mFormat = new BinaryFormat(); | 122 | mFormat = new BinaryFormat(); |
117 | // qDebug("ResourceFile::init format BinaryFormat"); | 123 | // qDebug("ResourceFile::init format BinaryFormat"); |
118 | } | 124 | } |
119 | else | 125 | else |
120 | qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); | 126 | qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); |
121 | */ | 127 | */ |
122 | 128 | ||
123 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods | 129 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods |
124 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 130 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 131 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 132 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
127 | */ | 133 | */ |
128 | 134 | ||
129 | setFileName( fileName ); | 135 | setFileName( fileName ); |
130 | } | 136 | } |
131 | 137 | ||
132 | ResourceFile::~ResourceFile() | 138 | ResourceFile::~ResourceFile() |
133 | { | 139 | { |
134 | delete mFormat; | 140 | delete mFormat; |
135 | mFormat = 0; | 141 | mFormat = 0; |
136 | } | 142 | } |
137 | 143 | ||
138 | void ResourceFile::writeConfig( KConfig *config ) | 144 | void ResourceFile::writeConfig( KConfig *config ) |
139 | { | 145 | { |
146 | |||
147 | config->setGroup( "Resource_" + identifier() ); | ||
140 | Resource::writeConfig( config ); | 148 | Resource::writeConfig( config ); |
141 | 149 | ||
142 | config->writeEntry( "FileName", mFileName ); | 150 | config->writeEntry( "FileName", mFileName ); |
143 | config->writeEntry( "FileFormat", mFormatName ); | 151 | config->writeEntry( "FileFormat", mFormatName ); |
144 | 152 | ||
145 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 153 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
146 | 154 | ||
147 | } | 155 | } |
148 | 156 | ||
149 | Ticket *ResourceFile::requestSaveTicket() | 157 | Ticket *ResourceFile::requestSaveTicket() |
150 | { | 158 | { |
151 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; | 159 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; |
152 | 160 | ||
153 | if ( !addressBook() ) return 0; | 161 | if ( !addressBook() ) return 0; |
154 | 162 | ||
155 | if ( !lock( mFileName ) ) { | 163 | if ( !lock( mFileName ) ) { |
156 | kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" | 164 | kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" |
157 | << mFileName << "'" << endl; | 165 | << mFileName << "'" << endl; |
158 | return 0; | 166 | return 0; |
159 | } | 167 | } |
160 | return createTicket( this ); | 168 | return createTicket( this ); |
161 | } | 169 | } |
162 | 170 | ||
163 | 171 | ||
164 | bool ResourceFile::doOpen() | 172 | bool ResourceFile::doOpen() |
165 | { | 173 | { |
166 | QFile file( mFileName ); | 174 | QFile file( mFileName ); |
167 | 175 | ||
168 | if ( !file.exists() ) { | 176 | if ( !file.exists() ) { |
169 | // try to create the file | 177 | // try to create the file |
170 | bool ok = file.open( IO_WriteOnly ); | 178 | bool ok = file.open( IO_WriteOnly ); |
171 | if ( ok ) | 179 | if ( ok ) |