summaryrefslogtreecommitdiffstats
path: root/conduits/sysinfoconduit/sysinfo-conduit.cc
blob: 5ed758f16eadf56969ab525ba24b7ef6350a49c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
/* KPilot
**
** Copyright (C) 2003 by Reinhold Kainhofer
**
*/

/*
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program in a file called COPYING; if not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
** MA 02110-1301, USA.
*/

/*
** Bug reports and questions can be sent to [email protected].
*/

#include "options.h"

#include <pi-version.h>

#include <tqtimer.h>
#include <tqdir.h>
#include <tqfileinfo.h>
#include <tqregexp.h>
#include <kconfig.h>
#include <kdebug.h>

#include <pilotSysInfo.h>
#include <pilotUser.h>
#include <pilotCard.h>
#include <kpilotlink.h>
#include <kstandarddirs.h>
#include <pilotSerialDatabase.h>

#include <sys/utsname.h>

#include "sysinfo-factory.h"
#include "sysinfo-conduit.moc"
#include "sysinfoSettings.h"

const TQString SysInfoConduit::defaultpage = CSL1("KPilot System Information Page\n"
"==============================\n"
"(Kpilot was unable to find the correct template file, \n"
"so this simple template was used.)\n\n"
"<!--#ifhardware#\n"
"-) Hardware Information\n"
"     DeviceID:      #deviceid#\n"
"     Device name:   #devicename#\n"
"     Device model:  #devicemodel#\n"
"     Manufacturer:  #manufacturer#\n"
"     Connected via: #devicetype#\n"
"#endifhardware#-->\n"
"\n"
"<!--#ifuser#\n"
"-) User Information\n"
"     Handheld User Name: #username#\n"
"     Handheld Password:  #pw#\n"
"     Handheld User ID:   #uid#\n"
"     Viewer ID:          #viewerid#\n"
"#endifuser#-->\n"
"\n"
"<!--#ifmemory#\n"
"-) Memory Information\n"
"     ROM:       #rom# kB total\n"
"     Total RAM: #totalmem# kB total\n"
"     Free RAM:  #freemem# kB free\n"
"#endifmemory#-->\n"
"\n"
"<!--#ifstorage#\n"
"-) Storage Information\n"
"     Number of cards: #cards#\n"
"     Memory on cards: #storagemem#\n"
"#endifstorage#-->\n"
"\n"
"<!--#ifdblist#\n"
"-) List of Databases on Handheld\n"
"     Available Databases: #dblist(%1,)#\n"
"#endifdblist#-->\n"
"\n"
"<!--#ifrecords#\n"
"-) Number of addresses, to-dos, events, and memos\n"
"     Addresses: #addresses# entries in Addressbook\n"
"     Events:    #events# entries in Calendar\n"
"     To-dos:    #todos# entries in To-do list\n"
"     Memos:     #memos# memos\n"
"#endifrecords#-->\n"
"\n"
"<!--#ifsync#\n"
"-) Synchronization Information\n"
"     Last sync attempt:      #lastsync#\n"
"     Last successful sync:  #lastsuccsync#\n"
"     Last sync with PC (ID): #lastsyncpc#\n"
"#endifsync#-->\n"
"\n"
"<!--#ifpcversion#\n"
"-) Version Information (Desktop)\n"
"     Operating System:   #os#\n"
"     Hostname:           #hostname#\n"
"     TQt Version:         #qt#\n"
"     KDE Version:        #kde#\n"
"     KPilot Version:     #kpilot#\n"
"     Pilot-Link Version: #pilotlink#\n"
"#endifpcversion#-->\n"
"\n"
"<!--#ifpalmversion#\n"
"-) Version Information (Handheld)\n"
"     PalmOS: #palmos#\n"
"#endifpalmversion#-->\n"
"\n"
"<!--#ifdebug#\n"
"-) Debug Information\n"
"     #debug#\n"
"#endifdebug#-->\n"
"\n"
"------------------------------------------------------------\n"
"Page created <!--#date#--> by the KPilot System Information conduit.\n"
"");


	/** possible fields in the templates are:
	 *  - hardware
	 *  - user
	 *  - memory
	 *  - storage
	 *  - dblist
	 *  - recnumber
	 *  - syncinfo
	 *  - pcversion
	 *  - palmversion
	 *  - debug
	 */


// Something to allow us to check what revision
// the modules are that make up a binary distribution.

