diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-02-01 10:51:32 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-02-01 10:51:32 -0600 |
commit | 0c9d97065a3d6ceb12d687555a1a33d90db96238 (patch) | |
tree | 4305105967fc03b06139b57871d5ab6d2360e75b /tdecore | |
parent | 59d153016be1e09cb31cdb18bef0a649acfc6292 (diff) | |
download | tdelibs-0c9d97065a3d6ceb12d687555a1a33d90db96238.tar.gz tdelibs-0c9d97065a3d6ceb12d687555a1a33d90db96238.zip |
Rename KLock and KTrader to avoid conflicts with KDE4
Diffstat (limited to 'tdecore')
-rw-r--r-- | tdecore/kapplication.cpp | 4 | ||||
-rw-r--r-- | tdecore/kdebug.areas | 2 | ||||
-rw-r--r-- | tdecore/klockfile.cpp | 72 | ||||
-rw-r--r-- | tdecore/klockfile.h | 14 | ||||
-rw-r--r-- | tdecore/tdeconfig.cpp | 2 | ||||
-rw-r--r-- | tdecore/tdeconfig.h | 2 | ||||
-rw-r--r-- | tdecore/tdeconfigbackend.cpp | 18 | ||||
-rw-r--r-- | tdecore/tdeconfigbackend.h | 2 |
8 files changed, 58 insertions, 58 deletions
diff --git a/tdecore/kapplication.cpp b/tdecore/kapplication.cpp index eb56b0f87..b55f0743b 100644 --- a/tdecore/kapplication.cpp +++ b/tdecore/kapplication.cpp @@ -1443,8 +1443,8 @@ void TDEApplication::startKdeinit() { #ifndef Q_WS_WIN //TODO TDEInstance inst( "starttdeinitlock" ); - KLockFile lock( locateLocal( "tmp", "starttdeinitlock", &inst )); - if( lock.lock( KLockFile::LockNoBlock ) != KLockFile::LockOK ) { + TDELockFile lock( locateLocal( "tmp", "starttdeinitlock", &inst )); + if( lock.lock( TDELockFile::LockNoBlock ) != TDELockFile::LockOK ) { lock.lock(); DCOPClient cl; if( cl.attach()) diff --git a/tdecore/kdebug.areas b/tdecore/kdebug.areas index 67a027c88..9998163e2 100644 --- a/tdecore/kdebug.areas +++ b/tdecore/kdebug.areas @@ -234,7 +234,7 @@ 7011 kio (KSycoca) 7012 kio (KService*) 7013 kio (KPing) -7014 kio (KTrader) +7014 kio (TDETrader) 7015 kio (KAutoMount) 7016 kio (KLauncher) 7017 kio (KIOConnection) diff --git a/tdecore/klockfile.cpp b/tdecore/klockfile.cpp index 56f4ecd82..8b4a991ce 100644 --- a/tdecore/klockfile.cpp +++ b/tdecore/klockfile.cpp @@ -45,7 +45,7 @@ // TODO: http://www.spinnaker.de/linux/nfs-locking.html // TODO: Make regression test -class KLockFile::KLockFilePrivate { +class TDELockFile::TDELockFilePrivate { public: TQString file; int staleTime; @@ -62,9 +62,9 @@ public: // 30 seconds -KLockFile::KLockFile(const TQString &file) +TDELockFile::TDELockFile(const TQString &file) { - d = new KLockFilePrivate(); + d = new TDELockFilePrivate(); d->file = file; d->staleTime = 30; d->isLocked = false; @@ -72,21 +72,21 @@ KLockFile::KLockFile(const TQString &file) d->linkCountSupport = true; } -KLockFile::~KLockFile() +TDELockFile::~TDELockFile() { unlock(); delete d; } int -KLockFile::staleTime() const +TDELockFile::staleTime() const { return d->staleTime; } void -KLockFile::setStaleTime(int _staleTime) +TDELockFile::setStaleTime(int _staleTime) { d->staleTime = _staleTime; } @@ -109,17 +109,17 @@ static bool testLinkCountSupport(const TQCString &fileName) return ((result == 0) && (st_buf.st_nlink == 2)); } -static KLockFile::LockResult lockFile(const TQString &lockFile, KDE_struct_stat &st_buf, bool &linkCountSupport) +static TDELockFile::LockResult lockFile(const TQString &lockFile, KDE_struct_stat &st_buf, bool &linkCountSupport) { TQCString lockFileName = TQFile::encodeName( lockFile ); int result = KDE_lstat( lockFileName, &st_buf ); if (result == 0) - return KLockFile::LockFail; + return TDELockFile::LockFail; KTempFile uniqueFile(lockFile, TQString::null, 0644); uniqueFile.setAutoDelete(true); if (uniqueFile.status() != 0) - return KLockFile::LockError; + return TDELockFile::LockError; char hostname[256]; hostname[0] = 0; @@ -138,23 +138,23 @@ static KLockFile::LockResult lockFile(const TQString &lockFile, KDE_struct_stat // Create lock file result = ::link( uniqueName, lockFileName ); if (result != 0) - return KLockFile::LockError; + return TDELockFile::LockError; if (!linkCountSupport) - return KLockFile::LockOK; + return TDELockFile::LockOK; #else //TODO for win32 - return KLockFile::LockOK; + return TDELockFile::LockOK; #endif KDE_struct_stat st_buf2; result = KDE_lstat( uniqueName, &st_buf2 ); if (result != 0) - return KLockFile::LockError; + return TDELockFile::LockError; result = KDE_lstat( lockFileName, &st_buf ); if (result != 0) - return KLockFile::LockError; + return TDELockFile::LockError; if (!statResultIsEqual(st_buf, st_buf2) || S_ISLNK(st_buf.st_mode) || S_ISLNK(st_buf2.st_mode)) { @@ -163,15 +163,15 @@ static KLockFile::LockResult lockFile(const TQString &lockFile, KDE_struct_stat { linkCountSupport = testLinkCountSupport(uniqueName); if (!linkCountSupport) - return KLockFile::LockOK; // Link count support is missing... assume everything is OK. + return TDELockFile::LockOK; // Link count support is missing... assume everything is OK. } - return KLockFile::LockFail; + return TDELockFile::LockFail; } - return KLockFile::LockOK; + return TDELockFile::LockOK; } -static KLockFile::LockResult deleteStaleLock(const TQString &lockFile, KDE_struct_stat &st_buf, bool &linkCountSupport) +static TDELockFile::LockResult deleteStaleLock(const TQString &lockFile, KDE_struct_stat &st_buf, bool &linkCountSupport) { // This is dangerous, we could be deleting a new lock instead of // the old stale one, let's be very careful @@ -179,7 +179,7 @@ static KLockFile::LockResult deleteStaleLock(const TQString &lockFile, KDE_struc // Create temp file KTempFile ktmpFile(lockFile); if (ktmpFile.status() != 0) - return KLockFile::LockError; + return TDELockFile::LockError; TQCString lckFile = TQFile::encodeName(lockFile); TQCString tmpFile = TQFile::encodeName(ktmpFile.name()); @@ -189,10 +189,10 @@ static KLockFile::LockResult deleteStaleLock(const TQString &lockFile, KDE_struc #ifdef Q_OS_UNIX // link to lock file if (::link(lckFile, tmpFile) != 0) - return KLockFile::LockFail; // Try again later + return TDELockFile::LockFail; // Try again later #else //TODO for win32 - return KLockFile::LockOK; + return TDELockFile::LockOK; #endif // check if link count increased with exactly one @@ -209,7 +209,7 @@ static KLockFile::LockResult deleteStaleLock(const TQString &lockFile, KDE_struc tqWarning("WARNING: deleting stale lockfile %s", lckFile.data()); ::unlink(lckFile); ::unlink(tmpFile); - return KLockFile::LockOK; + return TDELockFile::LockOK; } } @@ -227,34 +227,34 @@ static KLockFile::LockResult deleteStaleLock(const TQString &lockFile, KDE_struc tqWarning("WARNING: deleting stale lockfile %s", lckFile.data()); ::unlink(lckFile); ::unlink(tmpFile); - return KLockFile::LockOK; + return TDELockFile::LockOK; } // Failed to delete stale lock file tqWarning("WARNING: Problem deleting stale lockfile %s", lckFile.data()); ::unlink(tmpFile); - return KLockFile::LockFail; + return TDELockFile::LockFail; } -KLockFile::LockResult KLockFile::lock(int options) +TDELockFile::LockResult TDELockFile::lock(int options) { if (d->isLocked) - return KLockFile::LockOK; + return TDELockFile::LockOK; - KLockFile::LockResult result; + TDELockFile::LockResult result; int hardErrors = 5; int n = 5; while(true) { KDE_struct_stat st_buf; result = lockFile(d->file, st_buf, d->linkCountSupport); - if (result == KLockFile::LockOK) + if (result == TDELockFile::LockOK) { d->staleTimer = TQTime(); break; } - else if (result == KLockFile::LockError) + else if (result == TDELockFile::LockError) { d->staleTimer = TQTime(); if (--hardErrors == 0) @@ -262,7 +262,7 @@ KLockFile::LockResult KLockFile::lock(int options) break; } } - else // KLockFile::Fail + else // TDELockFile::Fail { if (!d->staleTimer.isNull() && !statResultIsEqual(d->statBuf, st_buf)) d->staleTimer = TQTime(); @@ -292,17 +292,17 @@ KLockFile::LockResult KLockFile::lock(int options) if (isStale) { if ((options & LockForce) == 0) - return KLockFile::LockStale; + return TDELockFile::LockStale; result = deleteStaleLock(d->file, d->statBuf, d->linkCountSupport); - if (result == KLockFile::LockOK) + if (result == TDELockFile::LockOK) { // Lock deletion successful d->staleTimer = TQTime(); continue; // Now try to get the new lock } - else if (result != KLockFile::LockFail) + else if (result != TDELockFile::LockFail) { return result; } @@ -351,12 +351,12 @@ KLockFile::LockResult KLockFile::lock(int options) return result; } -bool KLockFile::isLocked() const +bool TDELockFile::isLocked() const { return d->isLocked; } -void KLockFile::unlock() +void TDELockFile::unlock() { if (d->isLocked) { @@ -365,7 +365,7 @@ void KLockFile::unlock() } } -bool KLockFile::getLockInfo(int &pid, TQString &hostname, TQString &appname) +bool TDELockFile::getLockInfo(int &pid, TQString &hostname, TQString &appname) { if (d->pid == -1) return false; diff --git a/tdecore/klockfile.h b/tdecore/klockfile.h index f3bf0b0bc..be347ab56 100644 --- a/tdecore/klockfile.h +++ b/tdecore/klockfile.h @@ -25,22 +25,22 @@ #include <ksharedptr.h> /** - * The KLockFile class provides NFS safe lockfiles. + * The TDELockFile class provides NFS safe lockfiles. * * @author Waldo Bastian <bastian@kde.org> * @since 3.3 */ -class TDECORE_EXPORT KLockFile : public TDEShared +class TDECORE_EXPORT TDELockFile : public TDEShared { public: - typedef TDESharedPtr<KLockFile> Ptr; + typedef TDESharedPtr<TDELockFile> Ptr; - KLockFile(const TQString &file); + TDELockFile(const TQString &file); /** * Destroys the object, releasing the lock if held **/ - ~KLockFile(); + ~TDELockFile(); /** * Possible return values of the lock function. @@ -116,8 +116,8 @@ public: bool getLockInfo(int &pid, TQString &hostname, TQString &appname); private: - class KLockFilePrivate; - KLockFilePrivate *d; + class TDELockFilePrivate; + TDELockFilePrivate *d; }; #endif diff --git a/tdecore/tdeconfig.cpp b/tdecore/tdeconfig.cpp index 28f25e61a..1e75be6f1 100644 --- a/tdecore/tdeconfig.cpp +++ b/tdecore/tdeconfig.cpp @@ -277,7 +277,7 @@ void TDEConfig::setFileWriteMode(int mode) backEnd->setFileWriteMode(mode); } -KLockFile::Ptr TDEConfig::lockFile(bool bGlobal) +TDELockFile::Ptr TDEConfig::lockFile(bool bGlobal) { TDEConfigINIBackEnd *aBackEnd = dynamic_cast<TDEConfigINIBackEnd*>(backEnd); if (!aBackEnd) return 0; diff --git a/tdecore/tdeconfig.h b/tdecore/tdeconfig.h index 19cd3bdf5..c2da06446 100644 --- a/tdecore/tdeconfig.h +++ b/tdecore/tdeconfig.h @@ -176,7 +176,7 @@ public: * Otherwise there is a risk of deadlock. * @since 3.3 */ - KLockFile::Ptr lockFile( bool bGlobal=false ); + TDELockFile::Ptr lockFile( bool bGlobal=false ); protected: diff --git a/tdecore/tdeconfigbackend.cpp b/tdecore/tdeconfigbackend.cpp index 77260e326..4ad70b4a8 100644 --- a/tdecore/tdeconfigbackend.cpp +++ b/tdecore/tdeconfigbackend.cpp @@ -236,8 +236,8 @@ class TDEConfigBackEnd::TDEConfigBackEndPrivate public: TQDateTime localLastModified; uint localLastSize; - KLockFile::Ptr localLockFile; - KLockFile::Ptr globalLockFile; + TDELockFile::Ptr localLockFile; + TDELockFile::Ptr globalLockFile; }; void TDEConfigBackEnd::changeFileName(const TQString &_fileName, @@ -270,7 +270,7 @@ void TDEConfigBackEnd::changeFileName(const TQString &_fileName, d->globalLockFile = 0; } -KLockFile::Ptr TDEConfigBackEnd::lockFile(bool bGlobal) +TDELockFile::Ptr TDEConfigBackEnd::lockFile(bool bGlobal) { if (bGlobal) { @@ -279,7 +279,7 @@ KLockFile::Ptr TDEConfigBackEnd::lockFile(bool bGlobal) if (!mGlobalFileName.isEmpty()) { - d->globalLockFile = new KLockFile(mGlobalFileName+".lock"); + d->globalLockFile = new TDELockFile(mGlobalFileName+".lock"); return d->globalLockFile; } } @@ -290,7 +290,7 @@ KLockFile::Ptr TDEConfigBackEnd::lockFile(bool bGlobal) if (!mLocalFileName.isEmpty()) { - d->localLockFile = new KLockFile(mLocalFileName+".lock"); + d->localLockFile = new TDELockFile(mLocalFileName+".lock"); return d->localLockFile; } } @@ -815,7 +815,7 @@ void TDEConfigINIBackEnd::sync(bool bMerge) // it wasn't SUID. if (checkAccess(mLocalFileName, W_OK)) { // File is writable - KLockFile::Ptr lf; + TDELockFile::Ptr lf; bool mergeLocalFile = bMerge; // Check if the file has been updated since. @@ -827,7 +827,7 @@ void TDEConfigINIBackEnd::sync(bool bMerge) if (lf) { - lf->lock( KLockFile::LockForce ); + lf->lock( TDELockFile::LockForce ); // But what if the locking failed? Ignore it for now... } @@ -873,13 +873,13 @@ void TDEConfigINIBackEnd::sync(bool bMerge) // can we allow the write? (see above) if (checkAccess ( mGlobalFileName, W_OK )) { - KLockFile::Ptr lf = lockFile(true); // Lock file for global file + TDELockFile::Ptr lf = lockFile(true); // Lock file for global file if (lf && lf->isLocked()) lf = 0; // Already locked, we don't need to lock/unlock again if (lf) { - lf->lock( KLockFile::LockForce ); + lf->lock( TDELockFile::LockForce ); // But what if the locking failed? Ignore it for now... } writeConfigFile( mGlobalFileName, true, bMerge ); // Always merge diff --git a/tdecore/tdeconfigbackend.h b/tdecore/tdeconfigbackend.h index 05884cb7f..71ba15288 100644 --- a/tdecore/tdeconfigbackend.h +++ b/tdecore/tdeconfigbackend.h @@ -151,7 +151,7 @@ public: * @param bGlobal If true, returns a lock file object for kdeglobals * @since 3.3 */ - KLockFile::Ptr lockFile( bool bGlobal = false ); + TDELockFile::Ptr lockFile( bool bGlobal = false ); #ifdef KDE_NO_COMPAT private: |