author | zautrix <zautrix> | 2005-03-25 00:08:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-25 00:08:08 (UTC) |
commit | 7c2e130ddd194f1c4b5365af6999a27c08232f4b (patch) (unidiff) | |
tree | 75665681327ee49d7650f4d840b5c8c772180fb4 /kaddressbook | |
parent | 5cf054b82738d65f9b0a34ccb51c993ee4a0189f (diff) | |
download | kdepimpi-7c2e130ddd194f1c4b5365af6999a27c08232f4b.zip kdepimpi-7c2e130ddd194f1c4b5365af6999a27c08232f4b.tar.gz kdepimpi-7c2e130ddd194f1c4b5365af6999a27c08232f4b.tar.bz2 |
fixes
-rw-r--r-- | kaddressbook/filtereditdialog.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp index 1194406..ef9b979 100644 --- a/kaddressbook/filtereditdialog.cpp +++ b/kaddressbook/filtereditdialog.cpp | |||
@@ -137,51 +137,51 @@ void FilterEditDialog::initGUI() | |||
137 | resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300)); | 137 | resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300)); |
138 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
139 | 139 | ||
140 | 140 | ||
141 | QWidget *page = plainPage(); | 141 | QWidget *page = plainPage(); |
142 | QLabel *label; | 142 | QLabel *label; |
143 | 143 | ||
144 | QGridLayout *topLayout = new QGridLayout( page, 3, 2, 0, spacingHint() ); | 144 | QGridLayout *topLayout = new QGridLayout( page, 3, 2, 0, spacingHint() ); |
145 | 145 | ||
146 | label = new QLabel( i18n( "Name" ), page ); | 146 | label = new QLabel( i18n( "Name" ), page ); |
147 | mNameEdit = new KLineEdit( page ); | 147 | mNameEdit = new KLineEdit( page ); |
148 | mNameEdit->setFocus(); | 148 | mNameEdit->setFocus(); |
149 | topLayout->addWidget( label, 0, 0 ); | 149 | topLayout->addWidget( label, 0, 0 ); |
150 | topLayout->addWidget( mNameEdit, 0, 1 ); | 150 | topLayout->addWidget( mNameEdit, 0, 1 ); |
151 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), | 151 | connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), |
152 | SLOT( filterNameTextChanged( const QString&) ) ); | 152 | SLOT( filterNameTextChanged( const QString&) ) ); |
153 | 153 | ||
154 | mCategoriesView = new KListView( page ); | 154 | mCategoriesView = new KListView( page ); |
155 | mCategoriesView->addColumn( i18n( "Categories" ) ); | 155 | mCategoriesView->addColumn( i18n( "Categories" ) ); |
156 | topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 ); | 156 | topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 ); |
157 | 157 | ||
158 | mMatchRuleGroup = new QHButtonGroup( i18n( "Category rule" ), page ); | 158 | mMatchRuleGroup = new QHButtonGroup( i18n( "Category rule" ), page ); |
159 | mMatchRuleGroup->setExclusive( true ); | 159 | mMatchRuleGroup->setExclusive( true ); |
160 | QRadioButton *radio = new QRadioButton( i18n( "Include categories" ), mMatchRuleGroup ); | 160 | QRadioButton *radio = new QRadioButton( i18n( "Include categories" ), mMatchRuleGroup ); |
161 | radio->setChecked( true ); | ||
162 | //mMatchRuleGroup->insert( radio ); | 161 | //mMatchRuleGroup->insert( radio ); |
163 | radio = new QRadioButton( i18n( "Exclude categories" ), mMatchRuleGroup ); | 162 | radio = new QRadioButton( i18n( "Exclude categories" ), mMatchRuleGroup ); |
163 | radio->setChecked( true ); | ||
164 | //mMatchRuleGroup->insert( radio ); | 164 | //mMatchRuleGroup->insert( radio ); |
165 | topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 ); | 165 | topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 ); |
166 | 166 | ||
167 | QHButtonGroup * mMatchPPCGroup = new QHButtonGroup(i18n( "Include contacts, that are:" ), page ); | 167 | QHButtonGroup * mMatchPPCGroup = new QHButtonGroup(i18n( "Include contacts, that are:" ), page ); |
168 | mPublic = new QCheckBox( i18n( "public" ), mMatchPPCGroup ); | 168 | mPublic = new QCheckBox( i18n( "public" ), mMatchPPCGroup ); |
169 | mPrivate = new QCheckBox( i18n( "private" ), mMatchPPCGroup ); | 169 | mPrivate = new QCheckBox( i18n( "private" ), mMatchPPCGroup ); |
170 | mConfidential = new QCheckBox( i18n( "confidential" ), mMatchPPCGroup ); | 170 | mConfidential = new QCheckBox( i18n( "confidential" ), mMatchPPCGroup ); |
171 | mPublic->setChecked( true ); | 171 | mPublic->setChecked( true ); |
172 | mPrivate->setChecked( true ); | 172 | mPrivate->setChecked( true ); |
173 | mConfidential->setChecked( true ); | 173 | mConfidential->setChecked( true ); |
174 | topLayout->addMultiCellWidget( mMatchPPCGroup, 3, 3, 0, 1 ); | 174 | topLayout->addMultiCellWidget( mMatchPPCGroup, 3, 3, 0, 1 ); |
175 | 175 | ||
176 | } | 176 | } |
177 | 177 | ||
178 | void FilterEditDialog::filterNameTextChanged( const QString &text ) | 178 | void FilterEditDialog::filterNameTextChanged( const QString &text ) |
179 | { | 179 | { |
180 | enableButtonOK( !text.isEmpty() ); | 180 | enableButtonOK( !text.isEmpty() ); |
181 | } | 181 | } |
182 | 182 | ||
183 | void FilterEditDialog::slotHelp() | 183 | void FilterEditDialog::slotHelp() |
184 | { | 184 | { |
185 | #ifndef KAB_EMBEDDED | 185 | #ifndef KAB_EMBEDDED |
186 | kapp->invokeHelp( "using-filters" ); | 186 | kapp->invokeHelp( "using-filters" ); |
187 | #endif //KAB_EMBEDDED | 187 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index e8f6132..59aa5a5 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -3165,48 +3165,49 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
3165 | bool external = false; | 3165 | bool external = false; |
3166 | bool isXML = false; | 3166 | bool isXML = false; |
3167 | if ( filename.right(4) == ".xml") { | 3167 | if ( filename.right(4) == ".xml") { |
3168 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3168 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3169 | isXML = true; | 3169 | isXML = true; |
3170 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3170 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3171 | } else { | 3171 | } else { |
3172 | external = !manager->mIsKapiFile; | 3172 | external = !manager->mIsKapiFile; |
3173 | if ( external ) { | 3173 | if ( external ) { |
3174 | qDebug("KA: Sync::Setting vcf mode to external "); | 3174 | qDebug("KA: Sync::Setting vcf mode to external "); |
3175 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3175 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3176 | AddressBook::Iterator it; | 3176 | AddressBook::Iterator it; |
3177 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3177 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3178 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3178 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3179 | (*it).computeCsum( mCurrentSyncDevice ); | 3179 | (*it).computeCsum( mCurrentSyncDevice ); |
3180 | } | 3180 | } |
3181 | } | 3181 | } |
3182 | } | 3182 | } |
3183 | //AddressBook::Iterator it; | 3183 | //AddressBook::Iterator it; |
3184 | //QStringList vcards; | 3184 | //QStringList vcards; |
3185 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3185 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3186 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3186 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3187 | //} | 3187 | //} |
3188 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3188 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3189 | syncManager->hideProgressBar(); | ||
3189 | if ( syncOK ) { | 3190 | if ( syncOK ) { |
3190 | if ( syncManager->mWriteBackFile ) | 3191 | if ( syncManager->mWriteBackFile ) |
3191 | { | 3192 | { |
3192 | if ( external ) | 3193 | if ( external ) |
3193 | abLocal.removeSyncAddressees( !isXML); | 3194 | abLocal.removeSyncAddressees( !isXML); |
3194 | qDebug("KA: Sync::Saving remote AB "); | 3195 | qDebug("KA: Sync::Saving remote AB "); |
3195 | if ( ! abLocal.saveAB()) | 3196 | if ( ! abLocal.saveAB()) |
3196 | qDebug("KA: sync::Error writing back AB to file "); | 3197 | qDebug("KA: sync::Error writing back AB to file "); |
3197 | if ( external ) { | 3198 | if ( external ) { |
3198 | // afterwrite processing | 3199 | // afterwrite processing |
3199 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 3200 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
3200 | } | 3201 | } |
3201 | } | 3202 | } |
3202 | } | 3203 | } |
3203 | setModified(); | 3204 | setModified(); |
3204 | 3205 | ||
3205 | } | 3206 | } |
3206 | abLocal.removeResources(); | 3207 | abLocal.removeResources(); |
3207 | if ( syncOK ) | 3208 | if ( syncOK ) |
3208 | mViewManager->refreshView(); | 3209 | mViewManager->refreshView(); |
3209 | return syncOK; | 3210 | return syncOK; |
3210 | 3211 | ||
3211 | } | 3212 | } |
3212 | void KABCore::removeSyncInfo( QString syncProfile) | 3213 | void KABCore::removeSyncInfo( QString syncProfile) |
@@ -3216,95 +3217,97 @@ void KABCore::removeSyncInfo( QString syncProfile) | |||
3216 | setModified(); | 3217 | setModified(); |
3217 | } | 3218 | } |
3218 | 3219 | ||
3219 | 3220 | ||
3220 | //this is a overwritten callbackmethods from the syncinterface | 3221 | //this is a overwritten callbackmethods from the syncinterface |
3221 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 3222 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
3222 | { | 3223 | { |
3223 | if ( resource == "phone" ) | 3224 | if ( resource == "phone" ) |
3224 | return syncPhone(); | 3225 | return syncPhone(); |
3225 | disableBR( true ); | 3226 | disableBR( true ); |
3226 | if ( manager != syncManager ) | 3227 | if ( manager != syncManager ) |
3227 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); | 3228 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); |
3228 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3229 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3229 | 3230 | ||
3230 | AddressBook abLocal( resource,"syncContact"); | 3231 | AddressBook abLocal( resource,"syncContact"); |
3231 | bool syncOK = false; | 3232 | bool syncOK = false; |
3232 | message(i18n("Loading DTM address data..."), false); | 3233 | message(i18n("Loading DTM address data..."), false); |
3233 | if ( abLocal.load() ) { | 3234 | if ( abLocal.load() ) { |
3234 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3235 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3235 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3236 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3236 | message(i18n("Sync preprocessing..."),false); | 3237 | message(i18n("Sync preprocessing..."),false); |
3237 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 3238 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
3238 | message(i18n("Synchronizing..."),false); | 3239 | message(i18n("Synchronizing..."),false); |
3239 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3240 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3241 | syncManager->hideProgressBar(); | ||
3240 | if ( syncOK ) { | 3242 | if ( syncOK ) { |
3241 | if ( syncManager->mWriteBackFile ) { | 3243 | if ( syncManager->mWriteBackFile ) { |
3242 | abLocal.removeSyncAddressees( false ); | 3244 | abLocal.removeSyncAddressees( false ); |
3243 | message(i18n("Saving DTM address data..."),false); | 3245 | message(i18n("Saving DTM address data..."),false); |
3244 | abLocal.saveAB(); | 3246 | abLocal.saveAB(); |
3245 | message(i18n("Sync postprocessing..."),false); | 3247 | message(i18n("Sync postprocessing..."),false); |
3246 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3248 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3247 | } | 3249 | } |
3248 | } else | 3250 | } else |
3249 | message( i18n("Sync cancelled or failed.") ); | 3251 | message( i18n("Sync cancelled or failed.") ); |
3250 | setModified(); | 3252 | setModified(); |
3251 | } | 3253 | } |
3252 | abLocal.removeResources(); | 3254 | abLocal.removeResources(); |
3253 | if ( syncOK ) { | 3255 | if ( syncOK ) { |
3254 | mViewManager->refreshView(); | 3256 | mViewManager->refreshView(); |
3255 | message(i18n("DTM syncing finished.")); | 3257 | message(i18n("DTM syncing finished.")); |
3256 | } | 3258 | } |
3257 | disableBR( false ); | 3259 | disableBR( false ); |
3258 | return syncOK; | 3260 | return syncOK; |
3259 | 3261 | ||
3260 | } | 3262 | } |
3261 | void KABCore::message( QString m, bool startTimer) | 3263 | void KABCore::message( QString m, bool startTimer) |
3262 | { | 3264 | { |
3263 | topLevelWidget()->setCaption( m ); | 3265 | topLevelWidget()->setCaption( m ); |
3264 | qApp->processEvents(); | 3266 | qApp->processEvents(); |
3265 | if ( startTimer ) | 3267 | if ( startTimer ) |
3266 | mMessageTimer->start( 15000, true ); | 3268 | mMessageTimer->start( 15000, true ); |
3267 | else | 3269 | else |
3268 | mMessageTimer->stop(); | 3270 | mMessageTimer->stop(); |
3269 | } | 3271 | } |
3270 | bool KABCore::syncPhone() | 3272 | bool KABCore::syncPhone() |
3271 | { | 3273 | { |
3272 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3274 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3273 | QString fileName = getPhoneFile(); | 3275 | QString fileName = getPhoneFile(); |
3274 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 3276 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
3275 | message(i18n("Phone access failed!")); | 3277 | message(i18n("Phone access failed!")); |
3276 | return false; | 3278 | return false; |
3277 | } | 3279 | } |
3278 | AddressBook abLocal( fileName,"syncContact"); | 3280 | AddressBook abLocal( fileName,"syncContact"); |
3279 | bool syncOK = false; | 3281 | bool syncOK = false; |
3280 | { | 3282 | { |
3281 | abLocal.importFromFile( fileName ); | 3283 | abLocal.importFromFile( fileName ); |
3282 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3284 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3283 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3285 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3284 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3286 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3285 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3287 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3286 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3288 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3289 | syncManager->hideProgressBar(); | ||
3287 | if ( syncOK ) { | 3290 | if ( syncOK ) { |
3288 | if ( syncManager->mWriteBackFile ) { | 3291 | if ( syncManager->mWriteBackFile ) { |
3289 | abLocal.removeSyncAddressees( true ); | 3292 | abLocal.removeSyncAddressees( true ); |
3290 | abLocal.saveABphone( fileName ); | 3293 | abLocal.saveABphone( fileName ); |
3291 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3294 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3292 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3295 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3293 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3296 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3294 | } | 3297 | } |
3295 | } | 3298 | } |
3296 | setModified(); | 3299 | setModified(); |
3297 | } | 3300 | } |
3298 | abLocal.removeResources(); | 3301 | abLocal.removeResources(); |
3299 | if ( syncOK ) | 3302 | if ( syncOK ) |
3300 | mViewManager->refreshView(); | 3303 | mViewManager->refreshView(); |
3301 | return syncOK; | 3304 | return syncOK; |
3302 | } | 3305 | } |
3303 | void KABCore::getFile( bool success ) | 3306 | void KABCore::getFile( bool success ) |
3304 | { | 3307 | { |
3305 | if ( ! success ) { | 3308 | if ( ! success ) { |
3306 | message( i18n("Error receiving file. Nothing changed!") ); | 3309 | message( i18n("Error receiving file. Nothing changed!") ); |
3307 | return; | 3310 | return; |
3308 | } | 3311 | } |
3309 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3312 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3310 | if ( count ) | 3313 | if ( count ) |