extern "C"
{

unsigned long version_conduit_sysinfo = Pilot::PLUGIN_API;

}



SysInfoConduit::SysInfoConduit(KPilotLink * o,
	const char *n,
	const TQStringList & a) :
	ConduitAction(o, n, a)
{
	FUNCTIONSETUP;
	fConduitName=i18n("System Information");
}



SysInfoConduit::~SysInfoConduit()
{
	FUNCTIONSETUP;
}



void SysInfoConduit::readConfig()
{
	fOutputFile = SysinfoSettings::outputFile();
	fOutputType = (eOutputTypeEnum) SysinfoSettings::outputFormat();
	fTemplateFile = SysinfoSettings::templateFile();
	fHardwareInfo = SysinfoSettings::hardwareInfo();
	fUserInfo = SysinfoSettings::userInfo();
	fMemoryInfo = SysinfoSettings::memoryInfo();
	fStorageInfo = SysinfoSettings::storageInfo();
	fDBList = SysinfoSettings::databaseList();
	fRecordNumber = SysinfoSettings::recordNumbers();
	fSyncInfo = SysinfoSettings::syncInfo();
	fKDEVersion = SysinfoSettings::kDEVersion();
	fPalmOSVersion = SysinfoSettings::palmOSVersion();
	fDebugInfo = SysinfoSettings::debugInformation();
}


/* virtual */ bool SysInfoConduit::exec()
{
	FUNCTIONSETUP;

	readConfig();

	TQTimer::singleShot(0, this, TQT_SLOT(hardwareInfo()));
	return true;
}

void SysInfoConduit::hardwareInfo()
{
	FUNCTIONSETUP;
	if (fHardwareInfo) {
		TQString unknown = i18n("unknown");

		/* Retrieve values for
		* - #deviceid#
		* - #devicename#
		* - #devicemodel#
		* - #manufactorer#
		* - #devicetype#
		*/
		KPilotSysInfo sysinfo = fHandle->getSysInfo();
		fValues[CSL1("deviceid")] = TQString::fromLatin1(sysinfo.getProductID());

		const KPilotCard *device = fHandle->getCardInfo();
		if (device)
		{
			fValues[CSL1("devicename")] = TQString::fromLatin1(device->getCardName());
			fValues[CSL1("devicemodel")] = unknown;  // TODO
			fValues[CSL1("manufacturer")] = TQString::fromLatin1(device->getCardManufacturer());
		}
		else
		{
			fValues[CSL1("devicename")] = unknown;
			fValues[CSL1("devicemodel")] = unknown;
			fValues[CSL1("manufacturer")] = unknown;
		}

		fValues[CSL1("devicetype")] = unknown;

		KPILOT_DELETE(device);
		keepParts.append(CSL1("hardware"));
	} else removeParts.append(CSL1("hardware"));
	TQTimer::singleShot(0, this, TQT_SLOT(userInfo()));
}

void SysInfoConduit::userInfo()
{
	FUNCTIONSETUP;
	if (fUserInfo)
	{
		/* Retrieve values for
		 * - #username#
		 * - #uid#
		 */
		KPilotUser user=fHandle->getPilotUser();
		fValues[CSL1("username")] = user.name();
		if (user.passwordLength()>0)
		{
			fValues[CSL1("pw")] = i18n("Password set");
		}
		else
		{
			fValues[CSL1("pw")] = i18n("No password set");
		}
		fValues[CSL1("uid")] = TQString::number(user.data()->userID);
		fValues[CSL1("viewerid")] = TQString::number(user.data()->viewerID);
		keepParts.append(CSL1("user"));
	}
	else
	{
		removeParts.append(CSL1("user"));
	}
	TQTimer::singleShot(0, this, TQT_SLOT(memoryInfo()));
}

void SysInfoConduit::memoryInfo()
{
	FUNCTIONSETUP;
	if (fMemoryInfo) {
		/* Retrieve values for
		 * - #rom#
		 * - #totalmem#
		 * - #freemem#
		 */
		const KPilotCard *device = fHandle->getCardInfo();
		if (device)
		{
			fValues[CSL1("rom")] =  TQString::number(device->getRomSize()/1024);
			fValues[CSL1("totalmem")] =  TQString::number(device->getRamSize()/1024);
			fValues[CSL1("freemem")] =  TQString::number(device->getRamFree()/1024);
		}
		keepParts.append(CSL1("memory"));
	} else removeParts.append(CSL1("memory"));
	TQTimer::singleShot(0, this, TQT_SLOT(storageInfo()));
}

