author | zautrix <zautrix> | 2004-10-13 14:23:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-13 14:23:28 (UTC) |
commit | 2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6 (patch) (unidiff) | |
tree | f1e664ddf31aae347b1a119c9111cbd1c931bf89 /microkde | |
parent | d41893fb0a49fbb080326a4c1fd98e1a032a182a (diff) | |
download | kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.zip kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.gz kdepimpi-2cfda2af7cba3c9aff2d7722421b5d33b7f56cb6.tar.bz2 |
more sync fixes
-rw-r--r-- | microkde/kresources/configdialog.cpp | 5 | ||||
-rw-r--r-- | microkde/kresources/configdialog.h | 1 | ||||
-rw-r--r-- | microkde/kresources/resource.cpp | 14 | ||||
-rw-r--r-- | microkde/kresources/resource.h | 2 |
4 files changed, 20 insertions, 2 deletions
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index f8240f9..030b547 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp | |||
@@ -46,66 +46,70 @@ | |||
46 | using namespace KRES; | 46 | using namespace KRES; |
47 | 47 | ||
48 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | 48 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, |
49 | Resource* resource, const char *name ) | 49 | Resource* resource, const char *name ) |
50 | : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ), | 50 | : KDialogBase( parent, name, true, resource->isSyncable()?i18n( "Sync Profile Configuration" ):i18n( "Resource Configuration" ), |
51 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget_Settings(0), mSyncWidget_Conflicts(0),mSyncWidget_Remote(0), mResource( resource ), mPersistentReadOnly(false) | 51 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mSyncWidget_Settings(0), mSyncWidget_Conflicts(0),mSyncWidget_Remote(0), mResource( resource ), mPersistentReadOnly(false) |
52 | { | 52 | { |
53 | 53 | ||
54 | Factory *factory = Factory::self( resourceFamily ); | 54 | Factory *factory = Factory::self( resourceFamily ); |
55 | 55 | ||
56 | //US resize( 250, 240 ); | 56 | //US resize( 250, 240 ); |
57 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); | 57 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); |
58 | 58 | ||
59 | QFrame *main; | 59 | QFrame *main; |
60 | 60 | ||
61 | if (!mResource->isSyncable()) | 61 | if (!mResource->isSyncable()) |
62 | main = plainPage(); | 62 | main = plainPage(); |
63 | else | 63 | else |
64 | main = addPage("Profile"); | 64 | main = addPage("Profile"); |
65 | 65 | ||
66 | QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); | 66 | QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); |
67 | 67 | ||
68 | 68 | ||
69 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 69 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); |
70 | generalGroupBox->layout()->setSpacing( spacingHint() ); | 70 | generalGroupBox->layout()->setSpacing( spacingHint() ); |
71 | generalGroupBox->setTitle( i18n( "General Settings" ) ); | 71 | generalGroupBox->setTitle( i18n( "General Settings" ) ); |
72 | 72 | ||
73 | new QLabel( mResource->isSyncable()?i18n( "Profile Name:" ):i18n( "Name:" ), generalGroupBox ); | 73 | new QLabel( mResource->isSyncable()?i18n( "Profile Name:" ):i18n( "Name:" ), generalGroupBox ); |
74 | 74 | ||
75 | mName = new KLineEdit( generalGroupBox ); | 75 | mName = new KLineEdit( generalGroupBox ); |
76 | 76 | ||
77 | if (!mResource->isSyncable()) { | 77 | if (!mResource->isSyncable()) { |
78 | new QLabel("", generalGroupBox ); | ||
78 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); | 79 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); |
79 | mReadOnly->setChecked( mResource->readOnly() ); | 80 | mReadOnly->setChecked( mResource->readOnly() ); |
81 | new QLabel("", generalGroupBox ); | ||
82 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); | ||
83 | mIncludeInSync->setChecked( mResource->includeInSync() ); | ||
80 | } | 84 | } |
81 | 85 | ||
82 | mName->setText( mResource->resourceName() ); | 86 | mName->setText( mResource->resourceName() ); |
83 | 87 | ||
84 | mainLayout->addWidget( generalGroupBox ); | 88 | mainLayout->addWidget( generalGroupBox ); |
85 | 89 | ||
86 | QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 90 | QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); |
87 | resourceGroupBox->layout()->setSpacing( spacingHint()); | 91 | resourceGroupBox->layout()->setSpacing( spacingHint()); |
88 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) | 92 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) |
89 | .arg( factory->typeName( resource->type() ) ) ); | 93 | .arg( factory->typeName( resource->type() ) ) ); |
90 | mainLayout->addWidget( resourceGroupBox ); | 94 | mainLayout->addWidget( resourceGroupBox ); |
91 | 95 | ||
92 | mainLayout->addStretch(); | 96 | mainLayout->addStretch(); |
93 | 97 | ||
94 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); | 98 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); |
95 | if ( mConfigWidget ) { | 99 | if ( mConfigWidget ) { |
96 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), | 100 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), |
97 | SLOT( setReadOnly( bool ) ) ); | 101 | SLOT( setReadOnly( bool ) ) ); |
98 | connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), | 102 | connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), |
99 | SLOT( setPersistentReadOnly( bool ) ) ); | 103 | SLOT( setPersistentReadOnly( bool ) ) ); |
100 | mConfigWidget->setInEditMode( false ); | 104 | mConfigWidget->setInEditMode( false ); |
101 | mConfigWidget->loadSettings( mResource ); | 105 | mConfigWidget->loadSettings( mResource ); |
102 | mConfigWidget->show(); | 106 | mConfigWidget->show(); |
103 | 107 | ||
104 | } | 108 | } |
105 | 109 | ||
106 | if (mResource->isSyncable()) | 110 | if (mResource->isSyncable()) |
107 | { | 111 | { |
108 | SyncWidgetContainer* c = factory->syncWidgetContainer( resource->type() ); | 112 | SyncWidgetContainer* c = factory->syncWidgetContainer( resource->type() ); |
109 | 113 | ||
110 | QFrame* syncPage = addPage("Settings"); | 114 | QFrame* syncPage = addPage("Settings"); |
111 | QVBoxLayout *syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); | 115 | QVBoxLayout *syncLayout = new QVBoxLayout( syncPage, 0, spacingHint() ); |
@@ -191,51 +195,52 @@ void ConfigDialog::setReadOnly( bool value ) | |||
191 | if (!mResource->isSyncable()) { | 195 | if (!mResource->isSyncable()) { |
192 | 196 | ||
193 | if (mPersistentReadOnly == false) | 197 | if (mPersistentReadOnly == false) |
194 | mReadOnly->setChecked( value ); | 198 | mReadOnly->setChecked( value ); |
195 | else | 199 | else |
196 | mReadOnly->setChecked( true ); | 200 | mReadOnly->setChecked( true ); |
197 | } | 201 | } |
198 | } | 202 | } |
199 | 203 | ||
200 | void ConfigDialog::setPersistentReadOnly( bool value ) | 204 | void ConfigDialog::setPersistentReadOnly( bool value ) |
201 | { | 205 | { |
202 | if (!mResource->isSyncable()) { | 206 | if (!mResource->isSyncable()) { |
203 | 207 | ||
204 | mPersistentReadOnly = value; | 208 | mPersistentReadOnly = value; |
205 | 209 | ||
206 | if (value == true) | 210 | if (value == true) |
207 | setReadOnly( true ); | 211 | setReadOnly( true ); |
208 | 212 | ||
209 | mReadOnly->setEnabled( !value ); | 213 | mReadOnly->setEnabled( !value ); |
210 | } | 214 | } |
211 | } | 215 | } |
212 | 216 | ||
213 | void ConfigDialog::accept() | 217 | void ConfigDialog::accept() |
214 | { | 218 | { |
215 | if ( mName->text().isEmpty() ) { | 219 | if ( mName->text().isEmpty() ) { |
216 | KMessageBox::sorry( this, mResource->isSyncable()?i18n( "Please enter a profile name" ):i18n( "Please enter a resource name" ) ); | 220 | KMessageBox::sorry( this, mResource->isSyncable()?i18n( "Please enter a profile name" ):i18n( "Please enter a resource name" ) ); |
217 | return; | 221 | return; |
218 | } | 222 | } |
219 | 223 | ||
220 | mResource->setResourceName( mName->text() ); | 224 | mResource->setResourceName( mName->text() ); |
221 | if (!mResource->isSyncable()) | 225 | if (!mResource->isSyncable()) |
222 | mResource->setReadOnly( mReadOnly->isChecked() ); | 226 | mResource->setReadOnly( mReadOnly->isChecked() ); |
227 | mResource->setIncludeInSync( mIncludeInSync->isChecked() ); | ||
223 | 228 | ||
224 | if ( mConfigWidget ) { | 229 | if ( mConfigWidget ) { |
225 | // First save generic information | 230 | // First save generic information |
226 | // Also save setting of specific resource type | 231 | // Also save setting of specific resource type |
227 | mConfigWidget->saveSettings( mResource ); | 232 | mConfigWidget->saveSettings( mResource ); |
228 | } | 233 | } |
229 | 234 | ||
230 | if ( mSyncWidget_Settings ) | 235 | if ( mSyncWidget_Settings ) |
231 | mSyncWidget_Settings->saveSettings( mResource ); | 236 | mSyncWidget_Settings->saveSettings( mResource ); |
232 | if ( mSyncWidget_Conflicts ) | 237 | if ( mSyncWidget_Conflicts ) |
233 | mSyncWidget_Conflicts->saveSettings( mResource ); | 238 | mSyncWidget_Conflicts->saveSettings( mResource ); |
234 | if ( mSyncWidget_Remote ) | 239 | if ( mSyncWidget_Remote ) |
235 | mSyncWidget_Remote->saveSettings( mResource ); | 240 | mSyncWidget_Remote->saveSettings( mResource ); |
236 | 241 | ||
237 | 242 | ||
238 | KDialog::accept(); | 243 | KDialog::accept(); |
239 | } | 244 | } |
240 | 245 | ||
241 | //US #include "configdialog.moc" | 246 | //US #include "configdialog.moc" |
diff --git a/microkde/kresources/configdialog.h b/microkde/kresources/configdialog.h index 63cd4e9..ed3ecab 100644 --- a/microkde/kresources/configdialog.h +++ b/microkde/kresources/configdialog.h | |||
@@ -29,39 +29,40 @@ class QCheckBox; | |||
29 | class KButtonBox; | 29 | class KButtonBox; |
30 | 30 | ||
31 | namespace KRES { | 31 | namespace KRES { |
32 | class Resource; | 32 | class Resource; |
33 | class ConfigWidget; | 33 | class ConfigWidget; |
34 | class SyncWidget; | 34 | class SyncWidget; |
35 | 35 | ||
36 | class ConfigDialog : public KDialogBase | 36 | class ConfigDialog : public KDialogBase |
37 | { | 37 | { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | public: | 39 | public: |
40 | // Resource=0: create new resource | 40 | // Resource=0: create new resource |
41 | ConfigDialog( QWidget *parent, const QString& resourceFamily, | 41 | ConfigDialog( QWidget *parent, const QString& resourceFamily, |
42 | Resource* resource, const char *name = 0); | 42 | Resource* resource, const char *name = 0); |
43 | 43 | ||
44 | void setInEditMode( bool value ); | 44 | void setInEditMode( bool value ); |
45 | 45 | ||
46 | protected slots: | 46 | protected slots: |
47 | void accept(); | 47 | void accept(); |
48 | void setReadOnly( bool value ); | 48 | void setReadOnly( bool value ); |
49 | void setPersistentReadOnly( bool value ); | 49 | void setPersistentReadOnly( bool value ); |
50 | void slotNameChanged( const QString &text); | 50 | void slotNameChanged( const QString &text); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | ConfigWidget *mConfigWidget; | 53 | ConfigWidget *mConfigWidget; |
54 | SyncWidget *mSyncWidget_Settings; | 54 | SyncWidget *mSyncWidget_Settings; |
55 | SyncWidget *mSyncWidget_Conflicts; | 55 | SyncWidget *mSyncWidget_Conflicts; |
56 | SyncWidget *mSyncWidget_Remote; | 56 | SyncWidget *mSyncWidget_Remote; |
57 | Resource* mResource; | 57 | Resource* mResource; |
58 | 58 | ||
59 | KLineEdit *mName; | 59 | KLineEdit *mName; |
60 | QCheckBox *mReadOnly; | 60 | QCheckBox *mReadOnly; |
61 | QCheckBox *mIncludeInSync; | ||
61 | //US add a persistent readonly flag. We need that for opie and qtopia addressbooks. | 62 | //US add a persistent readonly flag. We need that for opie and qtopia addressbooks. |
62 | bool mPersistentReadOnly; | 63 | bool mPersistentReadOnly; |
63 | }; | 64 | }; |
64 | 65 | ||
65 | } | 66 | } |
66 | 67 | ||
67 | #endif | 68 | #endif |
diff --git a/microkde/kresources/resource.cpp b/microkde/kresources/resource.cpp index 4f69540..f79bcd0 100644 --- a/microkde/kresources/resource.cpp +++ b/microkde/kresources/resource.cpp | |||
@@ -10,174 +10,184 @@ | |||
10 | License as published by the Free Software Foundation; either | 10 | License as published by the Free Software Foundation; either |
11 | version 2 of the License, or (at your option) any later version. | 11 | version 2 of the License, or (at your option) any later version. |
12 | 12 | ||
13 | This library is distributed in the hope that it will be useful, | 13 | This library is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <kdebug.h> | 24 | #include <kdebug.h> |
25 | #include <kapplication.h> | 25 | #include <kapplication.h> |
26 | #include <kconfig.h> | 26 | #include <kconfig.h> |
27 | 27 | ||
28 | #include "resource.h" | 28 | #include "resource.h" |
29 | 29 | ||
30 | using namespace KRES; | 30 | using namespace KRES; |
31 | 31 | ||
32 | class Resource::ResourcePrivate | 32 | class Resource::ResourcePrivate |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | #ifdef QT_THREAD_SUPPORT | 35 | #ifdef QT_THREAD_SUPPORT |
36 | QMutex mMutex; | 36 | QMutex mMutex; |
37 | #endif | 37 | #endif |
38 | int mOpenCount; | 38 | int mOpenCount; |
39 | QString mType; | 39 | QString mType; |
40 | QString mIdentifier; | 40 | QString mIdentifier; |
41 | bool mReadOnly; | 41 | bool mReadOnly; |
42 | bool mIncludeInSync; | ||
42 | QString mName; | 43 | QString mName; |
43 | bool mActive; | 44 | bool mActive; |
44 | bool mIsOpen; | 45 | bool mIsOpen; |
45 | }; | 46 | }; |
46 | 47 | ||
47 | Resource::Resource( const KConfig* config ) | 48 | Resource::Resource( const KConfig* config ) |
48 | : QObject( 0, "" ), d( new ResourcePrivate ) | 49 | : QObject( 0, "" ), d( new ResourcePrivate ) |
49 | { | 50 | { |
50 | d->mOpenCount = 0; | 51 | d->mOpenCount = 0; |
51 | d->mIsOpen = false; | 52 | d->mIsOpen = false; |
52 | 53 | ||
53 | //US compiler claimed that const discards qualifier | 54 | //US compiler claimed that const discards qualifier |
54 | KConfig* cfg = (KConfig*)config; | 55 | KConfig* cfg = (KConfig*)config; |
55 | if ( cfg ) { | 56 | if ( cfg ) { |
56 | #ifdef _WIN32_ | 57 | #ifdef _WIN32_ |
57 | // we use plugins on win32. the group is stored in a static variable | 58 | // we use plugins on win32. the group is stored in a static variable |
58 | // such that group info not available on win32 plugins | 59 | // such that group info not available on win32 plugins |
59 | // to fix that, it would be a looooot of work | 60 | // to fix that, it would be a looooot of work |
60 | if ( !cfg->tempGroup().isEmpty() ) | 61 | if ( !cfg->tempGroup().isEmpty() ) |
61 | cfg->setGroup( cfg->tempGroup() ); | 62 | cfg->setGroup( cfg->tempGroup() ); |
62 | #endif | 63 | #endif |
63 | d->mType = cfg->readEntry( "ResourceType" ); | 64 | d->mType = cfg->readEntry( "ResourceType" ); |
64 | d->mName = cfg->readEntry( "ResourceName" ); | 65 | d->mName = cfg->readEntry( "ResourceName" ); |
65 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); | 66 | d->mReadOnly = cfg->readBoolEntry( "ResourceIsReadOnly", false ); |
67 | d->mIncludeInSync = cfg->readBoolEntry( "ResourceIncludeInSync", true );; | ||
66 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); | 68 | d->mActive = cfg->readBoolEntry( "ResourceIsActive", true ); |
67 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); | 69 | d->mIdentifier = cfg->readEntry( "ResourceIdentifier" ); |
68 | } else { | 70 | } else { |
69 | d->mType = "type"; | 71 | d->mType = "type"; |
70 | d->mName = "resource-name"; | 72 | d->mName = "resource-name"; |
71 | d->mReadOnly = false; | 73 | d->mReadOnly = false; |
74 | d->mIncludeInSync = true; | ||
72 | d->mActive = true; | 75 | d->mActive = true; |
73 | d->mIdentifier = KApplication::randomString( 10 ); | 76 | d->mIdentifier = KApplication::randomString( 10 ); |
74 | } | 77 | } |
75 | } | 78 | } |
76 | 79 | ||
77 | Resource::~Resource() | 80 | Resource::~Resource() |
78 | { | 81 | { |
79 | delete d; | 82 | delete d; |
80 | d = 0; | 83 | d = 0; |
81 | } | 84 | } |
82 | 85 | ||
83 | void Resource::writeConfig( KConfig* config ) | 86 | void Resource::writeConfig( KConfig* config ) |
84 | { | 87 | { |
85 | |||
86 | |||
87 | config->writeEntry( "ResourceType", d->mType ); | 88 | config->writeEntry( "ResourceType", d->mType ); |
88 | config->writeEntry( "ResourceName", d->mName ); | 89 | config->writeEntry( "ResourceName", d->mName ); |
89 | config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); | 90 | config->writeEntry( "ResourceIsReadOnly", d->mReadOnly ); |
91 | config->writeEntry( "ResourceIncludeInSync", d->mIncludeInSync ); | ||
90 | config->writeEntry( "ResourceIsActive", d->mActive ); | 92 | config->writeEntry( "ResourceIsActive", d->mActive ); |
91 | config->writeEntry( "ResourceIdentifier", d->mIdentifier ); | 93 | config->writeEntry( "ResourceIdentifier", d->mIdentifier ); |
92 | } | 94 | } |
93 | 95 | ||
94 | bool Resource::open() | 96 | bool Resource::open() |
95 | { | 97 | { |
96 | d->mIsOpen = true; | 98 | d->mIsOpen = true; |
97 | #ifdef QT_THREAD_SUPPORT | 99 | #ifdef QT_THREAD_SUPPORT |
98 | QMutexLocker guard( &(d->mMutex) ); | 100 | QMutexLocker guard( &(d->mMutex) ); |
99 | #endif | 101 | #endif |
100 | if ( !d->mOpenCount ) { | 102 | if ( !d->mOpenCount ) { |
101 | kdDebug(5650) << "Opening resource " << resourceName() << endl; | 103 | kdDebug(5650) << "Opening resource " << resourceName() << endl; |
102 | d->mIsOpen = doOpen(); | 104 | d->mIsOpen = doOpen(); |
103 | } | 105 | } |
104 | d->mOpenCount++; | 106 | d->mOpenCount++; |
105 | return d->mIsOpen; | 107 | return d->mIsOpen; |
106 | } | 108 | } |
107 | 109 | ||
108 | void Resource::close() | 110 | void Resource::close() |
109 | { | 111 | { |
110 | #ifdef QT_THREAD_SUPPORT | 112 | #ifdef QT_THREAD_SUPPORT |
111 | QMutexLocker guard( &(d->mMutex) ); | 113 | QMutexLocker guard( &(d->mMutex) ); |
112 | #endif | 114 | #endif |
113 | if ( !d->mOpenCount ) { | 115 | if ( !d->mOpenCount ) { |
114 | kdDebug(5650) << "ERROR: Resource " << resourceName() << " closed more times than previously opened" << endl; | 116 | kdDebug(5650) << "ERROR: Resource " << resourceName() << " closed more times than previously opened" << endl; |
115 | return; | 117 | return; |
116 | } | 118 | } |
117 | d->mOpenCount--; | 119 | d->mOpenCount--; |
118 | if ( !d->mOpenCount ) { | 120 | if ( !d->mOpenCount ) { |
119 | kdDebug(5650) << "Closing resource " << resourceName() << endl; | 121 | kdDebug(5650) << "Closing resource " << resourceName() << endl; |
120 | doClose(); | 122 | doClose(); |
121 | d->mIsOpen = false; | 123 | d->mIsOpen = false; |
122 | } else { | 124 | } else { |
123 | kdDebug(5650) << "Not yet closing resource " << resourceName() << ", open count = " << d->mOpenCount << endl; | 125 | kdDebug(5650) << "Not yet closing resource " << resourceName() << ", open count = " << d->mOpenCount << endl; |
124 | } | 126 | } |
125 | } | 127 | } |
126 | 128 | ||
127 | bool Resource::isOpen() const | 129 | bool Resource::isOpen() const |
128 | { | 130 | { |
129 | return d->mIsOpen; | 131 | return d->mIsOpen; |
130 | } | 132 | } |
131 | 133 | ||
132 | void Resource::setIdentifier( const QString& identifier ) | 134 | void Resource::setIdentifier( const QString& identifier ) |
133 | { | 135 | { |
134 | d->mIdentifier = identifier; | 136 | d->mIdentifier = identifier; |
135 | } | 137 | } |
136 | 138 | ||
137 | QString Resource::identifier() const | 139 | QString Resource::identifier() const |
138 | { | 140 | { |
139 | return d->mIdentifier; | 141 | return d->mIdentifier; |
140 | } | 142 | } |
141 | 143 | ||
142 | void Resource::setType( const QString& type ) | 144 | void Resource::setType( const QString& type ) |
143 | { | 145 | { |
144 | d->mType = type; | 146 | d->mType = type; |
145 | } | 147 | } |
146 | 148 | ||
147 | QString Resource::type() const | 149 | QString Resource::type() const |
148 | { | 150 | { |
149 | return d->mType; | 151 | return d->mType; |
150 | } | 152 | } |
151 | 153 | ||
154 | void Resource::setIncludeInSync( bool value ) | ||
155 | { | ||
156 | d->mIncludeInSync = value; | ||
157 | } | ||
158 | bool Resource::includeInSync() const | ||
159 | { | ||
160 | return d->mIncludeInSync; | ||
161 | } | ||
152 | void Resource::setReadOnly( bool value ) | 162 | void Resource::setReadOnly( bool value ) |
153 | { | 163 | { |
154 | d->mReadOnly = value; | 164 | d->mReadOnly = value; |
155 | } | 165 | } |
156 | 166 | ||
157 | bool Resource::readOnly() const | 167 | bool Resource::readOnly() const |
158 | { | 168 | { |
159 | return d->mReadOnly; | 169 | return d->mReadOnly; |
160 | } | 170 | } |
161 | 171 | ||
162 | void Resource::setResourceName( const QString &name ) | 172 | void Resource::setResourceName( const QString &name ) |
163 | { | 173 | { |
164 | d->mName = name; | 174 | d->mName = name; |
165 | } | 175 | } |
166 | 176 | ||
167 | QString Resource::resourceName() const | 177 | QString Resource::resourceName() const |
168 | { | 178 | { |
169 | return d->mName; | 179 | return d->mName; |
170 | } | 180 | } |
171 | 181 | ||
172 | void Resource::setActive( bool value ) | 182 | void Resource::setActive( bool value ) |
173 | { | 183 | { |
174 | d->mActive = value; | 184 | d->mActive = value; |
175 | } | 185 | } |
176 | 186 | ||
177 | bool Resource::isActive() const | 187 | bool Resource::isActive() const |
178 | { | 188 | { |
179 | return d->mActive; | 189 | return d->mActive; |
180 | } | 190 | } |
181 | 191 | ||
182 | void Resource::dump() const | 192 | void Resource::dump() const |
183 | { | 193 | { |
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index 580b5d1..70b5613 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h | |||
@@ -281,64 +281,66 @@ class Resource : public QObject | |||
281 | */ | 281 | */ |
282 | void close(); | 282 | void close(); |
283 | 283 | ||
284 | /** | 284 | /** |
285 | * Returns whether the resource is open or not. | 285 | * Returns whether the resource is open or not. |
286 | */ | 286 | */ |
287 | bool isOpen() const; | 287 | bool isOpen() const; |
288 | 288 | ||
289 | /** | 289 | /** |
290 | * Returns a unique identifier. The identifier is unique for this resource. | 290 | * Returns a unique identifier. The identifier is unique for this resource. |
291 | * It is created when the resource is first created, and it is retained | 291 | * It is created when the resource is first created, and it is retained |
292 | * in the resource family configuration file for this resource. | 292 | * in the resource family configuration file for this resource. |
293 | * @return This resource's identifier | 293 | * @return This resource's identifier |
294 | */ | 294 | */ |
295 | QString identifier() const; | 295 | QString identifier() const; |
296 | 296 | ||
297 | /** | 297 | /** |
298 | * Returns the type of this resource. | 298 | * Returns the type of this resource. |
299 | */ | 299 | */ |
300 | QString type() const; | 300 | QString type() const; |
301 | 301 | ||
302 | /** | 302 | /** |
303 | * Mark the resource as read-only. You can override this method, | 303 | * Mark the resource as read-only. You can override this method, |
304 | * but also remember to call Resource::setReadOnly(). | 304 | * but also remember to call Resource::setReadOnly(). |
305 | */ | 305 | */ |
306 | virtual void setReadOnly( bool value ); | 306 | virtual void setReadOnly( bool value ); |
307 | 307 | ||
308 | /** | 308 | /** |
309 | * Returns, if the resource is read-only. | 309 | * Returns, if the resource is read-only. |
310 | */ | 310 | */ |
311 | virtual bool readOnly() const; | 311 | virtual bool readOnly() const; |
312 | 312 | ||
313 | void setIncludeInSync( bool value ); | ||
314 | bool includeInSync() const; | ||
313 | /** | 315 | /** |
314 | * Set the name of resource.You can override this method, | 316 | * Set the name of resource.You can override this method, |
315 | * but also remember to call Resource::setResourceName(). | 317 | * but also remember to call Resource::setResourceName(). |
316 | */ | 318 | */ |
317 | virtual void setResourceName( const QString &name ); | 319 | virtual void setResourceName( const QString &name ); |
318 | 320 | ||
319 | /** | 321 | /** |
320 | * Returns the name of resource. | 322 | * Returns the name of resource. |
321 | */ | 323 | */ |
322 | virtual QString resourceName() const; | 324 | virtual QString resourceName() const; |
323 | 325 | ||
324 | 326 | ||
325 | 327 | ||
326 | virtual bool isSyncable() const = 0; | 328 | virtual bool isSyncable() const = 0; |
327 | 329 | ||
328 | 330 | ||
329 | /** | 331 | /** |
330 | Sets, if the resource is active. | 332 | Sets, if the resource is active. |
331 | */ | 333 | */ |
332 | void setActive( bool active ); | 334 | void setActive( bool active ); |
333 | 335 | ||
334 | /** | 336 | /** |
335 | Return true, if the resource is active. | 337 | Return true, if the resource is active. |
336 | */ | 338 | */ |
337 | bool isActive() const; | 339 | bool isActive() const; |
338 | 340 | ||
339 | friend class Factory; | 341 | friend class Factory; |
340 | friend class ManagerImpl; | 342 | friend class ManagerImpl; |
341 | 343 | ||
342 | /** | 344 | /** |
343 | Print resource information as debug output. | 345 | Print resource information as debug output. |
344 | */ | 346 | */ |