summaryrefslogtreecommitdiffabout
path: root/kabc
Side-by-side diff
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/kabc.pro4
-rw-r--r--kabc/plugins/dir/dir.pro29
-rw-r--r--kabc/plugins/dir/resourcedir.cpp6
-rw-r--r--kabc/plugins/file/file.pro30
-rw-r--r--kabc/plugins/file/resourcefile.cpp6
5 files changed, 69 insertions, 6 deletions
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index ea4bbb7..4a8d73a 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -1,214 +1,214 @@
TEMPLATE = lib
CONFIG += qt warn_on
#release debug
DESTDIR=../bin
TARGET = microkabc
include( ../variables.pri )
INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../qtcompat ../microkde/kdeui
#LIBS += -lmicrokde -lldap
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED DESKTOP_VERSION
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
resource.h \
stdaddressbook.h \
agent.h \
geo.h \
key.h \
field.h \
plugin.h \
address.h \
addresseelist.h \
formatfactory.h \
formatplugin.h \
phonenumber.h \
distributionlist.h \
distributionlistdialog.h \
distributionlisteditor.h \
vcardformatplugin.h \
-formats/binaryformat.h \
formats/vcardformatplugin2.h \
picture.h \
secrecy.h \
sound.h \
addressbook.h \
timezone.h \
addressee.h \
addresseedialog.h \
vcardconverter.h \
vcard21parser.h \
vcardformatimpl.h \
plugins/file/resourcefile.h \
plugins/file/resourcefileconfig.h \
plugins/dir/resourcedir.h \
plugins/dir/resourcedirconfig.h \
vcardparser/vcardline.h \
vcardparser/vcard.h \
vcardparser/vcardtool.h \
vcardparser/vcardparser.h \
vcard/include/VCardAdrParam.h \
vcard/include/VCardAdrValue.h \
vcard/include/VCardAgentParam.h \
vcard/include/VCardContentLine.h \
vcard/include/VCardDateParam.h \
vcard/include/VCardDateValue.h \
vcard/include/VCardEmailParam.h \
vcard/include/VCardGeoValue.h \
vcard/include/VCardGroup.h \
vcard/include/VCardImageParam.h \
vcard/include/VCardImageValue.h \
vcard/include/VCardLangValue.h \
vcard/include/VCardNValue.h \
vcard/include/VCardParam.h \
vcard/include/VCardPhoneNumberValue.h \
vcard/include/VCardSourceParam.h \
vcard/include/VCardTelParam.h \
vcard/include/VCardTextParam.h \
vcard/include/VCardTextNSParam.h \
vcard/include/VCardTextValue.h \
vcard/include/VCardTextBinParam.h \
vcard/include/VCardURIValue.h \
vcard/include/VCardVCard.h \
vcard/include/VCardEntity.h \
vcard/include/VCardValue.h \
vcard/include/VCardSoundValue.h \
vcard/include/VCardAgentValue.h \
vcard/include/VCardTelValue.h \
vcard/include/VCardTextBinValue.h \
vcard/include/VCardOrgValue.h \
vcard/include/VCardUTCValue.h \
vcard/include/VCardClassValue.h \
vcard/include/VCardFloatValue.h \
vcard/include/VCardTextListValue.h \
vcard/include/generated/AdrParam-generated.h \
vcard/include/generated/AdrValue-generated.h \
vcard/include/generated/AgentParam-generated.h \
vcard/include/generated/ContentLine-generated.h \
vcard/include/generated/DateParam-generated.h \
vcard/include/generated/DateValue-generated.h \
vcard/include/generated/EmailParam-generated.h \
vcard/include/generated/GeoValue-generated.h \
vcard/include/generated/Group-generated.h \
vcard/include/generated/ImageParam-generated.h \
vcard/include/generated/ImageValue-generated.h \
vcard/include/generated/LangValue-generated.h \
vcard/include/generated/NValue-generated.h \
vcard/include/generated/Param-generated.h \
vcard/include/generated/PhoneNumberValue-generated.h \
vcard/include/generated/SourceParam-generated.h \
vcard/include/generated/TelParam-generated.h \
vcard/include/generated/TextParam-generated.h \
vcard/include/generated/TextNSParam-generated.h \
vcard/include/generated/TextValue-generated.h \
vcard/include/generated/TextBinParam-generated.h \
vcard/include/generated/URIValue-generated.h \
vcard/include/generated/VCard-generated.h \
vcard/include/generated/VCardEntity-generated.h \
vcard/include/generated/Value-generated.h \
vcard/include/generated/SoundValue-generated.h \
vcard/include/generated/AgentValue-generated.h \
vcard/include/generated/TelValue-generated.h \
vcard/include/generated/TextBinValue-generated.h \
vcard/include/generated/OrgValue-generated.h \
vcard/include/generated/UTCValue-generated.h \
vcard/include/generated/ClassValue-generated.h \
vcard/include/generated/FloatValue-generated.h \
vcard/include/generated/TextListValue-generated.h
# plugins/ldap/resourceldap.h \
# plugins/ldap/resourceldapconfig.h \
+#formats/binary/binaryformat.h \
SOURCES = \
distributionlist.cpp \
distributionlistdialog.cpp \
distributionlisteditor.cpp \
vcardformatplugin.cpp \
-formats/binaryformat.cpp \
formats/vcardformatplugin2.cpp \
formatfactory.cpp \
resource.cpp \
stdaddressbook.cpp \
plugin.cpp \
agent.cpp \
geo.cpp \
key.cpp \
field.cpp \
address.cpp \
phonenumber.cpp \
picture.cpp \
secrecy.cpp \
sound.cpp \
addressbook.cpp \
timezone.cpp \
addressee.cpp \
addresseelist.cpp \
addresseedialog.cpp \
vcardconverter.cpp \
vcard21parser.cpp \
vcardformatimpl.cpp \
plugins/file/resourcefile.cpp \
plugins/file/resourcefileconfig.cpp \
plugins/dir/resourcedir.cpp \
plugins/dir/resourcedirconfig.cpp \
vcardparser/vcardline.cpp \
vcardparser/vcard.cpp \
vcardparser/vcardtool.cpp \
vcardparser/vcardparser.cpp \
vcard/AdrParam.cpp \
vcard/AdrValue.cpp \
vcard/AgentParam.cpp \
vcard/ContentLine.cpp \
vcard/DateParam.cpp \
vcard/DateValue.cpp \
vcard/EmailParam.cpp \
vcard/Entity.cpp \
vcard/Enum.cpp \
vcard/GeoValue.cpp \
vcard/ImageParam.cpp \
vcard/ImageValue.cpp \
vcard/LangValue.cpp \
vcard/NValue.cpp \
vcard/Param.cpp \
vcard/PhoneNumberValue.cpp \
vcard/RToken.cpp \
vcard/SourceParam.cpp \
vcard/TelParam.cpp \
vcard/TextParam.cpp \
vcard/TextValue.cpp \
vcard/TextBinParam.cpp \
vcard/URIValue.cpp \
vcard/VCardv.cpp \
vcard/VCardEntity.cpp \
vcard/Value.cpp \
vcard/SoundValue.cpp \
vcard/AgentValue.cpp \
vcard/TelValue.cpp \
vcard/TextBinValue.cpp \
vcard/OrgValue.cpp \
vcard/UTCValue.cpp \
vcard/ClassValue.cpp \
vcard/FloatValue.cpp \
vcard/TextListValue.cpp
# plugins/ldap/resourceldap.cpp \
# plugins/ldap/resourceldapconfig.cpp \
+#formats/binary/binaryformat.cpp \
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro
new file mode 100644
index 0000000..3db201f
--- a/dev/null
+++ b/kabc/plugins/dir/dir.pro
@@ -0,0 +1,29 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+#release debug
+
+TARGET = microkabc_dir
+INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat
+DESTDIR = ../../../bin
+#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -L$(QPEDIR)/lib
+
+INTERFACES = \
+
+HEADERS = \
+ resourcedir.h \
+ resourcedirconfig.h
+
+SOURCES = \
+ resourcedir.cpp \
+ resourcedirconfig.cpp
+
+unix : {
+OBJECTS_DIR = obj/unix
+MOC_DIR = moc/unix
+}
+win32: {
+DEFINES += _WIN32_
+OBJECTS_DIR = obj/win
+MOC_DIR = moc/win
+} \ No newline at end of file
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp
index be19821..6ea2f4b 100644
--- a/kabc/plugins/dir/resourcedir.cpp
+++ b/kabc/plugins/dir/resourcedir.cpp
@@ -215,99 +215,101 @@ bool ResourceDir::save( Ticket *ticket )
continue;
}
mFormat->save( *it, &file );
// mark as unchanged
(*it).setChanged( false );
file.close();
}
delete ticket;
unlock( mPath );
return ok;
}
bool ResourceDir::lock( const QString &path )
{
kdDebug(5700) << "ResourceDir::lock()" << endl;
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
kdDebug(5700) << "-- lock name: " << lockName << endl;
if ( QFile::exists( lockName ) ) return false;
QString lockUniqueName;
lockUniqueName = p + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// Create unique file
QFile file( mLockUniqueName );
file.open( IO_WriteOnly );
file.close();
// Create lock file
- int result = ::link( QFile::encodeName( mLockUniqueName ),
+ int result = 0;
+#ifndef _WIN32_
+ result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
-
+#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}
// TODO: check stat
return false;
}
void ResourceDir::unlock( const QString &path )
{
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp( "/" ), "_" );
//US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" );
::unlink( QFile::encodeName( lockName ) );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
}
void ResourceDir::setPath( const QString &path )
{
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.stopScan();
mDirWatch.removeDir( mPath );
*/
mPath = path;
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.addDir( mPath, true );
mDirWatch.startScan();
*/
//US simulate KDirWatch event
pathChanged();
}
QString ResourceDir::path() const
{
return mPath;
}
void ResourceDir::setFormat( const QString &format )
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro
new file mode 100644
index 0000000..a5ade93
--- a/dev/null
+++ b/kabc/plugins/file/file.pro
@@ -0,0 +1,30 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+#release debug
+
+TARGET = microkabc_file
+INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat
+
+DESTDIR = ../../../bin
+#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -L$(QPEDIR)/lib
+
+INTERFACES = \
+
+HEADERS = \
+ resourcefile.h \
+ resourcefileconfig.h
+
+SOURCES = \
+ resourcefile.cpp \
+ resourcefileconfig.cpp
+
+unix : {
+OBJECTS_DIR = obj/unix
+MOC_DIR = moc/unix
+}
+win32: {
+DEFINES += _WIN32_
+OBJECTS_DIR = obj/win
+MOC_DIR = moc/win
+} \ No newline at end of file
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index 3920f69..4b4c935 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -241,99 +241,101 @@ bool ResourceFile::save( Ticket *ticket )
}
else {
}
if ( !ok )
addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) );
delete ticket;
unlock( mFileName );
return ok;
qDebug("ResourceFile::save has to be changed");
return true;
}
bool ResourceFile::lock( const QString &fileName )
{
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if (QFile::exists( lockName )) return false;
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// Create unique file
QFile file( mLockUniqueName );
file.open( IO_WriteOnly );
file.close();
// Create lock file
- int result = ::link( QFile::encodeName( mLockUniqueName ),
+ int result = 0;
+#ifndef _WIN32_
+ result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
-
+#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}
// TODO: check stat
return false;
}
void ResourceFile::unlock( const QString &fileName )
{
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp( "/" ), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
//US QString lockName = fn + ".lock";
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
}
void ResourceFile::setFileName( const QString &fileName )
{
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.stopScan();
mDirWatch.removeFile( mFileName );
*/
mFileName = fileName;
/*US ToDo: no synchronization so far. Has to be changed in the future
mDirWatch.addFile( mFileName );
mDirWatch.startScan();
*/
//US simulate KDirWatch event
fileChanged();
}
QString ResourceFile::fileName() const
{
return mFileName;
}
void ResourceFile::setFormat( const QString &format )