summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp2
-rw-r--r--kabc/kabcE.pro2
-rw-r--r--kabc/plugins/dir/resourcedir.cpp7
-rw-r--r--kabc/plugins/dir/resourcedir.h2
-rw-r--r--kabc/plugins/file/resourcefile.cpp16
-rw-r--r--kabc/plugins/file/resourcefile.h4
-rw-r--r--kabc/plugins/ldap/resourceldap.cpp7
-rw-r--r--kabc/plugins/ldap/resourceldap.h2
-rw-r--r--kabc/plugins/opie/resourceopie.cpp11
-rw-r--r--kabc/plugins/opie/resourceopie.h4
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp11
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.h4
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.cpp8
-rw-r--r--kabc/plugins/sharpdtm/resourcesharpdtm.h4
-rw-r--r--kabc/resource.cpp32
-rw-r--r--kabc/resource.h16
-rw-r--r--kaddressbook/xxportobject.cpp4
-rw-r--r--microkde/kresources/configdialog.cpp125
-rw-r--r--microkde/kresources/configdialog.h5
-rw-r--r--microkde/kresources/configpage.cpp29
-rw-r--r--microkde/kresources/factory.cpp38
-rw-r--r--microkde/kresources/factory.h15
-rw-r--r--microkde/kresources/manager.h12
-rw-r--r--microkde/kresources/managerimpl.cpp13
-rw-r--r--microkde/kresources/managerimpl.h8
-rw-r--r--microkde/kresources/resource.cpp1
-rw-r--r--microkde/kresources/resource.h24
-rw-r--r--microkde/microkdeE.pro2
28 files changed, 91 insertions, 317 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index 592d78d..c584c35 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -256,49 +256,49 @@ void AddressBook::init(const QString &config, const QString &family )
con->writeEntry( "FileName", config );
con->writeEntry( "FileFormat", QString("vcard") );
con->writeEntry( "ResourceIdentifier", QString("sync") );
con->writeEntry( "ResourceName", QString("sync_res") );
if ( config.right(4) == ".xml" )
con->writeEntry( "ResourceType", QString("qtopia") );
else if ( config == "sharp" ) {
con->writeEntry( "ResourceType", QString("sharp") );
} else {
con->writeEntry( "ResourceType", QString("file") );
}
//con->sync();
d->mConfig = con;
}
else
d->mConfig = new KConfig( locateLocal("config", config) );
// qDebug("AddressBook::init 1 config=%s",config.latin1() );
}
else {
d->mConfig = 0;
// qDebug("AddressBook::init 1 config=0");
}
//US d->mErrorHandler = 0;
- d->mManager = new KRES::Manager<Resource>( fami, false );
+ d->mManager = new KRES::Manager<Resource>( fami );
d->mManager->readConfig( d->mConfig );
if ( family == "syncContact" ) {
KRES::Manager<Resource> *manager = d->mManager;
KRES::Manager<Resource>::ActiveIterator it;
for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
(*it)->setAddressBook( this );
if ( !(*it)->open() )
error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
}
Resource *res = standardResource();
if ( !res ) {
qDebug("ERROR: no standard resource");
res = manager->createResource( "file" );
if ( res )
{
addResource( res );
}
else
qDebug(" No resource available!!!");
}
setStandardResource( res );
manager->writeConfig();
}
addCustomField( i18n( "Department" ), KABC::Field::Organization,
diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro
index 061909b..96fe39e 100644
--- a/kabc/kabcE.pro
+++ b/kabc/kabcE.pro
@@ -20,49 +20,48 @@ INTERFACES = \
HEADERS = \
address.h \
addressbook.h \
addressee.h \
addresseedialog.h \
addresseelist.h \
addresseeview.h \
agent.h \
distributionlist.h \
distributionlistdialog.h \
distributionlisteditor.h \
field.h \
formatfactory.h \
formatplugin.h \
geo.h \
key.h \
phonenumber.h \
picture.h \
plugin.h \
resource.h \
secrecy.h \
sound.h \
stdaddressbook.h \
- syncprefwidget.h \
timezone.h \
tmpaddressbook.h \
vcardconverter.h \
vcard21parser.h \
vcardformatimpl.h \
vcardformatplugin.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 \
@@ -125,49 +124,48 @@ HEADERS = \
SOURCES = \
address.cpp \
addressbook.cpp \
addressee.cpp \
addresseedialog.cpp \
addresseelist.cpp \
addresseeview.cpp \
agent.cpp \
distributionlist.cpp \
distributionlistdialog.cpp \
distributionlisteditor.cpp \
field.cpp \
formatfactory.cpp \
geo.cpp \
key.cpp \
phonenumber.cpp \
picture.cpp \
plugin.cpp \
resource.cpp \
secrecy.cpp \
sound.cpp \
stdaddressbook.cpp \
- syncprefwidget.cpp \
timezone.cpp \
tmpaddressbook.cpp \
vcardconverter.cpp \
vcard21parser.cpp \
vcardformatimpl.cpp \
vcardformatplugin.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 \
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
@@ -37,72 +37,71 @@ $Id$
#include <qwidget.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
//US #include <kgenericfactory.h>
#include <kglobal.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#include <kmessagebox.h>
#include "addressbook.h"
#include "formatfactory.h"
#include "resourcedirconfig.h"
#include "stdaddressbook.h"
//US
#include <qdir.h>
#define NO_DIRWATCH
#include "resourcedir.h"
-#include "syncprefwidget.h"
//#define ALLOW_LOCKING
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, SyncPrefWidgetContainer>();
+ return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>();
}
#ifndef _WIN32_
}
#endif
-ResourceDir::ResourceDir( const KConfig *config, bool syncable )
- : Resource( config, syncable )
+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 );
}
/*US
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
@@ -28,49 +28,49 @@ $Id$
#ifndef KABC_RESOURCEDIR_H
#define KABC_RESOURCEDIR_H
#include <kconfig.h>
#include <kdirwatch.h>
#include <sys/types.h>
#include "resource.h"
class QTimer;
namespace KABC {
class FormatPlugin;
/**
@internal
*/
class ResourceDir : public Resource
{
Q_OBJECT
public:
- ResourceDir( const KConfig*, bool syncable );
+ ResourceDir( const KConfig* );
~ResourceDir();
virtual void writeConfig( KConfig* );
virtual bool doOpen();
virtual void doClose();
virtual Ticket *requestSaveTicket();
virtual bool load();
virtual bool save( Ticket * );
/**
* Set path to be used for saving.
*/
void setPath( const QString & );
/**
* Return path used for loading and saving the address book.
*/
QString path() const;
/**
* Set the format by name.
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
@@ -30,97 +30,93 @@ $Id$
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <qtimer.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include "formatfactory.h"
#include "resource.h"
#include "resourcefileconfig.h"
#include "stdaddressbook.h"
#define NO_DIRWATCH
#include "resourcefile.h"
-#include "syncprefwidget.h"
//#define ALLOW_LOCKING
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, SyncPrefWidgetContainer>();
+ return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>();
}
#ifndef _WIN32_
}
#endif
-ResourceFile::ResourceFile( const KConfig *config, bool syncable )
- : Resource( config, syncable ) , mFormat( 0 )
+ResourceFile::ResourceFile( const KConfig *config )
+ : Resource( config ) , mFormat( 0 )
{
QString fileName, formatName, default_fileName;
- if (syncable == true)
- default_fileName = "/home/polo/kdepim/apps/kabc/localfile.vcf";
- else
- default_fileName = StdAddressBook::fileName();
+ default_fileName = StdAddressBook::fileName();
KConfig *cfg = (KConfig *)config;
if ( cfg ) {
fileName = cfg->readEntry( "FileName", default_fileName );
formatName = cfg->readEntry( "FileFormat", "vcard" );
} else {
fileName = default_fileName;
formatName = "vcard";
}
init( fileName, formatName );
}
-ResourceFile::ResourceFile( const QString &fileName, bool syncable ,
+ResourceFile::ResourceFile( const QString &fileName ,
const QString &formatName )
- : Resource( 0, syncable )
+ : Resource( 0 )
{
// qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1());
init( fileName, formatName );
}
void ResourceFile::init( const QString &fileName, const QString &formatName )
{
mFormatName = formatName;
FormatFactory *factory = FormatFactory::self();
mFormat = factory->format( mFormatName );
if ( !mFormat ) {
mFormatName = "vcard";
mFormat = factory->format( mFormatName );
}
#ifndef NO_DIRWATCH
connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) );
connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) );
#endif
setFileName( fileName );
}
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
@@ -37,54 +37,54 @@ $Id$
#include <resource.h>
class QTimer;
class FormatPlugin;
namespace KABC {
//US class FormatPlugin;
class ResourceConfigWidget;
/**
@internal
*/
class ResourceFile : public Resource
{
Q_OBJECT
public:
/**
Constructor.
@param cfg The config object where custom resource settings are stored.
*/
- ResourceFile( const KConfig *cfg, bool syncable );
+ ResourceFile( const KConfig *cfg );
/**
Construct file resource on file @arg fileName using format @arg formatName.
*/
- ResourceFile( const QString &fileName, bool syncable , const QString &formatName = "vcard" );
+ ResourceFile( const QString &fileName , const QString &formatName = "vcard" );
/**
* Destructor.
*/
~ResourceFile();
/**
Writes the config back.
*/
virtual void writeConfig( KConfig *cfg );
/**
* Tries to open the file and checks for the proper format.
* This method should be called before @ref load().
*/
virtual bool doOpen();
/**
* Closes the file again.
*/
virtual void doClose();
/**
* Requests a save ticket, that is used by @ref save()
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
@@ -15,66 +15,65 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kdebug.h>
#include <kglobal.h>
#include <klineedit.h>
#include <klocale.h>
#include <kconfig.h>
#include <kstringhandler.h>
#include <stdlib.h>
#include "resourceldap.h"
#include "resourceldapconfig.h"
-#include "syncprefwidget.h"
using namespace KABC;
extern "C"
{
//US void *init_kabc_ldap()
void *init_microkabc_ldap()
{
- return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig, SyncPrefWidgetContainer>();
+ return new KRES::PluginFactory<ResourceLDAP,ResourceLDAPConfig>();
}
}
void addModOp( LDAPMod ***pmods, const QString &attr, const QString &value );
-ResourceLDAP::ResourceLDAP( const KConfig *config, bool syncable )
- : Resource( config, syncable ), mPort( 389 ), mLdap( 0 )
+ResourceLDAP::ResourceLDAP( const KConfig *config )
+ : Resource( config ), mPort( 389 ), mLdap( 0 )
{
KConfig *cfg = (KConfig *)config;
if ( cfg ) {
mUser = cfg->readEntry( "LdapUser" );
mPassword = KStringHandler::obscure( cfg->readEntry( "LdapPassword" ) );
mDn = cfg->readEntry( "LdapDn" );
mHost = cfg->readEntry( "LdapHost" );
mPort = cfg->readNumEntry( "LdapPort", 389 );
mFilter = cfg->readEntry( "LdapFilter" );
mAnonymous = cfg->readBoolEntry( "LdapAnonymous" );
QStringList attributes = cfg->readListEntry( "LdapAttributes" );
for ( uint pos = 0; pos < attributes.count(); pos += 2 )
mAttributes.insert( attributes[ pos ], attributes[ pos + 1 ] );
}
/**
If you want to add new attributes, append them here, add a
translation string in the ctor of AttributesDialog and
handle them in the load() method below.
These are the default values from
*/
if ( mAttributes.count() == 0 ) {
mAttributes.insert( "commonName", "cn" );
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
@@ -22,49 +22,49 @@
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_RESOURCELDAP_H
#define KABC_RESOURCELDAP_H
#include <lber.h>
#include <ldap.h>
#include "addressbook.h"
#include "resource.h"
class KConfig;
namespace KABC {
class ResourceLDAP : public Resource
{
public:
- ResourceLDAP( const KConfig*, bool syncable );
+ ResourceLDAP( const KConfig* );
virtual void writeConfig( KConfig* );
virtual bool doOpen();
virtual void doClose();
virtual Ticket *requestSaveTicket();
virtual bool load();
virtual bool save( Ticket * );
virtual void removeAddressee( const Addressee& addr );
void setUser( const QString &user );
QString user() const;
void setPassword( const QString &password );
QString password() const;
void setDn( const QString &dn );
QString dn() const;
void setHost( const QString &host );
QString host() const;
diff --git a/kabc/plugins/opie/resourceopie.cpp b/kabc/plugins/opie/resourceopie.cpp
index 22237dc..f610b38 100644
--- a/kabc/plugins/opie/resourceopie.cpp
+++ b/kabc/plugins/opie/resourceopie.cpp
@@ -29,79 +29,78 @@ $Id$
#include <sys/stat.h>
#include <unistd.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
//US #include "formatfactory.h"
//US #include <qpe/qpeapplication.h>
#include <opie/ocontactaccess.h>
#include <opie/ocontactaccessbackend_xml.h>
#include "resourceopieconfig.h"
#include "stdaddressbook.h"
-#include "syncprefwidget.h"
#include "opieconverter.h"
#include "resourceopie.h"
using namespace KABC;
extern "C"
{
void *init_microkabc_opie()
{
- return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig, SyncPrefWidgetContainer>();
+ return new KRES::PluginFactory<ResourceOpie,ResourceOpieConfig>();
}
}
-ResourceOpie::ResourceOpie( const KConfig *config, bool syncable )
- : Resource( config, syncable ), mAccess(0), mConverter (0)
+ResourceOpie::ResourceOpie( const KConfig *config )
+ : Resource( config ), mAccess(0), mConverter (0)
{
QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
KConfig *cfg = (KConfig *)config;
if ( cfg ) {
fileName = cfg->readEntry( "FileName", fileName );
}
init( fileName );
}
-ResourceOpie::ResourceOpie( const QString &fileName, bool syncable )
- : Resource( 0, syncable )
+ResourceOpie::ResourceOpie( const QString &fileName )
+ : Resource( 0 )
{
init( fileName );
}
void ResourceOpie::init( const QString &fileName )
{
qDebug("ResourceOpie::init()");
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 );
}
ResourceOpie::~ResourceOpie()
{
if (mConverter != 0)
delete mConverter;
if(mAccess != 0)
delete mAccess;
}
diff --git a/kabc/plugins/opie/resourceopie.h b/kabc/plugins/opie/resourceopie.h
index d5b4ebd..9d05c70 100644
--- a/kabc/plugins/opie/resourceopie.h
+++ b/kabc/plugins/opie/resourceopie.h
@@ -36,54 +36,54 @@ $Id$
#include "resource.h"
class OContactAccess;
namespace KABC {
class ResourceConfigWidget;
class OpieConverter;
/**
@internal
*/
class ResourceOpie : public Resource
{
Q_OBJECT
public:
/**
Constructor.
@param cfg The config object where custom resource settings are stored.
*/
- ResourceOpie( const KConfig *cfg, bool syncable );
+ ResourceOpie( const KConfig *cfg );
/**
Construct file resource on file @arg fileName using format @arg formatName.
*/
- ResourceOpie( const QString &fileName, bool syncable );
+ ResourceOpie( const QString &fileName );
/**
* Destructor.
*/
~ResourceOpie();
/**
Writes the config back.
*/
virtual void writeConfig( KConfig *cfg );
/**
* Tries to open the file and checks for the proper format.
* This method should be called before @ref load().
*/
virtual bool doOpen();
/**
* Closes the file again.
*/
virtual void doClose();
/**
* Requests a save ticket, that is used by @ref save()
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
@@ -28,71 +28,70 @@ $Id$
#include <sys/stat.h>
#include <unistd.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
//US #include <qtimer.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <qpe/pim/addressbookaccess.h>
#include "resourceqtopiaconfig.h"
#include "stdaddressbook.h"
#include "qtopiaconverter.h"
-#include "syncprefwidget.h"
#include "resourceqtopia.h"
using namespace KABC;
extern "C"
{
void *init_microkabc_qtopia()
{
- return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig, SyncPrefWidgetContainer>();
+ return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>();
}
}
-ResourceQtopia::ResourceQtopia( const KConfig *config, bool syncable )
- : Resource( config, syncable ), mConverter (0)
+ResourceQtopia::ResourceQtopia( const KConfig *config )
+ : Resource( config ), mConverter (0)
{
// we can not choose the filename. Therefore use the default to display
QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml";
init( fileName );
}
-ResourceQtopia::ResourceQtopia( const QString &fileName, bool syncable )
- : Resource( 0, syncable )
+ResourceQtopia::ResourceQtopia( const QString &fileName )
+ : Resource( 0 )
{
init( fileName );
}
void ResourceQtopia::init( const QString &fileName )
{
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 );
}
ResourceQtopia::~ResourceQtopia()
{
if (mConverter != 0)
delete mConverter;
if(mAccess != 0)
delete mAccess;
}
void ResourceQtopia::writeConfig( KConfig *config )
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
@@ -37,54 +37,54 @@ $Id$
#include "resource.h"
class AddressBookAccess;
namespace KABC {
//US class FormatPlugin;
class ResourceConfigWidget;
class QtopiaConverter;
/**
@internal
*/
class ResourceQtopia : public Resource
{
Q_OBJECT
public:
/**
Constructor.
@param cfg The config object where custom resource settings are stored.
*/
- ResourceQtopia( const KConfig *cfg, bool syncable );
+ ResourceQtopia( const KConfig *cfg );
/**
Construct file resource on file @arg fileName using format @arg formatName.
*/
- ResourceQtopia( const QString &fileName, bool syncable );
+ ResourceQtopia( const QString &fileName );
/**
* Destructor.
*/
~ResourceQtopia();
/**
Writes the config back.
*/
virtual void writeConfig( KConfig *cfg );
/**
* Tries to open the file and checks for the proper format.
* This method should be called before @ref load().
*/
virtual bool doOpen();
/**
* Closes the file again.
*/
virtual void doClose();
/**
* Requests a save ticket, that is used by @ref save()
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
@@ -29,65 +29,63 @@ $Id$
#include <sys/stat.h>
#include <unistd.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qregexp.h>
//US #include <qtimer.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <sl/slzdb.h>
#include <libkdepim/ksyncprofile.h>
#include "resourcesharpdtmconfig.h"
#include "resourcesharpdtm.h"
-#include "syncprefwidget.h"
-
#include "stdaddressbook.h"
#include "sharpdtmconverter.h"
//#define ALLOW_LOCKING
using namespace KABC;
extern "C"
{
void *init_microkabc_sharpdtm()
{
- return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig,SyncPrefWidgetContainer>();
+ return new KRES::PluginFactory<ResourceSharpDTM,ResourceSharpDTMConfig>();
}
}
-ResourceSharpDTM::ResourceSharpDTM( const KConfig *config, bool syncable )
- : Resource( config, syncable ), mConverter (0)
+ResourceSharpDTM::ResourceSharpDTM( const KConfig *config )
+ : Resource( config ), mConverter (0)
{
// we can not choose the filename. Therefore use the default to display
QString fileName = SlZDataBase::addressbookFileName();
init( fileName );
}
ResourceSharpDTM::ResourceSharpDTM( const QString &fileName, bool syncable )
: Resource( 0, syncable )
{
init( fileName );
}
void ResourceSharpDTM::init( const QString &fileName )
{
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 );
}
ResourceSharpDTM::~ResourceSharpDTM()
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
@@ -37,54 +37,54 @@ $Id$
#include "resource.h"
class SlZDataBase;
namespace KABC {
class ResourceConfigWidget;
class SharpDTMConverter;
/**
@internal
*/
class ResourceSharpDTM : public Resource
{
Q_OBJECT
public:
/**
Constructor.
@param cfg The config object where custom resource settings are stored.
*/
- ResourceSharpDTM( const KConfig *cfg, bool syncable );
+ ResourceSharpDTM( const KConfig *cfg );
/**
Construct file resource on file @arg fileName using format @arg formatName.
*/
- ResourceSharpDTM( const QString &fileName, bool syncable );
+ ResourceSharpDTM( const QString &fileName );
/**
* Destructor.
*/
~ResourceSharpDTM();
/**
Writes the config back.
*/
virtual void writeConfig( KConfig *cfg );
/**
* Tries to open the file and checks for the proper format.
* This method should be called before @ref load().
*/
virtual bool doOpen();
/**
* Closes the file again.
*/
virtual void doClose();
/**
* Requests a save ticket, that is used by @ref save()
diff --git a/kabc/resource.cpp b/kabc/resource.cpp
index 7b91239..267cdaf 100644
--- a/kabc/resource.cpp
+++ b/kabc/resource.cpp
@@ -6,77 +6,64 @@
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kdebug.h>
-#include <ksyncprofile.h>
-
#include "resource.h"
using namespace KABC;
-Resource::Resource( const KConfig *config, bool syncable )
- : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 )
+Resource::Resource( const KConfig *config )
+ : KRES::Resource( config ), mAddressBook( 0 )
{
- if(syncable == true) {
- mSyncProfile = new KSyncProfile( );
- mSyncProfile->setName("pending" /*resourceName()*/);
- mSyncProfile->readConfig( (KConfig *)config );
- }
}
Resource::~Resource()
{
- if (mSyncProfile != 0) {
- delete mSyncProfile;
- }
}
void Resource::writeConfig( KConfig *config )
{
KRES::Resource::writeConfig( config );
-
- if(mSyncProfile != 0)
- mSyncProfile->writeConfig( config );
}
void Resource::setAddressBook( AddressBook *ab )
{
mAddressBook = ab;
}
AddressBook *Resource::addressBook()
{
return mAddressBook;
}
bool Resource::doOpen()
{
return true;
}
void Resource::doClose()
{
}
Ticket *Resource::requestSaveTicket()
{
@@ -87,58 +74,43 @@ bool Resource::load()
{
return true;
}
bool Resource::save( Ticket * )
{
return false;
}
Ticket *Resource::createTicket( Resource *resource )
{
return new Ticket( resource );
}
void Resource::removeAddressee( const Addressee& )
{
// do nothing
}
void Resource::cleanUp()
{
// do nothing
}
-bool Resource::isSyncable() const
-{
- return (mSyncProfile != 0);
-}
-
-KSyncProfile* Resource::getSyncProfile()
-{
- return mSyncProfile;
-}
-
-
QString Resource::fileName() const
{
return mFileName;
}
void Resource::setFileName( const QString &fileName )
{
mFileName = fileName;
}
/**
* Set the name of resource.You can override this method,
* but also remember to call Resource::setResourceName().
*/
void Resource::setResourceName( const QString &name )
{
KRES::Resource::setResourceName(name);
- if(mSyncProfile != 0) {
- mSyncProfile->setName( name );
- }
-
}
diff --git a/kabc/resource.h b/kabc/resource.h
index 2024d2d..e5f0d5d 100644
--- a/kabc/resource.h
+++ b/kabc/resource.h
@@ -12,86 +12,78 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_RESOURCE_H
#define KABC_RESOURCE_H
#include <kresources/resource.h>
#include "addressbook.h"
-class KSyncProfile;
-
namespace KABC {
/**
* @short Helper class for handling coordinated save of address books.
*
* This class is used as helper class for saving address book.
* @see requestSaveTicket(), save().
*/
class Ticket
{
friend class Resource;
public:
Resource *resource() { return mResource; }
private:
Ticket( Resource *resource ) : mResource( resource ) {}
Resource *mResource;
};
/**
* @internal
*/
class Resource : public KRES::Resource
{
-private:
- /**
- * make this constructor private to force everybody to use the other one
- */
- Resource( const KConfig *config);
-
public:
/**
* Constructor
*/
- Resource( const KConfig *config, bool syncable );
+ Resource( const KConfig *config );
/**
* Destructor.
*/
virtual ~Resource();
/**
* Sets the address book of the resource.
*/
void setAddressBook( AddressBook* );
/**
* Returns a pointer to the addressbook.
*/
AddressBook *addressBook();
/**
* Writes the resource specific config to file.
*/
virtual void writeConfig( KConfig *config );
/**
* Open the resource and returns if it was successfully
*/
@@ -118,54 +110,48 @@ public:
/**
* Removes a addressee from resource. This method is mainly
* used by record-based resources like LDAP or SQL.
*/
virtual void removeAddressee( const Addressee& addr );
/**
* This method is called by an error handler if the application
* crashed
*/
virtual void cleanUp();
/**
* Set name of file to be used for saving.
*/
virtual void setFileName( const QString & );
/**
* Return name of file used for loading and saving the address book.
*/
virtual QString fileName() const;
-
- virtual bool isSyncable() const;
-
- virtual KSyncProfile* getSyncProfile();
-
/**
* Set the name of resource.You can override this method,
* but also remember to call Resource::setResourceName().
*/
virtual void setResourceName( const QString &name );
protected:
Ticket *createTicket( Resource * );
virtual void doClose();
private:
AddressBook *mAddressBook;
- KSyncProfile *mSyncProfile;
QString mFileName;
};
}
#endif
diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp
index 4351753..67e8406 100644
--- a/kaddressbook/xxportobject.cpp
+++ b/kaddressbook/xxportobject.cpp
@@ -155,49 +155,49 @@ void XXPortObject::slotImportActivated( const QString &data )
*******************************************************************/
XXPortResourceObject::XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent,
const char *name )
: XXPortObject( ab, parent, name ), mFactory(0)
{
mFactory = KRES::Factory::self( "tmpcontact" );
}
XXPortResourceObject::~XXPortResourceObject()
{
//do not delete the factory. It is a singleton, and selfcontained
}
bool XXPortResourceObject::isAvailable()
{
return (mFactory != 0);
}
bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, const QString& identifier, const QString& fileName )
{
//create new resource
- KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0, false ));
+ KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0 ));
if (mResource == 0)
return false;
if (fileName != QString::null)
mResource->setFileName( fileName );
KABC::TmpAddressBook tmpAB;
bool res = tmpAB.addResource( mResource );
if (res == false)
{
delete mResource;
return false;
}
res = tmpAB.load();
if (res == false)
{
//removeResource deletes also the resource object, if the linkcount is 0
tmpAB.removeResource( mResource );
return false;
}
@@ -215,49 +215,49 @@ bool XXPortResourceObject::_exportContacts( const KABC::AddresseeList &list, con
KABC::Addressee::List::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
tmpAB.insertAddressee(*it);
}
KABC::Ticket * ticket = tmpAB.requestSaveTicket(mResource);
res = false;
if (ticket != 0)
res = tmpAB.save( ticket );
//removeResource deletes also the resource object, if the linkcount is 0
tmpAB.removeResource( mResource );
return res;
}
KABC::AddresseeList XXPortResourceObject::_importContacts( const QString& identifier, const QString& fileName ) const
{
- KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0, false ));
+ KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0 ));
if (mResource == 0)
return KABC::AddresseeList();
KABC::AddresseeList adrlst;
if (fileName != QString::null)
mResource->setFileName( fileName );
KABC::TmpAddressBook tmpAB;
bool res = tmpAB.addResource( mResource );
if (res == false)
{
delete mResource;
return KABC::AddresseeList();
}
res = tmpAB.load();
adrlst = tmpAB.allAddressees();
//remove resource deletes also the Resourceobject, if the linkcount is 0
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp
index 030b547..24e82bc 100644
--- a/microkde/kresources/configdialog.cpp
+++ b/microkde/kresources/configdialog.cpp
@@ -20,227 +20,160 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qvbox.h>
#include <qcheckbox.h>
#include <qscrollview.h>
#include <kbuttonbox.h>
#include <kdialog.h>
#include <klineedit.h>
#include "factory.h"
#include "configwidget.h"
#include "configdialog.h"
-#include "syncwidget.h"
using namespace KRES;
ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
Resource* resource, const char *name )
- : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ),
- Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget_Settings(0), mSyncWidget_Conflicts(0),mSyncWidget_Remote(0), mResource( resource ), mPersistentReadOnly(false)
+ : KDialogBase( parent, name, true, i18n( "Resource Configuration" ),
+ Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false)
{
Factory *factory = Factory::self( resourceFamily );
//US resize( 250, 240 );
resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240));
QFrame *main;
- if (!mResource->isSyncable())
- main = plainPage();
- else
- main = addPage("Profile");
+ main = plainPage();
QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() );
QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
generalGroupBox->layout()->setSpacing( spacingHint() );
generalGroupBox->setTitle( i18n( "General Settings" ) );
- new QLabel( mResource->isSyncable()?i18n( "Profile Name:" ):i18n( "Name:" ), generalGroupBox );
+ new QLabel( i18n( "Name:" ), generalGroupBox );
mName = new KLineEdit( generalGroupBox );
- if (!mResource->isSyncable()) {
- new QLabel("", generalGroupBox );
- mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox );
- mReadOnly->setChecked( mResource->readOnly() );
- new QLabel("", generalGroupBox );
- mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox );
- mIncludeInSync->setChecked( mResource->includeInSync() );
- }
+ new QLabel("", generalGroupBox );
+ mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox );
+ mReadOnly->setChecked( mResource->readOnly() );
+
+ new QLabel("", generalGroupBox );
+ mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox );
+ mIncludeInSync->setChecked( mResource->includeInSync() );
mName->setText( mResource->resourceName() );
mainLayout->addWidget( generalGroupBox );
QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
resourceGroupBox->layout()->setSpacing( spacingHint());
resourceGroupBox->setTitle( i18n( "%1 Resource Settings" )
.arg( factory->typeName( resource->type() ) ) );
mainLayout->addWidget( resourceGroupBox );
mainLayout->addStretch();
mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox );
if ( mConfigWidget ) {
connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ),
SLOT( setReadOnly( bool ) ) );
+ connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ),
+ SLOT( setIncludeInSync( bool ) ) );
connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ),
SLOT( setPersistentReadOnly( bool ) ) );
mConfigWidget->setInEditMode( false );
mConfigWidget->loadSettings( mResource );
mConfigWidget->show();
}
- if (mResource->isSyncable())
- {
- SyncWidgetContainer* c = factory->syncWidgetContainer( resource->type() );
-
- QFrame* syncPage = addPage("Settings");
- QVBoxLayout *syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
- mSyncWidget_Settings = c->generateSettingsTab(syncPage);
- syncLayout->addWidget( mSyncWidget_Settings );
-
- syncPage = addPage("Conflicts");
- syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
- mSyncWidget_Conflicts = c->generateConflictsTab(syncPage);
- syncLayout->addWidget( mSyncWidget_Conflicts );
-
- syncPage = addPage("Remote");
- syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() );
- mSyncWidget_Remote = c->generateRemoteTab(syncPage);
- syncLayout->addWidget( mSyncWidget_Remote );
-
-
- mSyncWidget_Settings->setInEditMode( false );
- mSyncWidget_Settings->loadSettings( mResource );
- mSyncWidget_Settings->show();
-
- mSyncWidget_Conflicts->setInEditMode( false );
- mSyncWidget_Conflicts->loadSettings( mResource );
- mSyncWidget_Conflicts->show();
-
- mSyncWidget_Remote->setInEditMode( false );
- mSyncWidget_Remote->loadSettings( mResource );
- mSyncWidget_Remote->show();
-
- delete c;
-
-// QGroupBox *syncGroupBox = new QGroupBox( 2, Qt::Horizontal, syncPage );
-// syncGroupBox->layout()->setSpacing( spacingHint());
-// syncGroupBox->setTitle( i18n( "Syncronize Preferences" ) );
-// syncLayout->addWidget( syncGroupBox );
-
-// syncLayout->addStretch();
-/*US
- mSyncWidget = factory->syncWidget( resource->type(), syncPage );
- syncLayout->addWidget( mSyncWidget );
- if ( mSyncWidget ) {
- mSyncWidget->setInEditMode( false );
- mSyncWidget->loadSettings( mResource );
- mSyncWidget->show();
- }
- */
- }
-
-
-
connect( mName, SIGNAL( textChanged(const QString &)),
SLOT( slotNameChanged(const QString &)));
slotNameChanged( mName->text() );
//US setMinimumSize( 400, 250 );
setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 400), KMIN(KGlobal::getDesktopHeight(), 250));
}
void ConfigDialog::setInEditMode( bool value )
{
if ( mConfigWidget )
mConfigWidget->setInEditMode( value );
-
- if ( mSyncWidget_Settings )
- mSyncWidget_Settings->setInEditMode( value );
- if ( mSyncWidget_Conflicts )
- mSyncWidget_Conflicts->setInEditMode( value );
- if ( mSyncWidget_Remote )
- mSyncWidget_Remote->setInEditMode( value );
-
}
void ConfigDialog::slotNameChanged( const QString &text)
{
enableButtonOK( !text.isEmpty() );
}
void ConfigDialog::setReadOnly( bool value )
{
- if (!mResource->isSyncable()) {
-
if (mPersistentReadOnly == false)
mReadOnly->setChecked( value );
else
mReadOnly->setChecked( true );
- }
}
-void ConfigDialog::setPersistentReadOnly( bool value )
+void ConfigDialog::setIncludeInSync( bool value )
{
- if (!mResource->isSyncable()) {
+ if (mPersistentReadOnly == false)
+ mIncludeInSync->setChecked( value );
+ else
+ mIncludeInSync->setChecked( true );
+}
+void ConfigDialog::setPersistentReadOnly( bool value )
+{
mPersistentReadOnly = value;
- if (value == true)
+ if (value == true) {
setReadOnly( true );
+ setIncludeInSync( true );
+ }
mReadOnly->setEnabled( !value );
- }
+ mIncludeInSync->setEnabled (!value );
}
+
void ConfigDialog::accept()
{
if ( mName->text().isEmpty() ) {
- KMessageBox::sorry( this, mResource->isSyncable()?i18n( "Please enter a profile name" ):i18n( "Please enter a resource name" ) );
+ KMessageBox::sorry( this, i18n( "Please enter a resource name" ) );
return;
}
mResource->setResourceName( mName->text() );
- if (!mResource->isSyncable())
- mResource->setReadOnly( mReadOnly->isChecked() );
- mResource->setIncludeInSync( mIncludeInSync->isChecked() );
+ mResource->setReadOnly( mReadOnly->isChecked() );
+ mResource->setIncludeInSync( mIncludeInSync->isChecked() );
if ( mConfigWidget ) {
// First save generic information
// Also save setting of specific resource type
mConfigWidget->saveSettings( mResource );
}
- if ( mSyncWidget_Settings )
- mSyncWidget_Settings->saveSettings( mResource );
- if ( mSyncWidget_Conflicts )
- mSyncWidget_Conflicts->saveSettings( mResource );
- if ( mSyncWidget_Remote )
- mSyncWidget_Remote->saveSettings( mResource );
-
-
KDialog::accept();
}
//US #include "configdialog.moc"
diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h
index ed3ecab..b205975 100644
--- a/microkde/kresources/configdialog.h
+++ b/microkde/kresources/configdialog.h
@@ -10,59 +10,56 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_CONFIGDIALOG_H
#define KRESOURCES_CONFIGDIALOG_H
#include <kdialogbase.h>
class KLineEdit;
class QCheckBox;
class KButtonBox;
namespace KRES {
class Resource;
class ConfigWidget;
- class SyncWidget;
class ConfigDialog : public KDialogBase
{
Q_OBJECT
public:
// Resource=0: create new resource
ConfigDialog( QWidget *parent, const QString& resourceFamily,
Resource* resource, const char *name = 0);
void setInEditMode( bool value );
protected slots:
void accept();
void setReadOnly( bool value );
+ void setIncludeInSync( bool value );
void setPersistentReadOnly( bool value );
void slotNameChanged( const QString &text);
private:
ConfigWidget *mConfigWidget;
- SyncWidget *mSyncWidget_Settings;
- SyncWidget *mSyncWidget_Conflicts;
- SyncWidget *mSyncWidget_Remote;
Resource* mResource;
KLineEdit *mName;
QCheckBox *mReadOnly;
QCheckBox *mIncludeInSync;
//US add a persistent readonly flag. We need that for opie and qtopia addressbooks.
bool mPersistentReadOnly;
};
}
#endif
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp
index 02c5fb1..533be51 100644
--- a/microkde/kresources/configpage.cpp
+++ b/microkde/kresources/configpage.cpp
@@ -36,51 +36,48 @@ $Id$
#include <kapplication.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#include <klistview.h>
#include <kbuttonbox.h>
//US #include <ktrader.h>
#include "resource.h"
#include "configdialog.h"
#include "configpage.h"
//US
#include <qpushbutton.h>
#include <qfile.h>
#include <kglobal.h>
using namespace KRES;
-const QString ConfigPage::syncfamily = "syncprofiles";
-
-
class ConfigViewItem : public QCheckListItem
{
public:
ConfigViewItem( QListView *parent, Resource* resource ) :
QCheckListItem( parent, resource->resourceName(), CheckBox ),
mResource( resource ),
mIsStandard( false )
{
setText( 1, mResource->type() );
setOn( mResource->isActive() );
}
void setStandard( bool value )
{
setText( 2, ( value ? i18n( "Yes" ) : QString::null ) );
mIsStandard = value;
}
bool standard() const { return mIsStandard; }
bool readOnly() const { return mResource->readOnly(); }
Resource *resource() { return mResource; }
private:
@@ -163,71 +160,69 @@ ConfigPage::~ConfigPage()
(*it).mManager->removeListener( this );
delete (*it).mManager;
delete (*it).mConfig;
}
mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() );
delete mConfig;
mConfig = 0;
}
void ConfigPage::load()
{
kdDebug(5650) << "ConfigPage::load()" << endl;
mListView->clear();
//US we remove the dynamic pluginloader, and set the one family we need (contact) manually.
//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" );
//US KTrader::OfferList::ConstIterator it;
//US for ( it = plugins.begin(); it != plugins.end(); ++it ) {
//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
//US QString family = tmp.toString();
QStringList families;
- families << "contact" << syncfamily;
+ families << "contact";
for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
{
QString family = (*it);
if ( !family.isEmpty() ) {
if ( !mFamilyMap.contains( family ) ) {
- mCurrentManager = new Manager<Resource>( family, (family == syncfamily) );
+ mCurrentManager = new Manager<Resource>( family );
if ( mCurrentManager ) {
mFamilyMap.append( family );
mCurrentManager->addListener( this );
ResourcePageInfo info;
info.mManager = mCurrentManager;
QString configDir = KGlobal::dirs()->saveLocation( "config" );
//QString configDir = KStandardDirs::appDir() + "/config";
if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) );
} else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) );
- } else if ( family == syncfamily && QFile::exists( configDir + "/kabcsyncrc" ) ) {
- info.mConfig = new KConfig( locateLocal( "config", "kabcsyncrc" ) );
} else {
QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) );
info.mConfig = new KConfig( configFile );
}
info.mManager->readConfig( info.mConfig );
mInfoMap.append( info );
}
}
}
}
mCurrentManager = 0;
mFamilyCombo->insertStringList( mFamilyMap );
int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 );
mFamilyCombo->setCurrentItem( currentFamily );
slotFamilyChanged( currentFamily );
}
void ConfigPage::save()
{
saveResourceSettings();
@@ -289,82 +284,66 @@ void ConfigPage::slotFamilyChanged( int pos )
//US qDebug("ConfigPage::slotFamilyChanged 4.6 ");
if ( !standardResource ) {
KMessageBox::sorry( this, i18n( "There is no standard resource!<br> Please select one." ) );
//US qDebug("ConfigPage::slotFamilyChanged 4.7" );
}
emit changed( false );
}
}
void ConfigPage::slotAdd()
{
if ( !mCurrentManager )
return;
QStringList types = mCurrentManager->resourceTypeNames();
QStringList descs = mCurrentManager->resourceTypeDescriptions();
bool ok = false;
QString desc;
- if (mFamily == syncfamily)
- {
- desc = QInputDialog::getItem( i18n( "Sync Configuration" ),
- i18n( "Select resource type for the new sync profile:" ), descs, 0,
- false, &ok, this );
- }
- else
- {
- desc = QInputDialog::getItem( i18n( "Resource Configuration" ),
+ desc = QInputDialog::getItem( i18n( "Resource Configuration" ),
i18n( "Select type of the new resource:" ), descs, 0,
false, &ok, this );
- }
if ( !ok )
return;
QString type = types[ descs.findIndex( desc ) ];
// Create new resource
Resource *resource = mCurrentManager->createResource( type );
if ( !resource ) {
KMessageBox::error( this, i18n("Unable to create resource of type '%1'.")
.arg( type ) );
return;
}
- if (mFamily == syncfamily)
- {
- resource->setResourceName( type + "-syncprofile" );
- }
- else
- {
- resource->setResourceName( type + "-resource" );
- }
+ resource->setResourceName( type + "-resource" );
ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" );
if ( dlg.exec() ) {
mCurrentManager->add( resource );
ConfigViewItem *item = new ConfigViewItem( mListView, resource );
mLastItem = item;
// if there are only read-only resources we'll set this resource
// as standard resource
if ( !resource->readOnly() ) {
bool onlyReadOnly = true;
QListViewItem *it = mListView->firstChild();
while ( it != 0 ) {
ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it );
if ( !confIt->readOnly() && confIt != item )
onlyReadOnly = false;
it = it->itemBelow();
}
if ( onlyReadOnly )
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index e44fce3..4e4456d 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -166,124 +166,90 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent )
if ( !factory ) {
qDebug("KRES::Factory::configWidget(): Factory creation failed for library %s", pi->library.latin1());
kdDebug() << "KRES::Factory::configWidget(): Factory creation failed" << endl;
return 0;
}
PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
if ( !pluginFactory ) {
qDebug("KRES::Factory::configWidget(): no plugin factory for library %s", pi->library.latin1());
kdDebug() << "KRES::Factory::configWidget(): no plugin factory." << endl;
return 0;
}
ConfigWidget *wdg = pluginFactory->configWidget( parent );
if ( !wdg ) {
//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
return 0;
}
return wdg;
}
-SyncWidgetContainer *Factory::syncWidgetContainer( const QString& type )
-{
- if ( type.isEmpty() || !mTypeMap.contains( type ) )
- return 0;
-
-//US KService::Ptr ptr = mTypeMap[ type ];
-//US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
- PluginInfo* pi = mTypeMap[ type ];
- KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
- if ( !factory ) {
- qDebug("KRES::Factory::syncWidget(): Factory creation failed for library %s", pi->library.latin1());
- kdDebug() << "KRES::Factory::syncWidget(): Factory creation failed" << endl;
- return 0;
- }
-
- PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
-
- if ( !pluginFactory ) {
- qDebug("KRES::Factory::syncWidget(): no plugin factory for library %s", pi->library.latin1());
- kdDebug() << "KRES::Factory::syncWidget(): no plugin factory." << endl;
- return 0;
- }
-
- SyncWidgetContainer *wdg = pluginFactory->syncWidgetContainer( );
- if ( !wdg ) {
-//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
- qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
- return 0;
- }
- return wdg;
-
-}
-
-
QString Factory::typeName( const QString &type ) const
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
return QString();
//US KService::Ptr ptr = mTypeMap[ type ];
//US return ptr->name();
PluginInfo* pi = mTypeMap[ type ];
return pi->nameLabel;
}
QString Factory::typeDescription( const QString &type ) const
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
return QString();
//US KService::Ptr ptr = mTypeMap[ type ];
//US return ptr->comment();
PluginInfo* pi = mTypeMap[ type ];
return pi->descriptionLabel;
}
-Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable )
+Resource *Factory::resource( const QString& type, const KConfig *config )
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
return 0;
/*US load the lib not dynamicly. !!
KService::Ptr ptr = mTypeMap[ type ];
KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
if ( !factory ) {
kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl;
return 0;
}
*/
PluginInfo* pi = mTypeMap[ type ];
KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
if ( !factory ) {
qDebug("KRES::Factory::resource(): Factory creation failed for library %s", pi->library.latin1());
kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl;
return 0;
}
PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
if ( !pluginFactory ) {
qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1());
kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl;
return 0;
}
- Resource *resource = pluginFactory->resource( config, syncable );
+ Resource *resource = pluginFactory->resource( config );
if ( !resource ) {
//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
return 0;
}
resource->setType( type );
return resource;
}
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
index 0e4231b..ea01b23 100644
--- a/microkde/kresources/factory.h
+++ b/microkde/kresources/factory.h
@@ -13,49 +13,48 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_FACTORY_H
#define KRESOURCES_FACTORY_H
#include <qdict.h>
#include <qstring.h>
#include <kconfig.h>
#include "resource.h"
namespace KRES {
-class SyncWidgetContainer;
class ConfigWidget;
//US
struct PluginInfo
{
QString library;
QString nameLabel;
QString descriptionLabel;
};
/**
* Class for loading resource plugins.
* Do not use this class directly. Use ResourceManager instead
*
* Example:
*
* <pre>
* KABC::Factory<Calendar> *factory = KABC::Factory<Calendar>::self();
*
* QStringList list = factory->resources();
* QStringList::Iterator it;
* for ( it = list.begin(); it != list.end(); ++it ) {
* Resource<Calendar> *resource = factory->resource( (*it),
@@ -66,68 +65,56 @@ struct PluginInfo
*/
class Factory
{
public:
/**
* Returns the global resource factory.
*/
static Factory *self( const QString& resourceFamily );
~Factory();
/**
* Returns the config widget for the given resource type,
* or a null pointer if resource type doesn't exist.
*
* @param type The type of the resource, returned by @ref resources()
* @param resource The resource to be editted.
* @param parent The parent widget
*/
ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 );
/**
- * Returns the sync widget for the given resource type,
- * or a null pointer if resource type doesn't exist,
- * or a null pointer if resource does not support syncing.
- *
- * @param type The type of the resource, returned by @ref resources()
- * @param resource The resource to be editted.
- * @param parent The parent widget
- */
- SyncWidgetContainer *syncWidgetContainer( const QString& type );
-
- /**
* Returns a pointer to a resource object or a null pointer
* if resource type doesn't exist.
*
* @param type The type of the resource, returned by @ref resources()
* @param ab The address book, the resource should belong to
* @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
- * @param syncable If the resource should support syncing capabilities.
*/
- Resource *resource( const QString& type, const KConfig *config, bool syncable );
+ Resource *resource( const QString& type, const KConfig *config);
/**
* Returns a list of all available resource types.
*/
QStringList typeNames() const;
/**
* Returns the name for a special type.
*/
QString typeName( const QString &type ) const;
/**
* Returns the description for a special type.
*/
QString typeDescription( const QString &type ) const;
protected:
Factory( const QString& resourceFamily);
private:
static QDict<Factory> *mSelves;
QString mResourceFamily;
//US QMap<QString, KService::Ptr> mTypeMap;
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h
index 7e9e19a..0e6f838 100644
--- a/microkde/kresources/manager.h
+++ b/microkde/kresources/manager.h
@@ -146,59 +146,54 @@ class Manager : private ManagerImplListener
Resource::List *mList;
};
ActiveIterator activeBegin()
{
ActiveIterator it;
it.mIt = mImpl->resourceList()->begin();
it.mList = mImpl->resourceList();
if ( it.mIt != mImpl->resourceList()->end() ) {
if ( !(*it)->isActive() ) it++;
}
return it;
}
ActiveIterator activeEnd()
{
ActiveIterator it;
it.mIt = mImpl->resourceList()->end();
it.mList = mImpl->resourceList();
return it;
}
bool isEmpty() const { return mImpl->resourceList()->isEmpty(); }
- /**
- Return true, if the manager manages syncable resources.
- */
- bool manageSyncable() { return mImpl->manageSyncable(); }
-
- Manager( const QString &family, bool syncable )
+ Manager( const QString &family )
{
mFactory = Factory::self( family );
// The managerimpl will use the same Factory object as the manager
// because of the Factory::self() pattern
- mImpl = new ManagerImpl( family, syncable );
+ mImpl = new ManagerImpl( family );
mImpl->setListener( this );
mListeners = new QPtrList<ManagerListener<T> >;
}
virtual ~Manager()
{
mImpl->setListener( 0 );
delete mListeners;
delete mImpl;
}
/**
Recreate Resource objects from configuration file. If cfg is 0, read standard
configuration file.
*/
void readConfig( KConfig *cfg = 0 )
{
mImpl->readConfig( cfg );
}
/**
Write configuration of Resource objects to configuration file. If cfg is 0, write
to standard configuration file.
@@ -239,53 +234,52 @@ class Manager : private ManagerImplListener
/**
Returns a list of the names of the reources managed by the
Manager for this family.
*/
QStringList resourceNames() const
{
return mImpl->resourceNames();
}
ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 )
{
return mFactory->resourceConfigWidget( type, parent );
}
/**
Creates a new resource of type @param type, with default
settings. The resource is
not added to the manager, the application has to do that.
Returns a pointer to a resource object or a null pointer
if resource type doesn't exist.
@param type The type of the resource, one of those returned
by @ref resourceTypeNames()
- * @param syncable If the resource should support syncing capabilities.
*/
T *createResource( const QString& type )
{
- return (T *)( mFactory->resource( type, 0, mImpl->manageSyncable() ) );
+ return (T *)( mFactory->resource( type, 0 ) );
}
/**
Returns a list of the names of all available resource types.
*/
QStringList resourceTypeNames() const
{
return mFactory->typeNames();
}
QStringList resourceTypeDescriptions() const
{
QStringList typeDescs;
QStringList types = mFactory->typeNames();
for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) {
QString desc = mFactory->typeName( *it );
if ( !mFactory->typeDescription( *it ).isEmpty() )
desc += " (" + mFactory->typeDescription( *it ) + ")";
typeDescs.append( desc );
}
return typeDescs;
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp
index 3655f50..81bbbec 100644
--- a/microkde/kresources/managerimpl.cpp
+++ b/microkde/kresources/managerimpl.cpp
@@ -20,50 +20,50 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include "resource.h"
#include "factory.h"
#include "managerimpl.h"
using namespace KRES;
-ManagerImpl::ManagerImpl( const QString &family, bool syncable )
- : mFamily( family ), mSyncable(syncable), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ),
+ManagerImpl::ManagerImpl( const QString &family )
+ : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ),
mFactory( 0 )
{
kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl;
}
ManagerImpl::~ManagerImpl()
{
kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
delete *it;
}
delete mStdConfig;
}
void ManagerImpl::createStandardConfig()
{
if ( !mStdConfig ) {
QString file = locateLocal( "data", KGlobal::getAppName()
@@ -247,49 +247,49 @@ QPtrList<Resource> ManagerImpl::resources( bool active )
return result;
}
void ManagerImpl::setListener( ManagerImplListener *listener )
{
mListener = listener;
}
Resource* ManagerImpl::readResourceConfig( const QString& identifier,
bool checkActive )
{
kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl;
// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1());
mConfig->setGroup( "Resource_" + identifier );
#ifdef _WIN32_
// we use plugins on win32. the group is stored in a static variable
// such that gourp info not avail on win32 plugins
// to fix that, it would be a looooot of work
mConfig->setTempGroup( "Resource_" + identifier );
#endif
QString type = mConfig->readEntry( "ResourceType" );
QString name = mConfig->readEntry( "ResourceName" );
- Resource *resource = mFactory->resource( type, mConfig, mSyncable );
+ Resource *resource = mFactory->resource( type, mConfig );
if ( !resource ) {
qDebug("Failed to create resource with id %s ",identifier.latin1() );
return 0;
}
if ( resource->identifier().isEmpty() )
resource->setIdentifier( identifier );
mConfig->setGroup( "General" );
QString standardKey = mConfig->readEntry( "Standard" );
if ( standardKey == identifier ) {
mStandard = resource;
}
if ( checkActive ) {
QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" );
resource->setActive( activeKeys.contains( identifier ) );
}
mResources.append( resource );
return resource;
}
@@ -343,32 +343,25 @@ void ManagerImpl::removeResource( Resource *resource )
passiveKeys.remove( key );
mConfig->writeEntry( "PassiveResourceKeys", passiveKeys );
}
QString standardKey = mConfig->readEntry( "Standard" );
if ( standardKey == key ) {
mConfig->writeEntry( "Standard", "" );
}
mConfig->deleteGroup( "Resource_" + resource->identifier() );
mConfig->sync();
}
Resource* ManagerImpl::getResource( const QString& identifier )
{
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
if ( (*it)->identifier() == identifier )
return *it;
}
return 0;
}
-/**
- Return true, if the manager manages syncable resources.
-*/
-bool ManagerImpl::manageSyncable() const
-{
- return mSyncable;
-}
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h
index 0425279..56a2db6 100644
--- a/microkde/kresources/managerimpl.h
+++ b/microkde/kresources/managerimpl.h
@@ -44,83 +44,77 @@ class KConfig;
namespace KRES {
class Resource;
class Factory;
class ManagerImplListener
{
public:
virtual void resourceAdded( Resource *resource ) = 0;
virtual void resourceModified( Resource *resource ) = 0;
virtual void resourceDeleted( Resource *resource ) = 0;
};
/**
@internal
Do not use this class directly. Use ResourceManager instead
*/
class ManagerImpl : public QObject
{
Q_OBJECT
public:
- ManagerImpl( const QString &family, bool syncable);
+ ManagerImpl( const QString &family);
~ManagerImpl();
void readConfig( KConfig * );
void writeConfig( KConfig * );
void add( Resource *resource, bool useDCOP = true );
void remove( Resource *resource, bool useDCOP = true );
Resource *standardResource();
void setStandardResource( Resource *resource );
void setActive( Resource *resource, bool active );
Resource::List *resourceList();
QPtrList<Resource> resources();
// Get only active or passive resources
QPtrList<Resource> resources( bool active );
QStringList resourceNames();
void setListener( ManagerImplListener *listener );
- /**
- Return true, if the manager manages syncable resources.
- */
- bool manageSyncable() const;
-
public slots:
void resourceChanged( Resource *resource );
private:
// dcop calls
private:
void createStandardConfig();
Resource *readResourceConfig( const QString& identifier, bool checkActive );
void writeResourceConfig( Resource *resource, bool checkActive );
void removeResource( Resource *resource );
Resource *getResource( Resource *resource );
Resource *getResource( const QString& identifier );
QString mFamily;
- bool mSyncable;
KConfig *mConfig;
KConfig *mStdConfig;
Resource *mStandard;
Factory *mFactory;
Resource::List mResources;
ManagerImplListener *mListener;
};
}
#endif
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp
index f79bcd0..cccd485 100644
--- a/microkde/kresources/resource.cpp
+++ b/microkde/kresources/resource.cpp
@@ -177,28 +177,29 @@ void Resource::setResourceName( const QString &name )
QString Resource::resourceName() const
{
return d->mName;
}
void Resource::setActive( bool value )
{
d->mActive = value;
}
bool Resource::isActive() const
{
return d->mActive;
}
void Resource::dump() const
{
qDebug("Resource::dump() ");
kdDebug(5650) << "Resource:" << endl;
kdDebug(5650) << " Name: " << d->mName << endl;
kdDebug(5650) << " Identifier: " << d->mIdentifier << endl;
kdDebug(5650) << " Type: " << d->mType << endl;
kdDebug(5650) << " OpenCount: " << d->mOpenCount << endl;
kdDebug(5650) << " ReadOnly: " << ( d->mReadOnly ? "yes" : "no" ) << endl;
+ kdDebug(5650) << " IncludeInSync: " << ( d->mIncludeInSync ? "yes" : "no" ) << endl;
kdDebug(5650) << " Active: " << ( d->mActive ? "yes" : "no" ) << endl;
kdDebug(5650) << " IsOpen: " << ( d->mIsOpen ? "yes" : "no" ) << endl;
}
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h
index 70b5613..ed5af96 100644
--- a/microkde/kresources/resource.h
+++ b/microkde/kresources/resource.h
@@ -19,49 +19,48 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_RESOURCE_H
#define KRESOURCES_RESOURCE_H
//US
#ifdef QT_THREAD_SUPPORT
#include <qmutex.h>
#endif //QT_THREAD_SUPPORT
#include <qvaluelist.h>
#include <qwidget.h>
#include <qobject.h>
#include <klibloader.h>
class KConfig;
namespace KRES {
class ConfigWidget;
-class SyncWidgetContainer;
/**
* @internal
* @libdoc The KDE Resource library
*
* NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
* interface, it is in constant flux.
*
* The KDE Resource framework can be used to manage resources of
* different types, organized in families. The Resource framework
* is currently used for addressbook resources in libkabc and for
* calendar resources in libkcal.
*
* When you want to use the framework for a new family, you need to
* <ul><li>Define a name for your resource family</li>
* <li>subclass Resource and add the fields and method that are needed
* in your application</li>
* <li>If needed, override the doOpen() and doClose() methods.
* <li> Provide a configuration possibility for resources in your
* new family. You can use @ref ResourcesConfigPage to easily create a
* KControl applet</li>
* <li>In your application, you can use @ref ResourceManager to keep track
* of the resources in your family, and you can use @ref ResourceSelectDialog
* to let the user select a single resource.</li>
@@ -211,49 +210,49 @@ Name=Example Resource
[Plugin]
Type=exchange
X-KDE-Library=resourceexample
</pre>
* <B>Makefile.am</B>
<pre>
kde_module_LTLIBRARIES = resourceexample.la
resourceexample_la_SOURCES = resourceexample.cpp resourceexampleconfig.cpp
resourceexample_la_LDFLAGS= $(all_libraries) -module $(KDE_PLUGIN)
resourceexample_la_LIBADD= -lkderesources
linkdir= $(kde_datadir)/resources/family
link_DATA= resourceexample.desktop
</pre>
*
*
*/
/**
* A @ref Resource is a ...
*
* A subclass should reimplement at least the constructor and the
- * @ref writeConfig method.
+k * @ref writeConfig method.
*
*/
class Resource : public QObject
{
Q_OBJECT
public:
typedef QValueList<Resource *> List;
/**
* Constructor. Construct resource from config.
* @param config Configuration to read persistence information from.
* If config==0, create object using default settings.
*/
Resource( const KConfig* config );
/**
* Destructor.
*/
virtual ~Resource();
/**
* Write configuration information for this resource to a configuration
* file. If you override this method, remember to call Resource::writeConfig
@@ -302,117 +301,104 @@ class Resource : public QObject
/**
* Mark the resource as read-only. You can override this method,
* but also remember to call Resource::setReadOnly().
*/
virtual void setReadOnly( bool value );
/**
* Returns, if the resource is read-only.
*/
virtual bool readOnly() const;
void setIncludeInSync( bool value );
bool includeInSync() const;
/**
* Set the name of resource.You can override this method,
* but also remember to call Resource::setResourceName().
*/
virtual void setResourceName( const QString &name );
/**
* Returns the name of resource.
*/
virtual QString resourceName() const;
-
-
- virtual bool isSyncable() const = 0;
-
-
/**
Sets, if the resource is active.
*/
void setActive( bool active );
/**
Return true, if the resource is active.
*/
bool isActive() const;
friend class Factory;
friend class ManagerImpl;
/**
Print resource information as debug output.
*/
virtual void dump() const;
protected:
/**
* Open this resource. When called, the resource must be in
* a closed state.
*
* Returns true if the resource was opened successfully;
* returns false if the resource was not opened successfully.
*
* The result of this call can be accessed later by @ref isOpen()
*/
virtual bool doOpen() { return true; }
/**
* Close this resource. Pre-condition: resource is open.
* Post-condition: resource is closed.
*/
virtual void doClose() {}
void setIdentifier( const QString& identifier );
void setType( const QString& type );
private:
class ResourcePrivate;
ResourcePrivate *d;
};
class PluginFactoryBase : public KLibFactory
{
public:
- virtual Resource *resource( const KConfig *config, bool syncable ) = 0;
+ virtual Resource *resource( const KConfig *config) = 0;
virtual ConfigWidget *configWidget( QWidget *parent ) = 0;
- virtual SyncWidgetContainer *syncWidgetContainer() = 0;
-
protected:
virtual QObject* createObject( QObject*, const char*, const char*,
const QStringList & )
{
return 0;
}
};
-template<class TR,class TC, class TS>
+template<class TR,class TC>
class PluginFactory : public PluginFactoryBase
{
public:
- Resource *resource( const KConfig *config, bool syncable )
+ Resource *resource( const KConfig *config)
{
- return new TR( config, syncable );
+ return new TR( config );
}
ConfigWidget *configWidget( QWidget *parent )
{
return new TC( parent );
}
-
- SyncWidgetContainer *syncWidgetContainer()
- {
- return new TS();
- }
-
};
}
#endif
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro
index df914ce..071ceb3 100644
--- a/microkde/microkdeE.pro
+++ b/microkde/microkdeE.pro
@@ -68,49 +68,48 @@ osmartpointer.h \
kdeui/klistview.h \
kdeui/kjanuswidget.h \
kdeui/kseparator.h \
kdeui/kmainwindow.h \
kdeui/knuminput.h \
kdeui/knumvalidator.h \
kdeui/ksqueezedtextlabel.h \
kdeui/ktoolbar.h \
kdeui/ktoolbarbutton.h \
kdeui/ktoolbarhandler.h \
kdeui/kxmlguiclient.h \
kio/job.h \
kio/kio/kdirwatch.h \
kio/kio/kdirwatch_p.h \
kio/kfile/kurlrequester.h \
kresources/resource.h \
kresources/factory.h \
kresources/managerimpl.h \
kresources/manager.h \
kresources/selectdialog.h \
kresources/configpage.h \
kresources/configwidget.h \
kresources/configdialog.h \
kresources/kcmkresources.h \
- kresources/syncwidget.h \
kdecore/kmdcodec.h \
kdecore/kconfigbase.h \
kdecore/klocale.h \
kdecore/klibloader.h \
kdecore/kcatalogue.h \
kdecore/kprefs.h \
kdecore/ksharedptr.h \
kdecore/kshell.h \
kdecore/kstandarddirs.h \
kdecore/kstringhandler.h \
kdecore/kshortcut.h \
kutils/kcmultidialog.h \
kidmanager.h
SOURCES = \
KDGanttMinimizeSplitter.cpp \
kapplication.cpp \
kcalendarsystem.cpp \
kcalendarsystemgregorian.cpp \
kcolorbutton.cpp \
kcolordialog.cpp \
@@ -152,28 +151,27 @@ oprocess.cpp \
kdeui/kguiitem.cpp \
kdeui/kjanuswidget.cpp \
kdeui/klistbox.cpp \
kdeui/klistview.cpp \
kdeui/kmainwindow.cpp \
kdeui/knuminput.cpp \
kdeui/knumvalidator.cpp \
kdeui/kseparator.cpp \
kdeui/kstdaction.cpp \
kdeui/ksqueezedtextlabel.cpp \
kdeui/ktoolbar.cpp \
kdeui/ktoolbarbutton.cpp \
kdeui/ktoolbarhandler.cpp \
kdeui/kxmlguiclient.cpp \
kio/kfile/kurlrequester.cpp \
kio/kio/kdirwatch.cpp \
kresources/configpage.cpp \
kresources/configdialog.cpp \
kresources/configwidget.cpp \
kresources/factory.cpp \
kresources/kcmkresources.cpp \
kresources/managerimpl.cpp \
kresources/resource.cpp \
kresources/selectdialog.cpp \
- kresources/syncwidget.cpp \
kutils/kcmultidialog.cpp \
kidmanager.cpp