[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kdepim-3.5.5+/kpilot/conduits/abbrowserconduit
From:       Jason vanRijn Kasper <vR () movingparts ! net>
Date:       2007-04-04 21:56:22
Message-ID: 1175723782.484739.23039.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 650587 by vanrijn:

trying to remove resource from addressbook before we delete it...

 M  +14 -3     branches/work/kdepim-3.5.5+/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc  
 M  +5 -0      branches/work/kdepim-3.5.5+/kpilot/conduits/abbrowserconduit/abbrowser-conduit.h  


--- branches/work/kdepim-3.5.5+/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc #650586:650587
@@ -122,7 +122,8 @@
 		addresseeMap(),
 		syncedIds(),
 		abiter(),
-		fTicket(0L)
+		fTicket(0L),
+		fBookResource(0L)
 {
 	FUNCTIONSETUP;
 	fConduitName=i18n("Addressbook");
@@ -308,9 +309,9 @@
 				stopTickle();
 				return false;
 			}
-			KABC::Resource *res = new ResourceFile(fABookFile, CSL1("vcard") );
+			fBookResource = new ResourceFile(fABookFile, CSL1("vcard") );
 
-			bool r = aBook->addResource( res );
+			bool r = aBook->addResource( fBookResource );
 			if ( !r )
 			{
 				DEBUGKPILOT << "Unable to open resource for file " << fABookFile << endl;
@@ -406,6 +407,16 @@
 
 	}
 
+	// now try to remove the resource from the addressbook...
+	if (fBookResource) 
+	{
+		bool r = aBook->removeResource( fBookResource );
+		if ( !r )
+		{
+			DEBUGKPILOT << fname <<": Unable to close resource." << endl;
+		}
+	}
+
 	return saveSuccessful;
 }
 
--- branches/work/kdepim-3.5.5+/kpilot/conduits/abbrowserconduit/abbrowser-conduit.h #650586:650587
@@ -209,6 +209,11 @@
 	*/
 	Ticket *fTicket;
 
+	/** if we add a resource from the addressbook, track it to remove it
+	 *  later...
+	 */
+	KABC::Resource *fBookResource;
+
 } ;
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic