summaryrefslogtreecommitdiffstats
path: root/kexi/core/kexidbconnectionset.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/core/kexidbconnectionset.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/core/kexidbconnectionset.cpp')
-rw-r--r--kexi/core/kexidbconnectionset.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/kexi/core/kexidbconnectionset.cpp b/kexi/core/kexidbconnectionset.cpp
index 1a0eb774..f548d82b 100644
--- a/kexi/core/kexidbconnectionset.cpp
+++ b/kexi/core/kexidbconnectionset.cpp
@@ -23,7 +23,7 @@
#include <kdebug.h>
#include <kstandarddirs.h>
-#include <qfile.h>
+#include <tqfile.h>
//! @internal
class KexiDBConnectionSetPrivate
@@ -36,13 +36,13 @@ public:
maxid=-1;
}
KexiDB::ConnectionData::List list;
- QMap<KexiDB::ConnectionData*, QString> filenamesForData;
- QDict<KexiDB::ConnectionData> dataForFilenames;
+ TQMap<KexiDB::ConnectionData*, TQString> filenamesForData;
+ TQDict<KexiDB::ConnectionData> dataForFilenames;
int maxid;
};
KexiDBConnectionSet::KexiDBConnectionSet()
-: QObject()
+: TQObject()
, d(new KexiDBConnectionSetPrivate())
{
}
@@ -52,7 +52,7 @@ KexiDBConnectionSet::~KexiDBConnectionSet()
delete d;
}
-bool KexiDBConnectionSet::addConnectionData(KexiDB::ConnectionData *data, const QString& _filename)
+bool KexiDBConnectionSet::addConnectionData(KexiDB::ConnectionData *data, const TQString& _filename)
{
if (!data)
return false;
@@ -60,27 +60,27 @@ bool KexiDBConnectionSet::addConnectionData(KexiDB::ConnectionData *data, const
data->id = d->maxid+1;
//TODO: check for id-duplicates
- d->maxid = QMAX(d->maxid,data->id);
+ d->maxid = TQMAX(d->maxid,data->id);
// d->list.append(data);
- QString filename( _filename );
+ TQString filename( _filename );
bool generateUniqueFilename = filename.isEmpty()
|| !filename.isEmpty() && data==d->dataForFilenames[filename];
if (generateUniqueFilename) {
- QString dir = KGlobal::dirs()->saveLocation("data", "kexi/connections/", false /*!create*/);
+ TQString dir = KGlobal::dirs()->saveLocation("data", "kexi/connections/", false /*!create*/);
if (dir.isEmpty())
return false;
- QString baseFilename( dir + (data->hostName.isEmpty() ? "localhost" : data->hostName) );
+ TQString baseFilename( dir + (data->hostName.isEmpty() ? "localhost" : data->hostName) );
int i = 0;
- while (KStandardDirs::exists(baseFilename+(i>0 ? QString::number(i) : QString::null)+".kexic"))
+ while (KStandardDirs::exists(baseFilename+(i>0 ? TQString::number(i) : TQString())+".kexic"))
i++;
if (!KStandardDirs::exists(dir)) {
//make 'connections' dir and protect it
if (!KStandardDirs::makeDir(dir, 0700))
return false;
}
- filename = baseFilename+(i>0 ? QString::number(i) : QString::null)+".kexic";
+ filename = baseFilename+(i>0 ? TQString::number(i) : TQString())+".kexic";
}
addConnectionDataInternal(data, filename);
bool result = saveConnectionData(data, data);
@@ -89,7 +89,7 @@ bool KexiDBConnectionSet::addConnectionData(KexiDB::ConnectionData *data, const
return result;
}
-void KexiDBConnectionSet::addConnectionDataInternal(KexiDB::ConnectionData *data, const QString& filename)
+void KexiDBConnectionSet::addConnectionDataInternal(KexiDB::ConnectionData *data, const TQString& filename)
{
d->filenamesForData.insert(data, filename);
d->dataForFilenames.insert(filename, data);
@@ -101,10 +101,10 @@ bool KexiDBConnectionSet::saveConnectionData(KexiDB::ConnectionData *oldData,
{
if (!oldData || !newData)
return false;
- QMap<KexiDB::ConnectionData*, QString>::ConstIterator it = d->filenamesForData.find( oldData );
+ TQMap<KexiDB::ConnectionData*, TQString>::ConstIterator it = d->filenamesForData.tqfind( oldData );
if (it == d->filenamesForData.constEnd() || it.data().isEmpty())
return false;
- const QString filename( it.data() );
+ const TQString filename( it.data() );
KexiDBConnShortcutFile shortcutFile(filename);
if (!shortcutFile.saveConnectionData(*newData, newData->savePassword)) // true/*savePassword*/))
return false;
@@ -115,8 +115,8 @@ bool KexiDBConnectionSet::saveConnectionData(KexiDB::ConnectionData *oldData,
void KexiDBConnectionSet::removeConnectionDataInternal(KexiDB::ConnectionData *data)
{
- QMap<KexiDB::ConnectionData*, QString>::ConstIterator it = d->filenamesForData.find( data );
- const QString filename( it.data() );
+ TQMap<KexiDB::ConnectionData*, TQString>::ConstIterator it = d->filenamesForData.tqfind( data );
+ const TQString filename( it.data() );
d->filenamesForData.remove(data);
d->dataForFilenames.remove(filename);
d->list.removeRef(data);
@@ -126,10 +126,10 @@ bool KexiDBConnectionSet::removeConnectionData(KexiDB::ConnectionData *data)
{
if (!data)
return false;
- QMap<KexiDB::ConnectionData*, QString>::ConstIterator it = d->filenamesForData.find( data );
+ TQMap<KexiDB::ConnectionData*, TQString>::ConstIterator it = d->filenamesForData.tqfind( data );
if (it == d->filenamesForData.constEnd() || it.data().isEmpty())
return false;
- QFile file( it.data() );
+ TQFile file( it.data() );
if (!file.remove())
return false;
removeConnectionDataInternal(data);
@@ -151,14 +151,14 @@ void KexiDBConnectionSet::clear()
void KexiDBConnectionSet::load()
{
clear();
-// QStringList dirs( KGlobal::dirs()->findDirs("data", "kexi/connections") );
+// TQStringList dirs( KGlobal::dirs()->findDirs("data", "kexi/connections") );
// kexidbg << dirs << endl;
- QStringList files( KGlobal::dirs()->findAllResources("data", "kexi/connections/*.kexic") );
+ TQStringList files( KGlobal::dirs()->findAllResources("data", "kexi/connections/*.kexic") );
// //also try for capital file extension
// files += KGlobal::dirs()->findAllResources("data", "kexi/connections/*.KEXIC");
// kexidbg << files << endl;
- foreach(QStringList::ConstIterator, it, files) {
+ foreach(TQStringList::ConstIterator, it, files) {
KexiDB::ConnectionData *data = new KexiDB::ConnectionData();
KexiDBConnShortcutFile shortcutFile( *it );
if (!shortcutFile.loadConnectionData(*data)) {
@@ -169,15 +169,15 @@ void KexiDBConnectionSet::load()
}
}
-QString KexiDBConnectionSet::fileNameForConnectionData(KexiDB::ConnectionData *data) const
+TQString KexiDBConnectionSet::fileNameForConnectionData(KexiDB::ConnectionData *data) const
{
if (!data)
- return QString::null;
- QMap<KexiDB::ConnectionData*, QString>::ConstIterator it = d->filenamesForData.find( data );
- return (it == d->filenamesForData.constEnd()) ? QString::null : it.data();
+ return TQString();
+ TQMap<KexiDB::ConnectionData*, TQString>::ConstIterator it = d->filenamesForData.tqfind( data );
+ return (it == d->filenamesForData.constEnd()) ? TQString() : it.data();
}
-KexiDB::ConnectionData* KexiDBConnectionSet::connectionDataForFileName(const QString& fileName) const
+KexiDB::ConnectionData* KexiDBConnectionSet::connectionDataForFileName(const TQString& fileName) const
{
return d->dataForFilenames[fileName];
}