summaryrefslogtreecommitdiffstats
path: root/tderesources/carddav
diff options
context:
space:
mode:
Diffstat (limited to 'tderesources/carddav')
-rw-r--r--tderesources/carddav/resource.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/tderesources/carddav/resource.cpp b/tderesources/carddav/resource.cpp
index 9fc54692e..2161e4afe 100644
--- a/tderesources/carddav/resource.cpp
+++ b/tderesources/carddav/resource.cpp
@@ -155,7 +155,9 @@ bool ResourceCardDav::load() {
loadCache();
//enableChangeNotification();
clearChanges();
- addressBook()->emitAddressBookChanged();
+ if (addressBook() != NULL) {
+ addressBook()->emitAddressBookChanged();
+ }
emit loadingFinished( this );
log("starting download job");
@@ -373,7 +375,7 @@ void ResourceCardDav::loadFinished() {
TQCString newpass;
if (KPasswordDialog::getPassword (newpass, TQString("<b>") + i18n("Remote authorization required") + TQString("</b><p>") + i18n("Please input the password for") + TQString(" ") + mPrefs->getusername(), NULL) != 1) {
log("load error: " + loader->errorString() );
- addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString());
+ if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString());
}
else {
// Set new password and try again
@@ -383,12 +385,12 @@ void ResourceCardDav::loadFinished() {
}
else {
log("load error: " + loader->errorString() );
- addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString());
+ if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString());
}
}
else {
log("load error: " + loader->errorString() );
- addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString());
+ if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString());
}
} else {
log("successful load");
@@ -404,7 +406,7 @@ void ResourceCardDav::loadFinished() {
log("clearing changes");
//enableChangeNotification();
clearChanges();
- addressBook()->emitAddressBookChanged();
+ if (addressBook() != NULL) addressBook()->emitAddressBookChanged();
emit loadingFinished( this );
}
}
@@ -441,7 +443,7 @@ bool ResourceCardDav::parseData(const TQString& data) {
// check if the data is OK
// May be it's not efficient (parsing is done twice), but it should be safe
if (!checkData(data)) {
- addressBook()->error(i18n("Parsing calendar data failed."));
+ if (addressBook() != NULL) addressBook()->error(i18n("Parsing calendar data failed."));
return false;
}
@@ -477,7 +479,7 @@ bool ResourceCardDav::parseData(const TQString& data) {
sout << data << "\n";
fout.close();
} else {
- addressBook()->error(i18n("can't open file"));
+ if (addressBook() != NULL) addressBook()->error(i18n("can't open file"));
}
#endif // KCARDDAV_DEBUG
// end of debug code ----------------------------------------------------
@@ -561,7 +563,7 @@ void ResourceCardDav::writingQueuePop() {
sout << "================== Deleted:\n" << t->deleted << "\n";
fout.close();
} else {
- addressBook()->error(i18n("can't open file"));
+ if (addressBook() != NULL) addressBook()->error(i18n("can't open file"));
}
#endif // debug
@@ -642,7 +644,7 @@ void ResourceCardDav::writingFinished() {
TQCString newpass;
if (KPasswordDialog::getPassword (newpass, TQString("<b>") + i18n("Remote authorization required") + TQString("</b><p>") + i18n("Please input the password for") + TQString(" ") + mPrefs->getusername(), NULL) != 1) {
log("write error: " + mWriter->errorString());
- addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString());
+ if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString());
}
else {
// Set new password and try again
@@ -652,12 +654,12 @@ void ResourceCardDav::writingFinished() {
}
else {
log("write error: " + mWriter->errorString());
- addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString());
+ if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString());
}
}
else {
log("write error: " + mWriter->errorString());
- addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString());
+ if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString());
}
} else {
log("success");