diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kpilot/kpilot/hotSync.cc | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpilot/kpilot/hotSync.cc')
-rw-r--r-- | kpilot/kpilot/hotSync.cc | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/kpilot/kpilot/hotSync.cc b/kpilot/kpilot/hotSync.cc index 60bb9356..7a4d3e44 100644 --- a/kpilot/kpilot/hotSync.cc +++ b/kpilot/kpilot/hotSync.cc @@ -41,14 +41,14 @@ #include <pi-file.h> #include <pi-util.h> -#include <qtimer.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qvaluelist.h> -#include <qregexp.h> -#include <qstringlist.h> -#include <qthread.h> +#include <tqtimer.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqdir.h> +#include <tqvaluelist.h> +#include <tqregexp.h> +#include <tqstringlist.h> +#include <tqthread.h> #include <kglobal.h> #include <kstandarddirs.h> @@ -70,11 +70,11 @@ class BackupAction::Thread : public QThread public: Thread( BackupAction *parent, KPilotLink *link, - const QString &filename, + const TQString &filename, const DBInfo *info ); enum { - TerminateOK = QEvent::User, + TerminateOK = TQEvent::User, TerminateFailure } ; @@ -83,7 +83,7 @@ protected: private: BackupAction *fParent; KPilotLink *fLink; - QString fFilename; + TQString fFilename; struct DBInfo fDBInfo; } ; @@ -91,16 +91,16 @@ class BackupAction::Private { public: bool fFullBackup; ///< Is this a full backup (all DBs, not just changed ones)? - QStringList fNoBackupDBs; - QValueList<unsigned long> fNoBackupCreators; - QStringList fDeviceDBs; + TQStringList fNoBackupDBs; + TQValueList<unsigned long> fNoBackupCreators; + TQStringList fDeviceDBs; - QString fPreferBackupDir; ///< Directory to write backup in, overrides default + TQString fPreferBackupDir; ///< Directory to write backup in, overrides default // Remainder is used to hand around info during sync int fDBIndex; ///< Database number we're now doing - QString fBackupDir; ///< Directory to write backup in. + TQString fBackupDir; ///< Directory to write backup in. /** * Add the database described by the info block to the list of @@ -117,9 +117,9 @@ public: set_long( &buff[1], info->creator ); buff[5] = ']'; buff[6] = '\0'; - QString creator = QString::fromLatin1( buff ); + TQString creator = TQString::fromLatin1( buff ); - QString dbname = Pilot::fromPilot( info->name, 32 ); + TQString dbname = Pilot::fromPilot( info->name, 32 ); if ( !fDeviceDBs.contains( creator ) ) { @@ -157,11 +157,11 @@ public: } // Now take wildcards into account - QString db = Pilot::fromPilot(info->name); - for (QStringList::const_iterator i = fNoBackupDBs.begin(); + TQString db = Pilot::fromPilot(info->name); + for (TQStringList::const_iterator i = fNoBackupDBs.begin(); i != fNoBackupDBs.end(); ++i) { - QRegExp re(*i,true,true); // Wildcard match + TQRegExp re(*i,true,true); // Wildcard match if (re.exactMatch(db)) { return false; @@ -182,10 +182,10 @@ BackupAction::BackupAction(KPilotLink * p, bool full) : fP->fFullBackup = full; } -/* virtual */ QString BackupAction::statusString() const +/* virtual */ TQString BackupAction::statusString() const { FUNCTIONSETUP; - QString s(CSL1("BackupAction=")); + TQString s(CSL1("BackupAction=")); switch (status()) { @@ -212,14 +212,14 @@ BackupAction::BackupAction(KPilotLink * p, bool full) : break; default: s.append(CSL1("(unknown ")); - s.append(QString::number(status())); + s.append(TQString::number(status())); s.append(CSL1(")")); } return s; } -void BackupAction::setDirectory( const QString &p ) +void BackupAction::setDirectory( const TQString &p ) { fP->fPreferBackupDir = p; if (!p.endsWith(CSL1("/"))) @@ -228,19 +228,19 @@ void BackupAction::setDirectory( const QString &p ) } } -static inline void initNoBackup(QStringList &dbnames, - QValueList<unsigned long> &dbcreators) +static inline void initNoBackup(TQStringList &dbnames, + TQValueList<unsigned long> &dbcreators) { FUNCTIONSETUP; dbnames.clear(); dbcreators.clear(); - QStringList configuredSkip = KPilotSettings::skipBackupDB(); - QStringList::const_iterator e = configuredSkip.end(); - for (QStringList::const_iterator i = configuredSkip.begin(); + TQStringList configuredSkip = KPilotSettings::skipBackupDB(); + TQStringList::const_iterator e = configuredSkip.end(); + for (TQStringList::const_iterator i = configuredSkip.begin(); i!= e; ++i) { - QString s = *i; + TQString s = *i; if (s.startsWith(CSL1("[")) && s.endsWith(CSL1("]"))) { if (s.length() != 6) @@ -249,7 +249,7 @@ static inline void initNoBackup(QStringList &dbnames, } else { - QCString data = s.mid(1,4).latin1(); + TQCString data = s.mid(1,4).latin1(); unsigned long creator = pi_mktag(data[0],data[1],data[2],data[3]); dbcreators.append(creator); } @@ -262,9 +262,9 @@ static inline void initNoBackup(QStringList &dbnames, DEBUGKPILOT << fname << ": Will skip databases " << dbnames.join(CSL1(",")) << endl; - QString creatorids; + TQString creatorids; char buf[5]; - for (QValueList<unsigned long>::const_iterator i = dbcreators.begin(); + for (TQValueList<unsigned long>::const_iterator i = dbcreators.begin(); i != dbcreators.end(); ++i) { unsigned long tag = *i; @@ -280,10 +280,10 @@ static inline void initNoBackup(QStringList &dbnames, * if this is not the case. This method will try * to create the directory if it doesn't exist yet. */ -static inline bool checkBackupDirectory( const QString &backupDir ) +static inline bool checkBackupDirectory( const TQString &backupDir ) { FUNCTIONSETUP; - QFileInfo fi(backupDir); + TQFileInfo fi(backupDir); if (fi.exists() && fi.isDir()) { @@ -313,7 +313,7 @@ static inline bool checkBackupDirectory( const QString &backupDir ) KStandardDirs::makeDir( backupDir ); - fi = QFileInfo(backupDir); + fi = TQFileInfo(backupDir); return fi.exists() && fi.isDir(); } @@ -369,7 +369,7 @@ static inline bool checkBackupDirectory( const QString &backupDir ) initNoBackup( fP->fNoBackupDBs, fP->fNoBackupCreators ); fP->fDBIndex = 0; - QTimer::singleShot(0,this,SLOT(backupOneDB())); + TQTimer::singleShot(0,this,TQT_SLOT(backupOneDB())); return true; } @@ -380,7 +380,7 @@ static inline bool checkBackupDirectory( const QString &backupDir ) struct DBInfo info; // TODO: make the progress reporting more accurate - emit logProgress(QString::null, fP->fDBIndex); + emit logProgress(TQString::null, fP->fDBIndex); if (openConduit() < 0) { @@ -444,11 +444,11 @@ static inline bool checkBackupDirectory( const QString &backupDir ) { DEBUGKPILOT << fname << ": Skipping database <" << info.name << "> (no-backup list)" << endl; - QString s = i18n("Skipping %1") + TQString s = i18n("Skipping %1") .arg(Pilot::fromPilot(info.name)); addSyncLogEntry(s); } - QTimer::singleShot(0,this,SLOT(backupOneDB())); + TQTimer::singleShot(0,this,TQT_SLOT(backupOneDB())); } /** @@ -500,10 +500,10 @@ bool BackupAction::startBackupThread(DBInfo *info) // if we're here then we are going to back this database up. do some basic sanity // checks and proceed.... - QString databaseName(Pilot::fromPilot(info->name)); + TQString databaseName(Pilot::fromPilot(info->name)); databaseName.replace('/', '_'); - QString fullBackupName = fP->fBackupDir + databaseName; + TQString fullBackupName = fP->fBackupDir + databaseName; if (PilotDatabase::isResource(info)) { @@ -531,22 +531,22 @@ bool BackupAction::startBackupThread(DBInfo *info) return true; } -/* virtual */ bool BackupAction::event( QEvent *e ) +/* virtual */ bool BackupAction::event( TQEvent *e ) { - if (e->type() == (QEvent::Type)Thread::TerminateOK) + if (e->type() == (TQEvent::Type)Thread::TerminateOK) { KPILOT_DELETE(fBackupThread); // This was a successful termination. addSyncLogEntry( i18n("... OK.\n"), false ); - QTimer::singleShot(0,this,SLOT(backupOneDB())); + TQTimer::singleShot(0,this,TQT_SLOT(backupOneDB())); return true; } - if (e->type() == (QEvent::Type)Thread::TerminateFailure) + if (e->type() == (TQEvent::Type)Thread::TerminateFailure) { KPILOT_DELETE(fBackupThread); // Unsuccessful termination. addSyncLogEntry( i18n("Backup failed.") ); - QTimer::singleShot(0,this,SLOT(backupOneDB())); + TQTimer::singleShot(0,this,TQT_SLOT(backupOneDB())); return true; } return SyncAction::event(e); @@ -559,8 +559,8 @@ void BackupAction::endBackup() fP->fDBIndex = (-1); fActionStatus = BackupEnded; fP->fDeviceDBs.sort(); - QString old( QString::null ); - QStringList::Iterator itr = fP->fDeviceDBs.begin(); + TQString old( TQString::null ); + TQStringList::Iterator itr = fP->fDeviceDBs.begin(); while ( itr != fP->fDeviceDBs.end() ) { if ( old == *itr ) { itr = fP->fDeviceDBs.remove( itr ); @@ -575,7 +575,7 @@ void BackupAction::endBackup() } FileInstallAction::FileInstallAction(KPilotLink * p, - const QString & d) : + const TQString & d) : SyncAction(p, "fileInstall"), fDBIndex(-1), fTimer(0L), @@ -595,9 +595,9 @@ FileInstallAction::~FileInstallAction() { FUNCTIONSETUP; - QDir installDir(fDir); - fList = installDir.entryList(QDir::Files | - QDir::NoSymLinks | QDir::Readable); + TQDir installDir(fDir); + fList = installDir.entryList(TQDir::Files | + TQDir::NoSymLinks | TQDir::Readable); #ifdef DEBUG DEBUGKPILOT << fname << ": Installing " << fList.count() << " files" << endl; @@ -614,9 +614,9 @@ FileInstallAction::~FileInstallAction() return true; } - fTimer = new QTimer(this); - QObject::connect(fTimer, SIGNAL(timeout()), - this, SLOT(installNextFile())); + fTimer = new TQTimer(this); + TQObject::connect(fTimer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(installNextFile())); fTimer->start(0, false); @@ -651,8 +651,8 @@ FileInstallAction::~FileInstallAction() return; } - const QString filePath = fDir + fList[fDBIndex]; - const QString fileName = fList[fDBIndex]; + const TQString filePath = fDir + fList[fDBIndex]; + const TQString fileName = fList[fDBIndex]; fDBIndex++; @@ -660,7 +660,7 @@ FileInstallAction::~FileInstallAction() DEBUGKPILOT << fname << ": Installing file " << filePath << endl; #endif - QString m = i18n("Installing %1").arg(fileName); + TQString m = i18n("Installing %1").arg(fileName); emit logProgress(m,(100 * fDBIndex) / (fList.count()+1)); m+=CSL1("\n"); emit addSyncLogEntry(m,false /* Don't print in KPilot's log. */ ); @@ -671,7 +671,7 @@ FileInstallAction::~FileInstallAction() if (!resourceOK(fileName,filePath)) goto nextFile; f = pi_file_open(const_cast <char *> - ((const char *) QFile::encodeName(filePath))); + ((const char *) TQFile::encodeName(filePath))); #if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0 @@ -688,7 +688,7 @@ FileInstallAction::~FileInstallAction() } else { - QFile::remove(filePath); + TQFile::remove(filePath); } @@ -704,11 +704,11 @@ nextFile: // Check that the given file path is a good resource // file - in particular that the resource name is ok. -bool FileInstallAction::resourceOK(const QString &fileName, const QString &filePath) +bool FileInstallAction::resourceOK(const TQString &fileName, const TQString &filePath) { FUNCTIONSETUP; - if (!QFile::exists(filePath)) + if (!TQFile::exists(filePath)) { emit logError(i18n("Unable to open file "%1"."). arg(fileName)); @@ -716,7 +716,7 @@ bool FileInstallAction::resourceOK(const QString &fileName, const QString &fileP } struct pi_file *f = pi_file_open(const_cast <char *> - ((const char *) QFile::encodeName(filePath))); + ((const char *) TQFile::encodeName(filePath))); if (!f) { @@ -754,27 +754,27 @@ bool FileInstallAction::resourceOK(const QString &fileName, const QString &fileP return r; } -/* virtual */ QString FileInstallAction::statusString() const +/* virtual */ TQString FileInstallAction::statusString() const { FUNCTIONSETUP; if (fDBIndex < 0) { - return QString(CSL1("Idle")); + return TQString(CSL1("Idle")); } else { if ((unsigned) fDBIndex >= fList.count()) { - return QString(CSL1("Index out of range")); + return TQString(CSL1("Index out of range")); } else { - return QString(CSL1("Installing %1")).arg(fList[fDBIndex]); + return TQString(CSL1("Installing %1")).arg(fList[fDBIndex]); } } } -CheckUser::CheckUser(KPilotLink * p, QWidget * vp): +CheckUser::CheckUser(KPilotLink * p, TQWidget * vp): SyncAction(p, vp, "userCheck") { FUNCTIONSETUP; @@ -790,8 +790,8 @@ CheckUser::~CheckUser() { FUNCTIONSETUP; - QString guiUserName = KPilotSettings::userName(); - QString pilotUserName = fHandle->getPilotUser().name(); + TQString guiUserName = KPilotSettings::userName(); + TQString pilotUserName = fHandle->getPilotUser().name(); bool pilotUserEmpty = pilotUserName.isEmpty(); // 4 cases to handle: // guiUserName empty / not empty @@ -802,10 +802,10 @@ CheckUser::~CheckUser() { if (pilotUserEmpty) { - QString defaultUserName = + TQString defaultUserName = i18n("A common name", "John Doe"); - QString q = i18n("<qt>Neither KPilot nor the " + TQString q = i18n("<qt>Neither KPilot nor the " "handheld have a username set. " "They <i>should</i> be set. " "Should KPilot set them to a default value " @@ -823,7 +823,7 @@ CheckUser::~CheckUser() } else { - QString q = i18n("<qt>The handheld has a username set " + TQString q = i18n("<qt>The handheld has a username set " "(<i>%1</i>) but KPilot does not. Should " "KPilot use this username in future?</qt>"). arg(pilotUserName); @@ -840,7 +840,7 @@ CheckUser::~CheckUser() { if (pilotUserEmpty) { - QString q = CSL1("<qt>"); + TQString q = CSL1("<qt>"); q += i18n("KPilot has a username set " "(<i>%1</i>) but the handheld does not. " "Should KPilot's username be set in the " @@ -874,7 +874,7 @@ CheckUser::~CheckUser() { if (guiUserName != pilotUserName) { - QString q = i18n("<qt>The handheld thinks that " + TQString q = i18n("<qt>The handheld thinks that " "the username is %1; " "however, KPilot says you are %2." "Which of these is the correct name?\n" @@ -885,7 +885,7 @@ CheckUser::~CheckUser() int r = questionYesNoCancel(q, i18n("User Mismatch"), - QString::null, + TQString::null, 20, i18n("Use KPilot Name"), i18n("Use Handheld Name")); @@ -923,7 +923,7 @@ CheckUser::~CheckUser() // fix the database location for local databases. // // - QString pathName = KGlobal::dirs()->saveLocation("data", + TQString pathName = KGlobal::dirs()->saveLocation("data", CSL1("kpilot/DBBackup/")); if (!guiUserName.isEmpty()) { @@ -940,22 +940,22 @@ class RestoreInfo { public: struct DBInfo DBInfo; - QString path; + TQString path; } ; class RestoreAction::Private { public: - QString fPreferRestoreDir; /**< Preference setting where to get data from. */ + TQString fPreferRestoreDir; /**< Preference setting where to get data from. */ - QValueList<RestoreInfo> fDBList; - QTimer fTimer; - QValueList<RestoreInfo>::ConstIterator fDBIterator; + TQValueList<RestoreInfo> fDBList; + TQTimer fTimer; + TQValueList<RestoreInfo>::ConstIterator fDBIterator; int fDBIndex; }; -RestoreAction::RestoreAction(KPilotLink * p, QWidget * visible ) : +RestoreAction::RestoreAction(KPilotLink * p, TQWidget * visible ) : SyncAction(p, visible, "restoreAction") { FUNCTIONSETUP; @@ -963,7 +963,7 @@ RestoreAction::RestoreAction(KPilotLink * p, QWidget * visible ) : fP = new Private; } -void RestoreAction::setDirectory( const QString &path ) +void RestoreAction::setDirectory( const TQString &path ) { fP->fPreferRestoreDir = path; } @@ -972,7 +972,7 @@ void RestoreAction::setDirectory( const QString &path ) { FUNCTIONSETUP; - QString dirname; + TQString dirname; if (fP->fPreferRestoreDir.isEmpty()) { dirname = PilotLocalDatabase::getDBPath(); @@ -986,8 +986,8 @@ void RestoreAction::setDirectory( const QString &path ) DEBUGKPILOT << fname << ": Restoring user " << dirname << endl; #endif - QDir dir(dirname, QString::null, QDir::Name, - QDir::Files | QDir::Readable | QDir::NoSymLinks); + TQDir dir(dirname, TQString::null, TQDir::Name, + TQDir::Files | TQDir::Readable | TQDir::NoSymLinks); if (!dir.exists()) { @@ -1021,14 +1021,14 @@ void RestoreAction::setDirectory( const QString &path ) } - emit logProgress(i18n("Restoring %1...").arg(QString::null),1); + emit logProgress(i18n("Restoring %1...").arg(TQString::null),1); for (unsigned int i = 0; i < dir.count(); i++) { - QString s; + TQString s; RestoreInfo info; - s = dirname + QDir::separator() + dir[i]; + s = dirname + TQDir::separator() + dir[i]; DEBUGKPILOT << fname << ": Adding " << s << " to restore list." << endl; @@ -1049,8 +1049,8 @@ void RestoreAction::setDirectory( const QString &path ) fP->fDBIterator = fP->fDBList.begin(); fActionStatus = InstallingFiles; - QObject::connect(&(fP->fTimer), SIGNAL(timeout()), - this, SLOT(installNextFile())); + TQObject::connect(&(fP->fTimer), TQT_SIGNAL(timeout()), + this, TQT_SLOT(installNextFile())); fP->fTimer.start(0, false); return true; @@ -1089,7 +1089,7 @@ void RestoreAction::setDirectory( const QString &path ) return; } - QFileInfo databaseInfo(dbi.path); + TQFileInfo databaseInfo(dbi.path); addSyncLogEntry(databaseInfo.fileName()); emit logProgress(i18n("Restoring %1...").arg(databaseInfo.fileName()), (100*fP->fDBIndex) / (fP->fDBList.count()+1)) ; @@ -1102,21 +1102,21 @@ void RestoreAction::setDirectory( const QString &path ) } } -/* virtual */ QString RestoreAction::statusString() const +/* virtual */ TQString RestoreAction::statusString() const { FUNCTIONSETUP; - QString s; + TQString s; switch (status()) { case InstallingFiles: s.append(CSL1("Installing Files (")); - s.append(QString::number(fP->fDBIndex)); + s.append(TQString::number(fP->fDBIndex)); s.append(CSL1(")")); break; case GettingFileInfo: s.append(CSL1("Getting File Info (")); - s.append(QString::number(fP->fDBIndex)); + s.append(TQString::number(fP->fDBIndex)); s.append(CSL1(")")); break; default: @@ -1130,7 +1130,7 @@ void RestoreAction::setDirectory( const QString &path ) BackupAction::Thread::Thread( BackupAction *parent, KPilotLink *link, - const QString &filename, + const TQString &filename, const DBInfo *info ) { fParent = parent; @@ -1144,12 +1144,12 @@ void BackupAction::Thread::run() if (fLink->retrieveDatabase(fFilename,&fDBInfo)) { // Successful. - QApplication::postEvent( fParent, new QEvent( (QEvent::Type)TerminateOK ) ); + TQApplication::postEvent( fParent, new TQEvent( (TQEvent::Type)TerminateOK ) ); } else { // Failed - QApplication::postEvent( fParent, new QEvent( (QEvent::Type)TerminateFailure ) ); + TQApplication::postEvent( fParent, new TQEvent( (TQEvent::Type)TerminateFailure ) ); } } |