From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpilot/conduits/docconduit/doc-conduit.cc | 156 +++++++++++++++--------------- 1 file changed, 78 insertions(+), 78 deletions(-) (limited to 'kpilot/conduits/docconduit/doc-conduit.cc') 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 -#include +#include +#include #include #include @@ -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 "<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<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 " <dbPathName()<<" (" <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)) -- cgit v1.2.3