author | zautrix <zautrix> | 2004-09-15 10:22:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-15 10:22:55 (UTC) |
commit | d4adafe41cf399585b8e35cb600ff35706d55ae0 (patch) (side-by-side diff) | |
tree | 1becc87f6c40390fd73082996d18f71fb5e9c772 | |
parent | 8889ffd6f6958c3a1d07bafedcc8af5d786a1660 (diff) | |
download | kdepimpi-d4adafe41cf399585b8e35cb600ff35706d55ae0.zip kdepimpi-d4adafe41cf399585b8e35cb600ff35706d55ae0.tar.gz kdepimpi-d4adafe41cf399585b8e35cb600ff35706d55ae0.tar.bz2 |
fixes for desktop version
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 17 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedir.h | 3 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 20 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.h | 3 | ||||
-rw-r--r-- | microkde/kresources/configpage.cpp | 12 |
5 files changed, 34 insertions, 21 deletions
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index 7d96cb7..e58e4f7 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -53,12 +53,13 @@ $Id$ #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; @@ -110,17 +111,17 @@ ResourceDir::ResourceDir( const KConfig *config, bool syncable ) mFormat = new VCardFormatPlugin2(); else if (mFormatName == "binary") mFormat = new BinaryFormat(); else qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); */ - +#ifndef NO_DIRWATCH connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); - +#endif setPath( path ); } ResourceDir::~ResourceDir() { delete mFormat; @@ -205,15 +206,15 @@ bool ResourceDir::load() } bool ResourceDir::save( Ticket *ticket ) { AddressBook::Iterator it; bool ok = true; - +#ifndef NO_DIRWATCH mDirWatch.stopScan(); - +#endif for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { if ( (*it).resource() != this || !(*it).changed() ) continue; QFile file( mPath + "/" + (*it).uid() ); if ( !file.open( IO_WriteOnly ) ) { @@ -225,14 +226,15 @@ bool ResourceDir::save( Ticket *ticket ) // mark as unchanged (*it).setChanged( false ); file.close(); } +#ifndef NO_DIRWATCH mDirWatch.startScan(); - +#endif delete ticket; #ifdef ALLOW_LOCKING unlock( mPath ); #endif return ok; } @@ -298,20 +300,23 @@ void ResourceDir::unlock( const QString &path ) return; #endif } void ResourceDir::setPath( const QString &path ) { +#ifndef NO_DIRWATCH mDirWatch.stopScan(); mDirWatch.removeDir( mPath ); mPath = path; mDirWatch.addDir( mPath, true ); mDirWatch.startScan(); - +#else + mPath = path; +#endif //US simulate KDirWatch event //US pathChanged(); } QString ResourceDir::path() const diff --git a/kabc/plugins/dir/resourcedir.h b/kabc/plugins/dir/resourcedir.h index c2aedad..77cd18c 100644 --- a/kabc/plugins/dir/resourcedir.h +++ b/kabc/plugins/dir/resourcedir.h @@ -101,14 +101,15 @@ protected: bool lock( const QString &path ); void unlock( const QString &path ); private: FormatPlugin *mFormat; +#ifndef NO_DIRWATCH KDirWatch mDirWatch; - +#endif QString mPath; QString mFormatName; QString mLockUniqueName; }; } diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 17263ae..b8c32d5 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp @@ -46,18 +46,20 @@ $Id$ #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 @@ -112,17 +114,17 @@ void ResourceFile::init( const QString &fileName, const QString &formatName ) 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 ); } ResourceFile::~ResourceFile() { delete mFormat; @@ -224,14 +226,15 @@ bool ResourceFile::save( Ticket *ticket ) mFormat->saveAll( addressBook(), this, saveFile.file() ); ok = saveFile.close(); } */ //US ToDo: write backupfile +#ifndef NO_DIRWATCH mDirWatch.stopScan(); - +#endif QFile info; info.setName( mFileName ); bool ok = info.open( IO_WriteOnly ); if ( ok ) { mFormat->saveAll( addressBook(), this, &info ); @@ -241,15 +244,15 @@ bool ResourceFile::save( Ticket *ticket ) else { } if ( !ok ) addressBook()->error( i18n( "Unable to save file '%1'." ).arg( mFileName ) ); - +#ifndef NO_DIRWATCH mDirWatch.startScan(); - +#endif delete ticket; #ifdef ALLOW_LOCKING unlock( mFileName ); #endif return ok; @@ -323,20 +326,23 @@ void ResourceFile::unlock( const QString &fileName ) return; #endif } void ResourceFile::setFileName( const QString &fileName ) { +#ifndef NO_DIRWATCH mDirWatch.stopScan(); mDirWatch.removeFile( mFileName ); - mFileName = fileName; mDirWatch.addFile( mFileName ); mDirWatch.startScan(); +#else + mFileName = fileName; +#endif //US simulate KDirWatch event //US fileChanged(); } QString ResourceFile::fileName() const diff --git a/kabc/plugins/file/resourcefile.h b/kabc/plugins/file/resourcefile.h index 0a3027c..8339340 100644 --- a/kabc/plugins/file/resourcefile.h +++ b/kabc/plugins/file/resourcefile.h @@ -150,13 +150,14 @@ private: QString mFileName; QString mFormatName; FormatPlugin *mFormat; QString mLockUniqueName; - +#ifndef NO_DIRWATCH KDirWatch mDirWatch; +#endif }; } #endif diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index 1a3a22c..02c5fb1 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp @@ -97,14 +97,14 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name ) setCaption( i18n( "Resource Configuration" ) ); QVBoxLayout *mainLayout = new QVBoxLayout( this ); QGroupBox *groupBox = new QGroupBox( i18n( "Resources" ), this ); groupBox->setColumnLayout(0, Qt::Vertical ); - groupBox->layout()->setSpacing( 6 ); - groupBox->layout()->setMargin( 11 ); + groupBox->layout()->setSpacing( 3 ); + groupBox->layout()->setMargin( 5 ); QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 4, 2 ); //US mFamilyCombo = new KComboBox( false, groupBox ); mFamilyCombo = new KComboBox( groupBox ); groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 ); @@ -115,19 +115,19 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name ) mListView->addColumn( i18n( "Standard" ) ); //US groupBoxLayout->addWidget( mListView, 1, 0 ); groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 ); - mAddButton = new QPushButton( i18n( "&Add..." ), this ); + mAddButton = new QPushButton( i18n( "&Add..." ), groupBox ); groupBoxLayout->addWidget( mAddButton, 2, 0 ); - mRemoveButton = new QPushButton( i18n( "&Remove" ), this ); + mRemoveButton = new QPushButton( i18n( "&Remove" ), groupBox ); groupBoxLayout->addWidget( mRemoveButton, 2, 1 ); - mEditButton = new QPushButton( i18n( "&Edit..." ), this ); + mEditButton = new QPushButton( i18n( "&Edit..." ), groupBox ); groupBoxLayout->addWidget( mEditButton, 3, 0 ); - mStandardButton = new QPushButton( i18n( "&Use as Standard" ), this ); + mStandardButton = new QPushButton( i18n( "&Use as Standard" ), groupBox ); groupBoxLayout->addWidget( mStandardButton, 3, 1 ); mRemoveButton->setEnabled( false ); mEditButton->setEnabled( false ); mStandardButton->setEnabled( false ); |