From 8362bf63dea22bbf6736609b0f49c152f975eb63 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 20 Jan 2010 01:29:50 +0000 Subject: Added old abandoned KDE3 version of koffice git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kexi/core/kexiprojectdata.cpp | 176 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 kexi/core/kexiprojectdata.cpp (limited to 'kexi/core/kexiprojectdata.cpp') diff --git a/kexi/core/kexiprojectdata.cpp b/kexi/core/kexiprojectdata.cpp new file mode 100644 index 000000000..68966a114 --- /dev/null +++ b/kexi/core/kexiprojectdata.cpp @@ -0,0 +1,176 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Lucijan Busch + Copyright (C) 2003-2004 Jaroslaw Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include "kexiprojectdata.h" + + +//! @internal +class KexiProjectDataPrivate +{ +public: + KexiProjectDataPrivate() + : userMode(false) + , readOnly(false) + {} + + KexiDB::ConnectionData connData; + QDateTime lastOpened; + bool userMode : 1; + bool readOnly : 1; +}; + +//--------------------------------------- + +KexiProjectData::KexiProjectData() + : QObject(0, "KexiProjectData") + , KexiDB::SchemaData() + , formatVersion(0) + , d( new KexiProjectDataPrivate() ) +{ +} + +KexiProjectData::KexiProjectData( + const KexiDB::ConnectionData &cdata, const QString& dbname, const QString& caption ) + : QObject(0, "KexiProjectData") + , KexiDB::SchemaData() + , formatVersion(0) + , d( new KexiProjectDataPrivate() ) +{ + d->connData = cdata; + setDatabaseName(dbname); + setCaption(caption); +} + +KexiProjectData::KexiProjectData( const KexiProjectData& pdata ) + : QObject(0, "KexiProjectData"), KexiDB::SchemaData() + , d( 0 ) +{ + *this = pdata; + autoopenObjects = pdata.autoopenObjects; +/* + d->connData = *pdata.connectionData(); + setDatabaseName(pdata.databaseName()); + setCaption(pdata.caption());*/ +} + +KexiProjectData::~KexiProjectData() +{ + delete d; +} + +KexiProjectData& KexiProjectData::operator=(const KexiProjectData& pdata) +{ + delete d; //this is old + static_cast(*this) = static_cast(pdata); + //deep copy + d = new KexiProjectDataPrivate(); + *d = *pdata.d; +// d->connData = *pdata.constConnectionData(); +// setDatabaseName(pdata.databaseName()); +// setCaption(pdata.caption()); +// setDescription(pdata.description()); + return *this; +} + +KexiDB::ConnectionData* KexiProjectData::connectionData() +{ + return &d->connData; +} + +const KexiDB::ConnectionData* KexiProjectData::constConnectionData() const +{ + return &d->connData; +} + +QString KexiProjectData::databaseName() const +{ + return KexiDB::SchemaData::name(); +} + +void KexiProjectData::setDatabaseName(const QString& dbName) +{ + KexiDB::SchemaData::setName(dbName); +} + +bool KexiProjectData::userMode() const +{ + return d->userMode; +} + +QDateTime KexiProjectData::lastOpened() const +{ + return d->lastOpened; +} + +void KexiProjectData::setLastOpened(const QDateTime& lastOpened) +{ + d->lastOpened=lastOpened; + +} +QString KexiProjectData::description() const +{ + return KexiDB::SchemaData::description(); +} + +void KexiProjectData::setDescription(const QString& desc) +{ + return KexiDB::SchemaData::setDescription(desc); +} + +QString KexiProjectData::infoString(bool nobr) const +{ + if (constConnectionData()->fileName().isEmpty()) { + //server-based + return QString(nobr ? "" : "") + QString("\"%1\"").arg(databaseName()) + (nobr ? "" : "") + + (nobr ? " " : " ") + i18n("database connection", "(connection %1)") + .arg(constConnectionData()->serverInfoString()) + (nobr ? "" : ""); + } + //file-based + return QString(nobr ? "" : "") + + QString("\"%1\"").arg(constConnectionData()->fileName()) + (nobr ? "" : ""); +} + +void KexiProjectData::setReadOnly(bool set) +{ + d->readOnly = set; +} + +bool KexiProjectData::isReadOnly() const +{ + return d->readOnly; +} + -- cgit v1.2.3