void SysInfoConduit::storageInfo()
{
	FUNCTIONSETUP;
	if (fStorageInfo) {
		/* Retrieve values for
		 * - $cards$
		 */
		const KPilotCard *device = fHandle->getCardInfo(1);
		if (device) {
			fValues[CSL1("cards")] = CSL1("%1 (%2, %3 kB of %3 kB free)")
				.arg(TQString::fromLatin1(device->getCardName()))
				.arg(TQString::fromLatin1(device->getCardManufacturer()))
				.arg(device->getRamFree()/1024)
				.arg(device->getRamSize()/1024);
			KPILOT_DELETE(device);
		} else {
			fValues[CSL1("cards")] = i18n("No Cards available via pilot-link");
		}
		keepParts.append(CSL1("storage"));
	} else removeParts.append(CSL1("storage"));
	TQTimer::singleShot(0, this, TQT_SLOT(dbListInfo()));
}

void SysInfoConduit::dbListInfo()
{
	FUNCTIONSETUP;
	if (fDBList) {
		/* Retrieve values for
		 * - #dblist(structure)#
		 */
		dblist=deviceLink()->getDBList();
		keepParts.append(CSL1("dblist"));
	} else removeParts.append(CSL1("dblist"));
	TQTimer::singleShot(0, this, TQT_SLOT(recNumberInfo()));
}

void SysInfoConduit::recNumberInfo()
{
	FUNCTIONSETUP;
	if (fRecordNumber) {
		/* Retrieve values for
		 * - #addresses#
		 * - #events#
		 * - #todos#
		 * - #memos#
		 */
		PilotDatabase *fDatabase = 0L;
		TQString ERROR = CSL1("ERROR");
		fValues[CSL1("addresses")] = ERROR;
		fValues[CSL1("events")] = ERROR;
		fValues[CSL1("todos")] = ERROR;
		fValues[CSL1("memos")] = ERROR;
		fDatabase = deviceLink()->database(CSL1("AddressDB"));
		if (fDatabase) {
			fValues[CSL1("addresses")] = TQString::number(fDatabase->recordCount());
			KPILOT_DELETE(fDatabase);
		}
		fDatabase = deviceLink()->database(CSL1("DatebookDB"));
		if (fDatabase) {
			fValues[CSL1("events")] = TQString::number(fDatabase->recordCount());
			KPILOT_DELETE(fDatabase);
		}
		fDatabase = deviceLink()->database(CSL1("ToDoDB"));
		if (fDatabase) {
			fValues[CSL1("todos")] = TQString::number(fDatabase->recordCount());
			KPILOT_DELETE(fDatabase);
		}
		fDatabase = deviceLink()->database(CSL1("MemoDB"));
		if (fDatabase) {
			fValues[CSL1("memos")] = TQString::number(fDatabase->recordCount());
			KPILOT_DELETE(fDatabase);
		}
		keepParts.append(CSL1("records"));
	} else removeParts.append(CSL1("records"));
	TQTimer::singleShot(0, this, TQT_SLOT(syncInfo()));
}

void SysInfoConduit::syncInfo()
{
	FUNCTIONSETUP;
	if (fSyncInfo) {
		/* Retrieve values for
		 * - #lastsync#
		 * - #lastsuccsync#
		 * - #lastsyncpc#
		 */
		KPilotUser user = deviceLink()->getPilotUser();
		time_t lastsync = user.getLastSyncDate();
		TQDateTime qlastsync;
		qlastsync.setTime_t(lastsync);
		fValues[CSL1("lastsync")] = qlastsync.toString(Qt::LocalDate);
		lastsync = user.getLastSuccessfulSyncDate();
		qlastsync.setTime_t(lastsync);
		fValues[CSL1("lastsuccsync")] = qlastsync.toString(Qt::LocalDate);
		fValues[CSL1("lastsyncpc")] = TQString::number(user.getLastSyncPC());
		keepParts.append(CSL1("sync"));
	} else removeParts.append(CSL1("sync"));
	TQTimer::singleShot(0, this, TQT_SLOT(pcVersionInfo()));
}

