summaryrefslogtreecommitdiffstats
path: root/kpilot/conduits/docconduit/doc-conduit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'kpilot/conduits/docconduit/doc-conduit.cc')
-rw-r--r--kpilot/conduits/docconduit/doc-conduit.cc156
1 files changed, 78 insertions, 78 deletions
diff --git a/kpilot/conduits/docconduit/doc-conduit.cc b/kpilot/conduits/docconduit/doc-conduit.cc
index eee36080..fbaa22f5 100644
--- a/kpilot/conduits/docconduit/doc-conduit.cc
+++ b/kpilot/conduits/docconduit/doc-conduit.cc
@@ -36,8 +36,8 @@
#include "options.h"
#include "doc-conduit.moc"
-#include <qtimer.h>
-#include <qdir.h>
+#include <tqtimer.h>
+#include <tqdir.h>
#include <kconfig.h>
#include <kmdcodec.h>
@@ -59,7 +59,7 @@ extern "C"
unsigned long version_conduit_doc = Pilot::PLUGIN_API;
}
-QString dirToString(eSyncDirectionEnum dir) {
+TQString dirToString(eSyncDirectionEnum dir) {
switch(dir) {
// case eSyncAll: return "eSyncAll";
case eSyncPDAToPC: return CSL1("eSyncPDAToPC");
@@ -78,7 +78,7 @@ QString dirToString(eSyncDirectionEnum dir) {
DOCConduit::DOCConduit(KPilotLink * o,
- const char *n, const QStringList & a):ConduitAction(o, n, a)
+ const char *n, const TQStringList & a):ConduitAction(o, n, a)
{
FUNCTIONSETUP;
fConduitName=i18n("DOC");
@@ -145,13 +145,13 @@ void DOCConduit::readConfig()
-bool DOCConduit::pcTextChanged(QString txtfn)
+bool DOCConduit::pcTextChanged(TQString txtfn)
{
FUNCTIONSETUP;
// How do I find out if a text file has changed shince we last synced it??
// Use KMD5 for now. If I realize it is too slow, then I have to go back to comparing modification times
// if there is no config setting yet, assume the file has been changed. the md5 sum will be written to the config file after the sync.
- QString oldDigest=DOCConduitSettings::self()->config()->readEntry(txtfn);
+ TQString oldDigest=DOCConduitSettings::self()->config()->readEntry(txtfn);
if (oldDigest.length()<=0)
{
return true;
@@ -161,10 +161,10 @@ bool DOCConduit::pcTextChanged(QString txtfn)
#endif
KMD5 docmd5;
- QFile txtfile(txtfn);
+ TQFile txtfile(txtfn);
if (txtfile.open(IO_ReadOnly)){
docmd5.update(txtfile);
- QString thisDigest(docmd5.hexDigest() /* .data() */);
+ TQString thisDigest(docmd5.hexDigest() /* .data() */);
#ifdef DEBUG
DEBUGKPILOT<<"New digest is "<<thisDigest<<endl;
#endif
@@ -233,19 +233,19 @@ bool DOCConduit::hhTextChanged(PilotDatabase*docdb)
* Helper functions
********************************************************************/
-QString DOCConduit::constructPDBFileName(QString name) {
+TQString DOCConduit::constructPDBFileName(TQString name) {
FUNCTIONSETUP;
- QString fn;
- QDir dr(DOCConduitSettings::pDBDirectory());
- QFileInfo pth(dr, name);
+ TQString fn;
+ TQDir dr(DOCConduitSettings::pDBDirectory());
+ TQFileInfo pth(dr, name);
if (!name.isEmpty()) fn=pth.absFilePath()+CSL1(".pdb");
return fn;
}
-QString DOCConduit::constructTXTFileName(QString name) {
+TQString DOCConduit::constructTXTFileName(TQString name) {
FUNCTIONSETUP;
- QString fn;
- QDir dr( DOCConduitSettings::tXTDirectory() );
- QFileInfo pth(dr, name);
+ TQString fn;
+ TQDir dr( DOCConduitSettings::tXTDirectory() );
+ TQFileInfo pth(dr, name);
if (!name.isEmpty()) fn=pth.absFilePath()+CSL1(".txt");
return fn;
}
@@ -271,7 +271,7 @@ QString DOCConduit::constructTXTFileName(QString name) {
emit logMessage(i18n("Searching for texts and databases to synchronize"));
- QTimer::singleShot(0, this, SLOT(syncNextDB()));
+ TQTimer::singleShot(0, this, TQT_SLOT(syncNextDB()));
return true;
}
@@ -284,15 +284,15 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
if (sinfo.direction==eSyncDelete) {
if (!sinfo.txtfilename.isEmpty()) {
- if (!QFile::remove(sinfo.txtfilename)) {
+ if (!TQFile::remove(sinfo.txtfilename)) {
WARNINGKPILOT << "Unable to delete the text file " << sinfo.txtfilename << " on the PC" << endl;
}
- QString bmkfilename = sinfo.txtfilename;
+ TQString bmkfilename = sinfo.txtfilename;
if (bmkfilename.endsWith(CSL1(".txt"))){
bmkfilename.remove(bmkfilename.length()-4, 4);
}
bmkfilename+=CSL1(PDBBMK_SUFFIX);
- if (!QFile::remove(bmkfilename)) {
+ if (!TQFile::remove(bmkfilename)) {
#ifdef DEBUG
DEBUGKPILOT<<"Could not remove bookmarks file "<<bmkfilename<<" for database "<<sinfo.handheldDB<<endl;
#endif
@@ -300,7 +300,7 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
}
if (!sinfo.pdbfilename.isEmpty() && DOCConduitSettings::keepPDBsLocally() ) {
PilotLocalDatabase*database=new PilotLocalDatabase(DOCConduitSettings::pDBDirectory(),
- QString::fromLatin1(sinfo.dbinfo.name), false);
+ TQString::fromLatin1(sinfo.dbinfo.name), false);
if (database) {
if ( database->deleteDatabase() !=0 ) {
WARNINGKPILOT << "Unable to delete database " << sinfo.dbinfo.name << " on the PC" << endl;
@@ -336,8 +336,8 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
if (database && database->isOpen()) {
DOCConverter docconverter;
- connect(&docconverter, SIGNAL(logError(const QString &)), SIGNAL(logError(const QString &)));
- connect(&docconverter, SIGNAL(logMessage(const QString &)), SIGNAL(logMessage(const QString &)));
+ connect(&docconverter, TQT_SIGNAL(logError(const TQString &)), TQT_SIGNAL(logError(const TQString &)));
+ connect(&docconverter, TQT_SIGNAL(logMessage(const TQString &)), TQT_SIGNAL(logMessage(const TQString &)));
docconverter.setTXTpath( DOCConduitSettings::tXTDirectory(), sinfo.txtfilename );
docconverter.setPDB(database);
@@ -360,10 +360,10 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
if (res)
{
KMD5 docmd5;
- QFile txtfile(docconverter.txtFilename());
+ TQFile txtfile(docconverter.txtFilename());
if (txtfile.open(IO_ReadOnly)) {
docmd5.update(txtfile);
- QString thisDigest(docmd5.hexDigest() /* .data() */);
+ TQString thisDigest(docmd5.hexDigest() /* .data() */);
DOCConduitSettings::self()->config()->writeEntry(docconverter.txtFilename(), thisDigest);
DOCConduitSettings::self()->config()->sync();
#ifdef DEBUG
@@ -378,18 +378,18 @@ bool DOCConduit::doSync(docSyncInfo &sinfo)
if (!postSyncAction(database, sinfo, res))
emit logError(i18n("Unable to install the locally created PalmDOC %1 to the handheld.")
- .arg(QString::fromLatin1(sinfo.dbinfo.name)));
+ .arg(TQString::fromLatin1(sinfo.dbinfo.name)));
if (!res)
emit logError(i18n("Conversion of PalmDOC \"%1\" failed.")
- .arg(QString::fromLatin1(sinfo.dbinfo.name)));
-// disconnect(&docconverter, SIGNAL(logError(const QString &)), SIGNAL(logError(const QString &)));
-// disconnect(&docconverter, SIGNAL(logMessage(const QString &)), SIGNAL(logMessage(const QString &)));
+ .arg(TQString::fromLatin1(sinfo.dbinfo.name)));
+// disconnect(&docconverter, TQT_SIGNAL(logError(const TQString &)), TQT_SIGNAL(logError(const TQString &)));
+// disconnect(&docconverter, TQT_SIGNAL(logMessage(const TQString &)), TQT_SIGNAL(logMessage(const TQString &)));
// KPILOT_DELETE(database);
}
else
{
emit logError(i18n("Unable to open or create the database %1.")
- .arg(QString::fromLatin1(sinfo.dbinfo.name)));
+ .arg(TQString::fromLatin1(sinfo.dbinfo.name)));
}
return res;
}
@@ -404,7 +404,7 @@ void DOCConduit::syncNextDB() {
if (eSyncDirection==eSyncPCToPDA || fHandle->findDatabase(NULL, &dbinfo, dbnr, dbtype(), dbcreator() /*, cardno */ ) < 0)
{
// no more databases available, so check for PC->Palm sync
- QTimer::singleShot(0, this, SLOT(syncNextTXT()));
+ TQTimer::singleShot(0, this, TQT_SLOT(syncNextTXT()));
return;
}
dbnr=dbinfo.index+1;
@@ -414,23 +414,23 @@ void DOCConduit::syncNextDB() {
// if creator and/or type don't match, go to next db
if (!isCorrectDBTypeCreator(dbinfo) ||
- fDBNames.contains(QString::fromLatin1(dbinfo.name)))
+ fDBNames.contains(TQString::fromLatin1(dbinfo.name)))
{
- QTimer::singleShot(0, this, SLOT(syncNextDB()));
+ TQTimer::singleShot(0, this, TQT_SLOT(syncNextDB()));
return;
}
- QString txtfilename=constructTXTFileName(QString::fromLatin1(dbinfo.name));
- QString pdbfilename=constructPDBFileName(QString::fromLatin1(dbinfo.name));
+ TQString txtfilename=constructTXTFileName(TQString::fromLatin1(dbinfo.name));
+ TQString pdbfilename=constructPDBFileName(TQString::fromLatin1(dbinfo.name));
- docSyncInfo syncInfo(QString::fromLatin1(dbinfo.name),
+ docSyncInfo syncInfo(TQString::fromLatin1(dbinfo.name),
txtfilename, pdbfilename, eSyncNone);
syncInfo.dbinfo=dbinfo;
needsSync(syncInfo);
fSyncInfoList.append(syncInfo);
- fDBNames.append(QString::fromLatin1(dbinfo.name));
+ fDBNames.append(TQString::fromLatin1(dbinfo.name));
- QTimer::singleShot(0, this, SLOT(syncNextDB()));
+ TQTimer::singleShot(0, this, TQT_SLOT(syncNextDB()));
return;
}
@@ -444,28 +444,28 @@ void DOCConduit::syncNextTXT()
{
// We don't sync from PC to PDB, so start the conflict resolution and then the actual sync process
docnames.clear();
- QTimer::singleShot(0, this, SLOT(checkPDBFiles()));
+ TQTimer::singleShot(0, this, TQT_SLOT(checkPDBFiles()));
return;
}
// if docnames isn't initialized, get a list of all *.txt files in DOCConduitSettings::tXTDirectory()
if (docnames.isEmpty()/* || dociterator==docnames.end() */) {
- docnames=QDir( DOCConduitSettings::tXTDirectory(), CSL1("*.txt")).entryList() ;
+ docnames=TQDir( DOCConduitSettings::tXTDirectory(), CSL1("*.txt")).entryList() ;
dociterator=docnames.begin();
}
if (dociterator==docnames.end()) {
// no more databases available, so start the conflict resolution and then the actual sync proces
docnames.clear();
- QTimer::singleShot(0, this, SLOT(checkPDBFiles()));
+ TQTimer::singleShot(0, this, TQT_SLOT(checkPDBFiles()));
return;
}
- QString fn=(*dociterator);
+ TQString fn=(*dociterator);
- QDir dr( DOCConduitSettings::tXTDirectory() );
- QFileInfo fl(dr, fn );
- QString txtfilename=fl.absFilePath();
- QString pdbfilename;
+ TQDir dr( DOCConduitSettings::tXTDirectory() );
+ TQFileInfo fl(dr, fn );
+ TQString txtfilename=fl.absFilePath();
+ TQString pdbfilename;
++dociterator;
DBInfo dbinfo;
@@ -476,19 +476,19 @@ void DOCConduit::syncNextTXT()
bool alreadySynced=fDBNames.contains(fl.baseName(TRUE));
if (!alreadySynced) {
- docSyncInfo syncInfo(QString::fromLatin1(dbinfo.name),
+ docSyncInfo syncInfo(TQString::fromLatin1(dbinfo.name),
txtfilename, pdbfilename, eSyncNone);
syncInfo.dbinfo=dbinfo;
needsSync(syncInfo);
fSyncInfoList.append(syncInfo);
- fDBNames.append(QString::fromLatin1(dbinfo.name));
+ fDBNames.append(TQString::fromLatin1(dbinfo.name));
} else {
#ifdef DEBUG
DEBUGKPILOT<<txtfilename<<" has already been synced, skipping it."<<endl;
#endif
}
- QTimer::singleShot(0, this, SLOT(syncNextTXT()));
+ TQTimer::singleShot(0, this, TQT_SLOT(syncNextTXT()));
return;
}
@@ -502,33 +502,33 @@ void DOCConduit::checkPDBFiles() {
if ( DOCConduitSettings::localSync() || !DOCConduitSettings::keepPDBsLocally() || eSyncDirection==eSyncPCToPDA )
{
// no more databases available, so check for PC->Palm sync
- QTimer::singleShot(0, this, SLOT(checkDeletedDocs()));
+ TQTimer::singleShot(0, this, TQT_SLOT(checkDeletedDocs()));
return;
}
// Walk through all files in the pdb directory and check if it has already been synced.
// if docnames isn't initialized, get a list of all *.pdb files in DOCConduitSettings::pDBDirectory()
if (docnames.isEmpty()/* || dociterator==docnames.end() */) {
- docnames=QDir(DOCConduitSettings::pDBDirectory(), CSL1("*.pdb")).entryList() ;
+ docnames=TQDir(DOCConduitSettings::pDBDirectory(), CSL1("*.pdb")).entryList() ;
dociterator=docnames.begin();
}
if (dociterator==docnames.end()) {
// no more databases available, so start the conflict resolution and then the actual sync proces
docnames.clear();
- QTimer::singleShot(0, this, SLOT(checkDeletedDocs()));
+ TQTimer::singleShot(0, this, TQT_SLOT(checkDeletedDocs()));
return;
}
- QString fn=(*dociterator);
+ TQString fn=(*dociterator);
- QDir dr(DOCConduitSettings::pDBDirectory());
- QFileInfo fl(dr, fn );
- QString pdbfilename=fl.absFilePath();
+ TQDir dr(DOCConduitSettings::pDBDirectory());
+ TQFileInfo fl(dr, fn );
+ TQString pdbfilename=fl.absFilePath();
++dociterator;
// Get the doc title and check if it has already been synced (in the synced docs list of in fDBNames to be synced)
// If the doc title doesn't appear in either list, install it to the Handheld, and add it to the list of dbs to be synced.
- QString dbname=fl.baseName(TRUE).left(30);
+ TQString dbname=fl.baseName(TRUE).left(30);
if (!fDBNames.contains(dbname) && !fDBListSynced.contains(dbname)) {
if (fHandle->installFiles(pdbfilename, false)) {
DBInfo dbinfo;
@@ -549,7 +549,7 @@ void DOCConduit::checkPDBFiles() {
}
}
- QTimer::singleShot(0, this, SLOT(checkPDBFiles()));
+ TQTimer::singleShot(0, this, TQT_SLOT(checkPDBFiles()));
}
@@ -558,12 +558,12 @@ void DOCConduit::checkDeletedDocs()
{
FUNCTIONSETUP;
- for (QStringList::Iterator it=fDBListSynced.begin(); it!=fDBListSynced.end(); ++it ) {
+ for (TQStringList::Iterator it=fDBListSynced.begin(); it!=fDBListSynced.end(); ++it ) {
if (!fDBNames.contains(*it)) {
// We need to delete this doc:
- QString dbname(*it);
- QString txtfilename=constructTXTFileName(dbname);
- QString pdbfilename=constructPDBFileName(dbname);
+ TQString dbname(*it);
+ TQString txtfilename=constructTXTFileName(dbname);
+ TQString pdbfilename=constructPDBFileName(dbname);
docSyncInfo syncInfo(dbname, txtfilename, pdbfilename, eSyncDelete);
DBInfo dbinfo;
@@ -574,7 +574,7 @@ void DOCConduit::checkDeletedDocs()
fSyncInfoList.append(syncInfo);
}
}
- QTimer::singleShot(0, this, SLOT(resolve()));
+ TQTimer::singleShot(0, this, TQT_SLOT(resolve()));
return;
}
@@ -628,7 +628,7 @@ void DOCConduit::resolve() {
if (!dlg || !dlg->exec() ) {
KPILOT_DELETE(dlg)
emit logMessage(i18n("Sync aborted by user."));
- QTimer::singleShot(0, this, SLOT(cleanup()));
+ TQTimer::singleShot(0, this, TQT_SLOT(cleanup()));
return;
}
}
@@ -638,7 +638,7 @@ void DOCConduit::resolve() {
// fDBNames will be filled with the names of the databases that are actually synced (not deleted), so I can write the list to the config file
fDBNames.clear();
fSyncInfoListIterator=fSyncInfoList.begin();
- QTimer::singleShot(0,this, SLOT(syncDatabases()));
+ TQTimer::singleShot(0,this, TQT_SLOT(syncDatabases()));
return;
}
@@ -648,7 +648,7 @@ void DOCConduit::syncDatabases() {
FUNCTIONSETUP;
if (fSyncInfoListIterator==fSyncInfoList.end()) {
// We're done, so clean up
- QTimer::singleShot(0, this, SLOT(cleanup()));
+ TQTimer::singleShot(0, this, TQT_SLOT(cleanup()));
return;
}
@@ -679,12 +679,12 @@ void DOCConduit::syncDatabases() {
}
if (sinfo.direction != eSyncDelete) fDBNames.append(sinfo.handheldDB);
- QTimer::singleShot(0,this, SLOT(syncDatabases()));
+ TQTimer::singleShot(0,this, TQT_SLOT(syncDatabases()));
return;
}
-PilotDatabase*DOCConduit::openDOCDatabase(const QString &dbname) {
+PilotDatabase*DOCConduit::openDOCDatabase(const TQString &dbname) {
if (DOCConduitSettings::localSync())
{
return new PilotLocalDatabase(DOCConduitSettings::pDBDirectory(), dbname, false);
@@ -701,7 +701,7 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
FUNCTIONSETUP;
sinfo.direction = eSyncNone;
- PilotDatabase*docdb=openDOCDatabase(QString::fromLatin1(sinfo.dbinfo.name));
+ PilotDatabase*docdb=openDOCDatabase(TQString::fromLatin1(sinfo.dbinfo.name));
if (!fDBListSynced.contains(sinfo.handheldDB)) {
// the database wasn't included on last sync, so it has to be new.
#ifdef DEBUG
@@ -716,7 +716,7 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
N N | C P H
*/
- if (QFile::exists(sinfo.txtfilename)) sinfo.fPCStatus=eStatNew;
+ if (TQFile::exists(sinfo.txtfilename)) sinfo.fPCStatus=eStatNew;
else sinfo.fPCStatus=eStatDoesntExist;
if (docdb && docdb->isOpen()) sinfo.fPalmStatus=eStatNew;
else sinfo.fPalmStatus=eStatDoesntExist;
@@ -756,7 +756,7 @@ bool DOCConduit::needsSync(docSyncInfo &sinfo)
}
// Text was included in the last sync
- if (!QFile::exists(sinfo.txtfilename)) sinfo.fPCStatus=eStatDeleted;
+ if (!TQFile::exists(sinfo.txtfilename)) sinfo.fPCStatus=eStatDeleted;
else if(pcTextChanged(sinfo.txtfilename)) {
sinfo.fPCStatus=eStatChanged;
#ifdef DEBUG
@@ -871,7 +871,7 @@ PilotDatabase *DOCConduit::preSyncAction(docSyncInfo &sinfo) const
{
// make sure the dir for the local texts really exists!
- QDir dir( DOCConduitSettings::tXTDirectory() );
+ TQDir dir( DOCConduitSettings::tXTDirectory() );
if (!dir.exists())
{
dir.mkdir(dir.absPath());
@@ -885,7 +885,7 @@ PilotDatabase *DOCConduit::preSyncAction(docSyncInfo &sinfo) const
if (DOCConduitSettings::keepPDBsLocally())
{
// make sure the dir for the local db really exists!
- QDir dir(DOCConduitSettings::pDBDirectory());
+ TQDir dir(DOCConduitSettings::pDBDirectory());
if (!dir.exists())
{
@@ -909,7 +909,7 @@ PilotDatabase *DOCConduit::preSyncAction(docSyncInfo &sinfo) const
if (DOCConduitSettings::keepPDBsLocally())
{
// make sure the dir for the local db really exists!
- QDir dir(DOCConduitSettings::pDBDirectory());
+ TQDir dir(DOCConduitSettings::pDBDirectory());
if (!dir.exists())
{
dir.mkdir(dir.absPath());
@@ -922,11 +922,11 @@ PilotDatabase *DOCConduit::preSyncAction(docSyncInfo &sinfo) const
if (DOCConduitSettings::keepPDBsLocally())
{
return new PilotLocalDatabase(DOCConduitSettings::pDBDirectory(),
- QString::fromLatin1(dbinfo.name), false);
+ TQString::fromLatin1(dbinfo.name), false);
}
else
{
- return deviceLink()->database(QString::fromLatin1(dbinfo.name));
+ return deviceLink()->database(TQString::fromLatin1(dbinfo.name));
}
}
@@ -950,7 +950,7 @@ bool DOCConduit::postSyncAction(PilotDatabase * database,
if (DOCConduitSettings::keepPDBsLocally() && !DOCConduitSettings::localSync())
{
PilotDatabase*db=deviceLink()->database(
- QString::fromLatin1(sinfo.dbinfo.name));
+ TQString::fromLatin1(sinfo.dbinfo.name));
#ifdef DEBUG
DEBUGKPILOT<<"Middle 1 Resetting sync flags for database "
<<sinfo.dbinfo.name<<endl;
@@ -977,7 +977,7 @@ bool DOCConduit::postSyncAction(PilotDatabase * database,
DEBUGKPILOT<<"Installing file "<<localdb->dbPathName()<<" ("
<<sinfo.handheldDB<<") to the handheld"<<endl;
#endif
- QString dbpathname=localdb->dbPathName();
+ TQString dbpathname=localdb->dbPathName();
// This deletes localdb as well, which is just a cast from database
KPILOT_DELETE(database);
if (!fHandle->installFiles(dbpathname, false))