From f7e71d47719ab6094cf4a9fafffa5ea351973522 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 13 Jan 2011 08:32:36 +0000 Subject: Initial conversion for TQt for Qt4 3.4.0 TP2 This will also compile with TQt for Qt3, and should not cause any problems with dependent modules such as kdebase. If it does then it needs to be fixed! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1214149 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kwallet/backend/kwalletbackend.cc | 44 +++++++++++++++++++-------------------- kwallet/backend/kwalletbackend.h | 2 +- kwallet/client/kwallet.cc | 2 +- kwallet/client/kwallet.h | 5 +++++ kwallet/tests/kwalletasync.cpp | 6 +++--- kwallet/tests/kwalletboth.cpp | 6 +++--- kwallet/tests/kwallettest.h | 2 +- 7 files changed, 36 insertions(+), 31 deletions(-) (limited to 'kwallet') diff --git a/kwallet/backend/kwalletbackend.cc b/kwallet/backend/kwalletbackend.cc index c208c4d69..72b74d062 100644 --- a/kwallet/backend/kwalletbackend.cc +++ b/kwallet/backend/kwalletbackend.cc @@ -336,7 +336,7 @@ int Backend::open(const TQByteArray& password) { _hashes.clear(); // Read in the hashes TQDataStream hds(&db); - Q_UINT32 n; + TQ_UINT32 n; hds >> n; if (n > 0xffff) { // sanity check return -43; @@ -346,7 +346,7 @@ int Backend::open(const TQByteArray& password) { KMD5::Digest d, d2; // judgment day MD5Digest ba; TQMap >::iterator it; - Q_UINT32 fsz; + TQ_UINT32 fsz; if (hds.atEnd()) return -43; hds.readRawBytes(reinterpret_cast(d), 16); hds >> fsz; @@ -422,7 +422,7 @@ int Backend::open(const TQByteArray& password) { // compare hashes int sz = encrypted.size(); for (int i = 0; i < 20; i++) { - if (testhash[i] != encrypted[sz - 20 + i]) { + if (testhash[i] != encrypted.at(sz - 20 + i)) { encrypted.fill(0); sha.reset(); return -8; // hash error. @@ -443,7 +443,7 @@ int Backend::open(const TQByteArray& password) { while (!eStream.atEnd()) { TQString folder; - Q_UINT32 n; + TQ_UINT32 n; eStream >> folder; eStream >> n; @@ -456,7 +456,7 @@ int Backend::open(const TQByteArray& password) { KWallet::Wallet::EntryType et = KWallet::Wallet::Unknown; Entry *e = new Entry; eStream >> key; - Q_INT32 x = 0; // necessary to read properly + TQ_INT32 x = 0; // necessary to read properly eStream >> x; et = static_cast(x); @@ -511,7 +511,7 @@ int Backend::sync(const TQByteArray& password) { TQByteArray hashes; TQDataStream hashStream(hashes, IO_WriteOnly); KMD5 md5; - hashStream << static_cast(_entries.count()); + hashStream << static_cast(_entries.count()); // Holds decrypted data prior to encryption TQByteArray decrypted; @@ -524,16 +524,16 @@ int Backend::sync(const TQByteArray& password) { TQDataStream dStream(decrypted, IO_WriteOnly); for (FolderMap::ConstIterator i = _entries.begin(); i != _entries.end(); ++i) { dStream << i.key(); - dStream << static_cast(i.data().count()); + dStream << static_cast(i.data().count()); md5.reset(); md5.update(i.key().utf8()); hashStream.writeRawBytes(reinterpret_cast(&(md5.rawDigest()[0])), 16); - hashStream << static_cast(i.data().count()); + hashStream << static_cast(i.data().count()); for (EntryMap::ConstIterator j = i.data().begin(); j != i.data().end(); ++j) { dStream << j.key(); - dStream << static_cast(j.data()->type()); + dStream << static_cast(j.data()->type()); dStream << j.data()->value(); md5.reset(); @@ -693,7 +693,7 @@ TQPtrList Backend::readEntryList(const TQString& key) { bool Backend::createFolder(const TQString& f) { - if (_entries.contains(f)) { + if (_entries.tqcontains(f)) { return false; } @@ -709,8 +709,8 @@ return true; int Backend::renameEntry(const TQString& oldName, const TQString& newName) { EntryMap& emap = _entries[_folder]; -EntryMap::Iterator oi = emap.find(oldName); -EntryMap::Iterator ni = emap.find(newName); +EntryMap::Iterator oi = emap.tqfind(oldName); +EntryMap::Iterator ni = emap.tqfind(newName); if (oi != emap.end() && ni == emap.end()) { Entry *e = oi.data(); @@ -720,7 +720,7 @@ EntryMap::Iterator ni = emap.find(newName); KMD5 folderMd5; folderMd5.update(_folder.utf8()); - HashMap::iterator i = _hashes.find(MD5Digest(folderMd5.rawDigest())); + HashMap::iterator i = _hashes.tqfind(MD5Digest(folderMd5.rawDigest())); if (i != _hashes.end()) { KMD5 oldMd5, newMd5; oldMd5.update(oldName.utf8()); @@ -747,7 +747,7 @@ void Backend::writeEntry(Entry *e) { KMD5 folderMd5; folderMd5.update(_folder.utf8()); - HashMap::iterator i = _hashes.find(MD5Digest(folderMd5.rawDigest())); + HashMap::iterator i = _hashes.tqfind(MD5Digest(folderMd5.rawDigest())); if (i != _hashes.end()) { KMD5 md5; md5.update(e->key().utf8()); @@ -757,7 +757,7 @@ void Backend::writeEntry(Entry *e) { bool Backend::hasEntry(const TQString& key) const { - return _entries.contains(_folder) && _entries[_folder].contains(key); + return _entries.tqcontains(_folder) && _entries[_folder].tqcontains(key); } @@ -766,8 +766,8 @@ bool Backend::removeEntry(const TQString& key) { return false; } - FolderMap::Iterator fi = _entries.find(_folder); - EntryMap::Iterator ei = fi.data().find(key); + FolderMap::Iterator fi = _entries.tqfind(_folder); + EntryMap::Iterator ei = fi.data().tqfind(key); if (fi != _entries.end() && ei != fi.data().end()) { delete ei.data(); @@ -775,7 +775,7 @@ bool Backend::removeEntry(const TQString& key) { KMD5 folderMd5; folderMd5.update(_folder.utf8()); - HashMap::iterator i = _hashes.find(MD5Digest(folderMd5.rawDigest())); + HashMap::iterator i = _hashes.tqfind(MD5Digest(folderMd5.rawDigest())); if (i != _hashes.end()) { KMD5 md5; md5.update(key.utf8()); @@ -793,7 +793,7 @@ bool Backend::removeFolder(const TQString& f) { return false; } - FolderMap::Iterator fi = _entries.find(f); + FolderMap::Iterator fi = _entries.tqfind(f); if (fi != _entries.end()) { if (_folder == f) { @@ -819,18 +819,18 @@ return false; bool Backend::folderDoesNotExist(const TQString& folder) const { KMD5 md5; md5.update(folder.utf8()); - return !_hashes.contains(MD5Digest(md5.rawDigest())); + return !_hashes.tqcontains(MD5Digest(md5.rawDigest())); } bool Backend::entryDoesNotExist(const TQString& folder, const TQString& entry) const { KMD5 md5; md5.update(folder.utf8()); - HashMap::const_iterator i = _hashes.find(MD5Digest(md5.rawDigest())); + HashMap::const_iterator i = _hashes.tqfind(MD5Digest(md5.rawDigest())); if (i != _hashes.end()) { md5.reset(); md5.update(entry.utf8()); - return !i.data().contains(MD5Digest(md5.rawDigest())); + return !i.data().tqcontains(MD5Digest(md5.rawDigest())); } return true; } diff --git a/kwallet/backend/kwalletbackend.h b/kwallet/backend/kwalletbackend.h index 9d46d25c9..a2f654ec6 100644 --- a/kwallet/backend/kwalletbackend.h +++ b/kwallet/backend/kwalletbackend.h @@ -72,7 +72,7 @@ class KDE_EXPORT Backend { const TQString& folder() const { return _folder; } // Does it have this folder? - bool hasFolder(const TQString& f) const { return _entries.contains(f); } + bool hasFolder(const TQString& f) const { return _entries.tqcontains(f); } // Look up an entry. Returns null if it doesn't exist. Entry *readEntry(const TQString& key); diff --git a/kwallet/client/kwallet.cc b/kwallet/client/kwallet.cc index 0575050e5..9fb476411 100644 --- a/kwallet/client/kwallet.cc +++ b/kwallet/client/kwallet.cc @@ -179,7 +179,7 @@ Wallet *Wallet::openWallet(const TQString& name, WId w, OpenType ot) { } // avoid deadlock if the app has some popup open (#65978/#71048) - while( TQWidget* widget = qApp->activePopupWidget()) + while( TQWidget* widget = TQT_TQWIDGET(tqApp->activePopupWidget())) widget->close(); bool isPath = ot == Path; diff --git a/kwallet/client/kwallet.h b/kwallet/client/kwallet.h index b7b3bce31..cbe8188a5 100644 --- a/kwallet/client/kwallet.h +++ b/kwallet/client/kwallet.h @@ -23,6 +23,11 @@ #define _KWALLET_H #include + +#ifdef Q_MOC_RUN +#define Q_OS_UNIX +#endif // Q_MOC_RUN + #ifdef Q_OS_UNIX #include diff --git a/kwallet/tests/kwalletasync.cpp b/kwallet/tests/kwalletasync.cpp index 6e5c22998..072fb55f8 100644 --- a/kwallet/tests/kwalletasync.cpp +++ b/kwallet/tests/kwalletasync.cpp @@ -26,8 +26,8 @@ void openWallet() _out << "About to start 30 second event loop" << endl; - TQTimer::singleShot( 30000, qApp, TQT_SLOT( quit() ) ); - int ret = qApp->exec(); + TQTimer::singleShot( 30000, tqApp, TQT_SLOT( quit() ) ); + int ret = tqApp->exec(); if ( ret == 0 ) _out << "Timed out!" << endl; @@ -38,7 +38,7 @@ void openWallet() void WalletReceiver::walletOpened( bool got ) { _out << "Got async wallet: " << got << endl; - qApp->exit( 1 ); + tqApp->exit( 1 ); } int main( int argc, char *argv[] ) diff --git a/kwallet/tests/kwalletboth.cpp b/kwallet/tests/kwalletboth.cpp index f79f38567..75d303419 100644 --- a/kwallet/tests/kwalletboth.cpp +++ b/kwallet/tests/kwalletboth.cpp @@ -31,8 +31,8 @@ void openWallet() _out << "Got sync wallet: " << (wallet != 0) << endl; _out << "About to start 30 second event loop" << endl; - TQTimer::singleShot( 30000, qApp, TQT_SLOT( quit() ) ); - int ret = qApp->exec(); + TQTimer::singleShot( 30000, tqApp, TQT_SLOT( quit() ) ); + int ret = tqApp->exec(); if ( ret == 0 ) @@ -60,7 +60,7 @@ void openWallet() void WalletReceiver::walletOpened( bool got ) { _out << "Got async wallet: " << got << endl; - qApp->exit( 1 ); + tqApp->exit( 1 ); } int main( int argc, char *argv[] ) diff --git a/kwallet/tests/kwallettest.h b/kwallet/tests/kwallettest.h index 448cdb785..c062760a4 100644 --- a/kwallet/tests/kwallettest.h +++ b/kwallet/tests/kwallettest.h @@ -5,7 +5,7 @@ namespace KWallet { class Wallet; } -class WalletReceiver : public QObject +class WalletReceiver : public TQObject { Q_OBJECT public slots: -- cgit v1.2.1