| Summary: | libkdepim: use proper error handler to show kabc errors | ||
|---|---|---|---|
| Product: | [Unmaintained] kresources | Reporter: | Felix Berger <bflat1> |
| Component: | framework | Assignee: | Cornelius Schumacher <schumacher> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | steffenp |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
Patch implements the described fix.
Use error handler in KAddrBookExternal::addVCard as well |
||
|
Description
Felix Berger
2006-09-01 18:49:48 UTC
Created attachment 17604 [details]
Patch implements the described fix.
Created attachment 17616 [details]
Use error handler in KAddrBookExternal::addVCard as well
Is there any more information I can provide? SVN commit 655461 by winterz:
fix use proper error handler to show kabc errors
patch provided by Felix Berger. Thanks!
BUGS: 133395
M +9 -7 kaddrbook.cpp
--- branches/KDE/3.5/kdepim/libkdepim/kaddrbook.cpp #655460:655461
@@ -21,6 +21,7 @@
#include <kabc/resource.h>
#include <kabc/stdaddressbook.h>
#include <kabc/vcardconverter.h>
+#include <kabc/errorhandler.h>
#include <kresources/selectdialog.h>
#include <dcopref.h>
#include <dcopclient.h>
@@ -90,6 +91,8 @@
KABC::AddressBook *ab = KABC::StdAddressBook::self( true );
+ ab->setErrorHandler( new KABC::GuiErrorHandler( parent ) );
+
// force a reload of the address book file so that changes that were made
// by other programs are loaded
ab->asyncLoad();
@@ -144,9 +147,7 @@
a.setFormattedName( name );
}
- if ( !KAddrBookExternal::addAddressee( a ) ) {
- KMessageBox::error( parent, i18n("Cannot save to addressbook.") );
- } else {
+ if ( KAddrBookExternal::addAddressee( a ) ) {
QString text = i18n("<qt>The email address <b>%1</b> was added to your "
"addressbook; you can add more information to this "
"entry by opening the addressbook.</qt>").arg( addr );
@@ -158,6 +159,7 @@
KMessageBox::information( parent, text, QString::null,
"alreadyInAddressBook" );
}
+ ab->setErrorHandler( 0 );
}
void KAddrBookExternal::openAddressBook(QWidget *) {
@@ -176,14 +178,13 @@
KABC::AddressBook *ab = KABC::StdAddressBook::self( true );
bool inserted = false;
+ ab->setErrorHandler( new KABC::GuiErrorHandler( parent ) );
+
KABC::Addressee::List addressees =
ab->findByEmail( addressee.preferredEmail() );
if ( addressees.isEmpty() ) {
- if ( !KAddrBookExternal::addAddressee( addressee ) ) {
- KMessageBox::error( parent, i18n("Cannot save to addressbook.") );
- inserted = false;
- } else {
+ if ( KAddrBookExternal::addAddressee( addressee ) ) {
QString text = i18n("The VCard was added to your addressbook; "
"you can add more information to this "
"entry by opening the addressbook.");
@@ -199,6 +200,7 @@
inserted = true;
}
+ ab->setErrorHandler( 0 );
return inserted;
}
|