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

List:       kde-commits
Subject:    branches/work/kdepim-3.5.5+/kpilot/conduits/memofileconduit
From:       Adriaan de Groot <groot () kde ! org>
Date:       2007-03-27 22:01:04
Message-ID: 1175032864.991702.11122.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 647300 by adridg:

Simplify, simplify: no need to do AppInfo packing ourselves (although this is \
slightly less efficient since the packing is done twice, it's easier to read); \
setCategoryName truncates as needed; remove spuriously declared getCategoryName.

 M  +7 -29     branches/work/kdepim-3.5.5+/kpilot/conduits/memofileconduit/memofile-conduit.cc \
  M  +0 -2      branches/work/kdepim-3.5.5+/kpilot/conduits/memofileconduit/memofile-conduit.h \



--- branches/work/kdepim-3.5.5+/kpilot/conduits/memofileconduit/memofile-conduit.cc \
#647299:647300 @@ -172,44 +172,22 @@
 	for (unsigned int i = 0; i < Pilot::CATEGORY_COUNT; i++)
 	{
 		if (fCategories.contains(i)) {
-			QString name = fCategories[i].left(16);
-			fMemoAppInfo->setCategoryName(i,name);
-
-			DEBUGKPILOT << fname
-				<< ": setting category: [" << i
-				<< "] to name: ["
-				<< name << "]" << endl;
+			fMemoAppInfo->setCategoryName(i,fCategories[i]);
 		}
 	}
 
-	int appLen = 0;
-	unsigned char *buffer = doPackAppInfo( &appLen );
-	if ( buffer )
+	if (fDatabase)
 	{
-		if (fDatabase)
-		{
-			fDatabase->writeAppBlock( buffer, appLen );
-		}
-		if (fLocalDatabase)
-		{
-			fLocalDatabase->writeAppBlock( buffer, appLen );
-		}
-		delete[] buffer;
+		fMemoAppInfo->writeTo(fDatabase);
 	}
+	if (fLocalDatabase)
+	{
+		fMemoAppInfo->writeTo(fLocalDatabase);
+	}
 
 	return true;
 }
 
-unsigned char *MemofileConduit::doPackAppInfo( int *appLen )
-{
-	int appLength = pack_MemoAppInfo(fMemoAppInfo->info(), 0, 0);
-	unsigned char *buffer = new unsigned char[appLength];
-	pack_MemoAppInfo(fMemoAppInfo->info(), buffer, appLength);
-	if ( appLen ) *appLen = appLength;
-	return buffer;
-}
-
-
 bool MemofileConduit::getAppInfo()
 {
 	FUNCTIONSETUP;
--- branches/work/kdepim-3.5.5+/kpilot/conduits/memofileconduit/memofile-conduit.h \
#647299:647300 @@ -75,8 +75,6 @@
 	bool	readConfig();
 	bool	getAppInfo();
 	bool	setAppInfo();
-	unsigned char *doPackAppInfo( int *appLen );
-	QString	getCategoryName(int category);
 
 	bool	initializeFromPilot();
 	bool	loadPilotCategories();


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

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