void SysInfoConduit::pcVersionInfo()
{
	FUNCTIONSETUP;
	if (fKDEVersion) {
		/* Retrieve values for
		 * - #os#
		 * - #qt#
		 * - #kde#
		 * - #kpilot#
		 * - #pilotlink#
		 */
		fValues[CSL1("kpilot")] = TQString::fromLatin1(KPILOT_VERSION);
		fValues[CSL1("kde")] = i18n("unknown");
		fValues[CSL1("qt")] = i18n("unknown");
		fValues[CSL1("os")] = i18n("unknown");
		fValues[CSL1("hostname")] = i18n("unknown");
		struct utsname name;
		if (uname (&name) >= 0) {
			fValues[CSL1("os")] = CSL1("%1 %3, %5")
				.arg(TQString::fromLatin1(name.sysname))
				.arg(TQString::fromLatin1(name.release))
				.arg(TQString::fromLatin1(name.machine));
			fValues[CSL1("hostname")] = CSL1("%2").arg(TQString::fromLatin1(name.nodename));
		}
#ifdef TDE_VERSION_STRING
		fValues[CSL1("kde")] = TQString::fromLatin1(TDE_VERSION_STRING);
#endif
#ifdef TQT_VERSION_STR
		fValues[CSL1("qt")] = TQString::fromLatin1(TQT_VERSION_STR);
#endif
		fValues[CSL1("pilotlink")] = CSL1("%1.%2.%3%4")
			.arg(PILOT_LINK_VERSION)
			.arg(PILOT_LINK_MAJOR)
			.arg(PILOT_LINK_MINOR)
#ifdef PILOT_LINK_PATCH
			.arg(TQString::fromLatin1(PILOT_LINK_PATCH));
#else
			.arg(TQString());
#endif
		keepParts.append(CSL1("pcversion"));
	} else removeParts.append(CSL1("pcversion"));
	TQTimer::singleShot(0, this, TQT_SLOT(palmVersionInfo()));
}

void SysInfoConduit::palmVersionInfo()
{
	FUNCTIONSETUP;
	if (fPalmOSVersion) {
		/* Retrieve values for
		 * - #palmos#
		 */
/*		fValues["palmos"] = TQString("PalmOS %1.%2 (compat %3.%4)")
			.arg(fHandle->getSysInfo()->getMajorVersion())
			.arg(fHandle->getSysInfo()->getMinorVersion())
			.arg(fHandle->getSysInfo()->getCompatMajorVersion())
			.arg(fHandle->getSysInfo()->getCompatMinorVersion());*/
		KPilotSysInfo i = deviceLink()->getSysInfo();
		fValues[CSL1("palmos")] = CSL1("PalmOS %1.%2").arg(i.getMajorVersion()).arg(i.getMinorVersion());

		keepParts.append(CSL1("palmversion"));
	} else removeParts.append(CSL1("palmversion"));
	TQTimer::singleShot(0, this, TQT_SLOT(debugInfo()));
}

void SysInfoConduit::debugInfo()
{
	FUNCTIONSETUP;
	if (fDebugInfo) {
		/* Retrieve values for
		 * - #debug#
		 */
		fValues[CSL1("debug")] = i18n("No debug data");
		keepParts.append(CSL1("debug"));
	} else removeParts.append(CSL1("debug"));
	TQTimer::singleShot(0, this, TQT_SLOT(writeFile()));
}

