-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 @@ -2,28 +2,33 @@ 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: { +CONFIG += dll DEFINES += _WIN32_ OBJECTS_DIR = obj/win MOC_DIR = moc/win +LIBS += ../../../bin/microkdepim.lib +LIBS += ../../../bin/microkcal.lib +LIBS += ../../../bin/microkde.lib +LIBS += ../../../bin/microkabc.lib }
\ 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 @@ -41,56 +41,62 @@ $Id$ #include <kdebug.h> //US #include <kgenericfactory.h> #include <kglobal.h> #include <klocale.h> #include <kstandarddirs.h> #include <kurlrequester.h> #include "addressbook.h" #include "formatfactory.h" #include "resourcedirconfig.h" #include "stdaddressbook.h" //US #include <qdir.h> //US #include "../../formats/vcardformatplugin2.h" //US #include "../../formats/binaryformat.h" #include "resourcedir.h" using namespace KABC; extern "C" +#ifdef _WIN32_ +__declspec(dllexport) +#else { +#endif + //US void *init_kabc_dir() void *init_microkabc_dir() { return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); } +#ifndef _WIN32_ } - +#endif ResourceDir::ResourceDir( const KConfig *config ) : Resource( config ) { QString path; KConfig *cfg = (KConfig *)config; if ( cfg ) { //US path = config->readEntry( "FilePath" ); path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); //US mFormatName = config->readEntry( "FileFormat" ); mFormatName = cfg->readEntry( "FileFormat", "vcard" ); } else { path = StdAddressBook::directoryName(); mFormatName = "vcard"; } FormatFactory *factory = FormatFactory::self(); mFormat = factory->format( mFormatName ); if ( !mFormat ) { mFormatName = "vcard"; mFormat = factory->format( mFormatName ); @@ -101,49 +107,50 @@ ResourceDir::ResourceDir( const KConfig *config ) if (mFormatName == "vcard") mFormat = new VCardFormatPlugin2(); else if (mFormatName == "binary") mFormat = new BinaryFormat(); else qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); */ /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); */ setPath( path ); } ResourceDir::~ResourceDir() { delete mFormat; mFormat = 0; } void ResourceDir::writeConfig( KConfig *config ) -{ +{ + config->setGroup( "Resource_" + identifier() ); Resource::writeConfig( config ); config->writeEntry( "FilePath", mPath ); config->writeEntry( "FileFormat", mFormatName ); } Ticket *ResourceDir::requestSaveTicket() { kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; if ( !addressBook() ) return 0; if ( !lock( mPath ) ) { kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" << mPath << "'" << endl; return 0; } return createTicket( this ); } bool ResourceDir::doOpen() { QDir dir( mPath ); 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 @@ -3,28 +3,33 @@ 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: { +CONFIG += dll DEFINES += _WIN32_ OBJECTS_DIR = obj/win MOC_DIR = moc/win +LIBS += ../../../bin/microkdepim.lib +LIBS += ../../../bin/microkcal.lib +LIBS += ../../../bin/microkde.lib +LIBS += ../../../bin/microkabc.lib }
\ 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 @@ -37,56 +37,62 @@ $Id$ #include <qtimer.h> #include <kapplication.h> #include <kconfig.h> #include <kdebug.h> #include <klocale.h> //US #include <ksavefile.h> #include <kstandarddirs.h> #include "formatfactory.h" #include "resource.h" #include "resourcefileconfig.h" #include "stdaddressbook.h" //US #include "../../formats/vcardformatplugin2.h" //US #include "../../formats/binaryformat.h" #include "resourcefile.h" using namespace KABC; extern "C" +#ifdef _WIN32_ +__declspec(dllexport) +#else { +#endif + //US void *init_kabc_file() void *init_microkabc_file() { return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); } +#ifndef _WIN32_ } - +#endif ResourceFile::ResourceFile( const KConfig *config ) : Resource( config ) , mFormat( 0 ) { QString fileName, formatName; KConfig *cfg = (KConfig *)config; if ( cfg ) { fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() ); formatName = cfg->readEntry( "FileFormat", "vcard" ); // qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() ); } else { fileName = StdAddressBook::fileName(); formatName = "vcard"; // qDebug("ResourceFile::ResourceFile : 2 %s, %s", fileName.latin1(), formatName.latin1() ); } init( fileName, formatName ); } ResourceFile::ResourceFile( const QString &fileName, const QString &formatName ) : Resource( 0 ) { @@ -116,48 +122,50 @@ void ResourceFile::init( const QString &fileName, const QString &formatName ) mFormat = new BinaryFormat(); // qDebug("ResourceFile::init format BinaryFormat"); } else qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); */ /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); */ setFileName( fileName ); } ResourceFile::~ResourceFile() { delete mFormat; mFormat = 0; } void ResourceFile::writeConfig( KConfig *config ) { + + config->setGroup( "Resource_" + identifier() ); Resource::writeConfig( config ); config->writeEntry( "FileName", mFileName ); config->writeEntry( "FileFormat", mFormatName ); // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); } Ticket *ResourceFile::requestSaveTicket() { kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; if ( !addressBook() ) return 0; if ( !lock( mFileName ) ) { kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" << mFileName << "'" << endl; return 0; } return createTicket( this ); } |