void SysInfoConduit::writeFile()
{
	FUNCTIONSETUP;

	fValues[CSL1("date")] = TQDateTime::currentDateTime().toString(Qt::LocalDate);

	TQString output;
	// Open the template file
	TQString templatefile;
	switch(fOutputType)
	{
		case eOutputText:
			templatefile=locate("data", CSL1("kpilot/sysinfoconduit/Template.txt"));
			break;
		case eOutputTemplate:
			templatefile=fTemplateFile;
			break;
		case eOutputHTML:
		default:
			templatefile=locate("data", CSL1("kpilot/sysinfoconduit/Template.html"));
			break;
	}

	// Read in the template, close the file
	bool loaded=false;
	if (!templatefile.isEmpty()){
#ifdef DEBUG
		DEBUGKPILOT<<"Loading template file "<<templatefile<<endl;
#endif
		TQFile infile(templatefile);
		if (infile.open(IO_ReadOnly)) {
			TQTextStream instream(&infile);
			output = instream.read();
			infile.close();
			loaded=true;
		}
	}

	if (!loaded)
	{
		WARNINGKPILOT << "Loading template file " << templatefile
			<<" failed. Using default template instead." << endl;
		output=defaultpage;
	}

	// Remove all parts not extracted
	for ( TQStringList::Iterator it = removeParts.begin(); it != removeParts.end(); ++it ) {
		TQRegExp re(CSL1("<!--#if%1#.*#endif%1#-->").arg(*it).arg(*it));
		re.setMinimal(true);
		output.remove(re);
	}
	for ( TQStringList::Iterator it = keepParts.begin(); it != keepParts.end(); ++it ) {
		TQRegExp re(CSL1("<!--#if%1#(.*)#endif%1#-->").arg(*it).arg(*it));
		re.setMinimal(true);
		output.replace(re, CSL1("\\1"));
	}

	// Do a loop through all keys in fValues
	TQMap<TQString,TQString>::Iterator it;
	for ( it = fValues.begin(); it != fValues.end(); ++it ) {
		output.replace(CSL1("#%1#").arg(it.key()), it.data());
	}

	// Insert the list of databases
	TQRegExp re(CSL1("#dblist\\[(.*)\\]#"));
	re.setMinimal(true);
	while (re.search(output)>=0){
		TQString dbstring;
		TQString subpatt=re.cap(1);
		for (KPilotLink::DBInfoList::ConstIterator i = dblist.begin(); i != dblist.end(); ++i ) {
			DBInfo dbi = *i;
			TQString newpatt(subpatt);
			char tmpchr[5];
			::memset(&tmpchr[0], 0, 5);
			/* Patterns for the dblist argument:
			 * %0 .. Database name
			 * %1 .. type
			 * %2 .. creator
			 * %3 .. index
			 * %4 .. flags
			 * %5 .. miscFlags
			 * %6 .. version
			 * %7 .. createDate
			 * %8 .. modifyDate
			 * %9 .. backupDate
			 */
			newpatt.replace(CSL1("%0"), TQString::fromLatin1(dbi.name));
			set_long(&tmpchr[0],dbi.type);
			newpatt.replace(CSL1("%1"), TQString::fromLatin1(tmpchr));
			set_long(&tmpchr[0],dbi.creator);
			newpatt.replace(CSL1("%2"), TQString::fromLatin1(tmpchr));
			newpatt.replace(CSL1("%3"), TQString::number(dbi.index));
			newpatt.replace(CSL1("%4"), TQString::number(dbi.flags));
			newpatt.replace(CSL1("%5"), TQString::number(dbi.miscFlags));
			newpatt.replace(CSL1("%6"), TQString::number(dbi.version));
			TQDateTime tm;
			tm.setTime_t(dbi.createDate);
			newpatt.replace(CSL1("%7"), tm.toString(Qt::LocalDate));
			tm.setTime_t(dbi.modifyDate);
			newpatt.replace(CSL1("%8"), tm.toString(Qt::LocalDate));
			tm.setTime_t(dbi.backupDate);
			newpatt.replace(CSL1("%9"), tm.toString(Qt::LocalDate));

			dbstring.append(newpatt);
		}
		// Now, just replace the whole found pattern by the string we just constructed.
		output.replace(re.cap(0), dbstring);
	}

	// Write out the result
	TQFile outfile(fOutputFile);
#ifdef DEBUG
	DEBUGKPILOT << fname << ": Writing file <" << fOutputFile << ">" << endl;
#endif
	if (fOutputFile.isEmpty() || (!outfile.open(IO_WriteOnly)) ) {
		TQFileInfo fi(TQDir::home(), CSL1("KPilotSysInfo.")+TQFileInfo(templatefile).extension() );
		fOutputFile=fi.absFilePath();
		WARNINGKPILOT << "Unable to open output file, using " << fOutputFile << " instead." << endl;
		emit logMessage(i18n("Unable to open output file, using %1 instead.").arg(fOutputFile));
		outfile.setName(fOutputFile);
		if (!outfile.open(IO_WriteOnly)) {
			WARNINGKPILOT<< "Unable to open " << fOutputFile << endl;
			emit logError(i18n("Unable to open %1").arg(fOutputFile));
			TQTimer::singleShot(0, this, TQT_SLOT(cleanup()));
			return;
		}
	}

	// Finally, write the actual text out to the file.
	TQTextStream outstream(&outfile);
	outstream<<output;
	outfile.close();

	emit logMessage(i18n("Handheld system information written to the file %1").arg(fOutputFile));
	TQTimer::singleShot(0, this, TQT_SLOT(cleanup()));
}

void SysInfoConduit::cleanup()
{
	FUNCTIONSETUP;
	// Nothing to clean up so far (Do I have memory leaks somewhere?)
	emit syncDone(this);
}