diff options
Diffstat (limited to 'kexi/core/kexiproject.cpp')
-rw-r--r-- | kexi/core/kexiproject.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/kexi/core/kexiproject.cpp b/kexi/core/kexiproject.cpp index 741fb67a4..7a2d9367d 100644 --- a/kexi/core/kexiproject.cpp +++ b/kexi/core/kexiproject.cpp @@ -18,9 +18,9 @@ * Boston, MA 02110-1301, USA. */ -#include <qfile.h> -#include <qapplication.h> -#include <qdom.h> +#include <tqfile.h> +#include <tqapplication.h> +#include <tqdom.h> #include <kmimetype.h> #include <kdebug.h> @@ -72,15 +72,15 @@ class KexiProject::Private delete sqlParser; } - QGuardedPtr<KexiDB::Connection> connection; - QGuardedPtr<KexiProjectData> data; + TQGuardedPtr<KexiDB::Connection> connection; + TQGuardedPtr<KexiProjectData> data; - QString error_title; + TQString error_title; //! a cache for item() method, indexed by project part's ids - QIntDict<KexiPart::ItemDict> itemDictsCache; + TQIntDict<KexiPart::ItemDict> itemDictsCache; - QPtrDict<KexiPart::Item> unstoredItems; + TQPtrDict<KexiPart::Item> unstoredItems; int tempPartItemID_Counter; //!< helper for getting unique //!< temporary identifiers for unstored items KexiDB::Parser* sqlParser; @@ -96,7 +96,7 @@ class KexiProject::Private class KexiProject::ErrorTitle { public: - ErrorTitle(KexiProject* p, const QString& msg = QString::null) + ErrorTitle(KexiProject* p, const TQString& msg = TQString()) : prj(p) , prev_err_title(p->m_error_title) { @@ -107,11 +107,11 @@ class KexiProject::ErrorTitle prj->m_error_title = prev_err_title; } KexiProject* prj; - QString prev_err_title; + TQString prev_err_title; };*/ KexiProject::KexiProject(KexiProjectData *pdata, KexiDB::MessageHandler* handler) - : QObject(), Object(handler) + : TQObject(), Object(handler) , d(new Private()) { d->data = pdata; @@ -121,7 +121,7 @@ KexiProject::KexiProject(KexiProjectData *pdata, KexiDB::MessageHandler* handler KexiProject::KexiProject(KexiProjectData *pdata, KexiDB::MessageHandler* handler, KexiDB::Connection* conn) - : QObject(), Object(handler) + : TQObject(), Object(handler) , d(new Private()) { d->data = pdata; @@ -180,7 +180,7 @@ KexiProject::openInternal(bool *incompatibleWithKexi) *incompatibleWithKexi = false; kdDebug() << "KexiProject::open(): " << d->data->databaseName() <<" "<< d->data->connectionData()->driverName << endl; KexiDB::MessageTitle et(this, - i18n("Could not open project \"%1\".").arg(d->data->databaseName())); + i18n("Could not open project \"%1\".").tqarg(d->data->databaseName())); if (!createConnection()) { kdDebug() << "KexiProject::open(): !createConnection()" << endl; @@ -225,7 +225,7 @@ tristate KexiProject::create(bool forceOverwrite) { KexiDB::MessageTitle et(this, - i18n("Could not create project \"%1\".").arg(d->data->databaseName())); + i18n("Could not create project \"%1\".").tqarg(d->data->databaseName())); if (!createConnection()) return false; @@ -284,9 +284,9 @@ KexiProject::create(bool forceOverwrite) return false; if (!KexiDB::replaceRow(*d->connection, t_db, "db_property", "project_caption", - "db_value", QVariant( d->data->caption() ), KexiDB::Field::Text) + "db_value", TQVariant( d->data->caption() ), KexiDB::Field::Text) || !KexiDB::replaceRow(*d->connection, t_db, "db_property", "project_desc", - "db_value", QVariant( d->data->description() ), KexiDB::Field::Text) ) + "db_value", TQVariant( d->data->description() ), KexiDB::Field::Text) ) return false; */ if (trans.active() && !d->connection->commitTransaction(trans)) @@ -381,10 +381,10 @@ bool KexiProject::createInternalStructures(bool insideTransaction) } // 2.1 copy data (insert 0's into o_folder_id column) if (!d->connection->executeSQL( - QString::fromLatin1("INSERT INTO kexi__blobs (o_data, o_name, o_caption, o_mime, o_folder_id) " + TQString::tqfromLatin1("INSERT INTO kexi__blobs (o_data, o_name, o_caption, o_mime, o_folder_id) " "SELECT o_data, o_name, o_caption, o_mime, 0 FROM kexi__blobs") ) // 2.2 remove the original kexi__blobs - || !d->connection->executeSQL(QString::fromLatin1("DROP TABLE kexi__blobs")) //lowlevel + || !d->connection->executeSQL(TQString::tqfromLatin1("DROP TABLE kexi__blobs")) //lowlevel // 2.3 rename the copy back into kexi__blobs || !d->connection->drv_alterTableName(*kexi__blobsCopy, "kexi__blobs") ) @@ -429,12 +429,12 @@ bool KexiProject::createInternalStructures(bool insideTransaction) KexiDB::FieldList *fl = t_parts->subList("p_id", "p_name", "p_mime", "p_url"); if (partsTableOk) - partsTableOk = d->connection->insertRecord(*fl, QVariant(1), QVariant("Tables"), - QVariant("kexi/table"), QVariant("http://koffice.org/kexi/")); + partsTableOk = d->connection->insertRecord(*fl, TQVariant(1), TQVariant("Tables"), + TQVariant("kexi/table"), TQVariant("http://koffice.org/kexi/")); if (partsTableOk) - partsTableOk = d->connection->insertRecord(*fl, QVariant(2), QVariant("Queries"), - QVariant("kexi/query"), QVariant("http://koffice.org/kexi/")); + partsTableOk = d->connection->insertRecord(*fl, TQVariant(2), TQVariant("Queries"), + TQVariant("kexi/query"), TQVariant("http://koffice.org/kexi/")); } } @@ -480,7 +480,7 @@ KexiProject::createConnection() if (!d->connection->connect()) { setError(d->connection); - kdDebug() << "KexiProject::createConnection(): error connecting: " << (d->connection ? d->connection->errorMsg() : QString::null) << endl; + kdDebug() << "KexiProject::createConnection(): error connecting: " << (d->connection ? d->connection->errorMsg() : TQString()) << endl; closeConnection(); return false; } @@ -521,17 +521,17 @@ KexiProject::initProject() // !@todo put more props. todo - creator, created date, etc. (also to KexiProjectData) KexiDB::DatabaseProperties &props = d->connection->databaseProperties(); - QString str( props.value("project_caption").toString() ); + TQString str( props.value("project_caption").toString() ); if (!str.isEmpty()) d->data->setCaption( str ); str = props.value("project_desc").toString(); if (!str.isEmpty()) d->data->setDescription( str ); /* KexiDB::RowData data; - QString sql = "select db_value from kexi__db where db_property='%1'"; - if (d->connection->querySingleRecord( sql.arg("project_caption"), data ) && !data[0].toString().isEmpty()) + TQString sql = "select db_value from kexi__db where db_property='%1'"; + if (d->connection->querySingleRecord( sql.tqarg("project_caption"), data ) && !data[0].toString().isEmpty()) d->data->setCaption(data[0].toString()); - if (d->connection->querySingleRecord( sql.arg("project_desc"), data) && !data[0].toString().isEmpty()) + if (d->connection->querySingleRecord( sql.tqarg("project_desc"), data) && !data[0].toString().isEmpty()) d->data->setDescription(data[0].toString());*/ return true; @@ -560,7 +560,7 @@ KexiProject::items(KexiPart::Info *i) //retrieve: KexiDB::Cursor *cursor = d->connection->executeQuery( "SELECT o_id, o_name, o_caption FROM kexi__objects WHERE o_type = " - + QString::number(i->projectPartID()));//, KexiDB::Cursor::Buffered); + + TQString::number(i->projectPartID()));//, KexiDB::Cursor::Buffered); // kdDebug() << "KexiProject::items(): cursor handle is:" << cursor << endl; if(!cursor) return 0; @@ -573,7 +573,7 @@ KexiProject::items(KexiPart::Info *i) KexiPart::Item *it = new KexiPart::Item(); bool ok; int ident = cursor->value(0).toInt(&ok); - QString objName( cursor->value(1).toString() ); + TQString objName( cursor->value(1).toString() ); if ( ok && (ident>0) && !d->connection->isInternalTableSchema(objName) && KexiUtils::isIdentifier(objName) ) @@ -594,7 +594,7 @@ KexiProject::items(KexiPart::Info *i) } KexiPart::ItemDict* -KexiProject::itemsForMimeType(const QCString &mimeType) +KexiProject::itemsForMimeType(const TQCString &mimeType) { KexiPart::Info *info = Kexi::partManager().infoForMimeType(mimeType); return items(info); @@ -612,7 +612,7 @@ KexiProject::getSortedItems(KexiPart::ItemList& list, KexiPart::Info *i) } void -KexiProject::getSortedItemsForMimeType(KexiPart::ItemList& list, const QCString &mimeType) +KexiProject::getSortedItemsForMimeType(KexiPart::ItemList& list, const TQCString &mimeType) { KexiPart::Info *info = Kexi::partManager().infoForMimeType(mimeType); getSortedItems(list, info); @@ -632,12 +632,12 @@ KexiProject::addStoredItem(KexiPart::Info *info, KexiPart::Item *item) } KexiPart::Item* -KexiProject::itemForMimeType(const QCString &mimeType, const QString &name) +KexiProject::itemForMimeType(const TQCString &mimeType, const TQString &name) { KexiPart::ItemDict *dict = itemsForMimeType(mimeType); if (!dict) return 0; - const QString l_name = name.lower(); + const TQString l_name = name.lower(); for (KexiPart::ItemDictIterator it( *dict ); it.current(); ++it) { if (it.current()->name().lower()==l_name) return it.current(); @@ -646,12 +646,12 @@ KexiProject::itemForMimeType(const QCString &mimeType, const QString &name) } KexiPart::Item* -KexiProject::item(KexiPart::Info *i, const QString &name) +KexiProject::item(KexiPart::Info *i, const TQString &name) { KexiPart::ItemDict *dict = items(i); if (!dict) return 0; - const QString l_name = name.lower(); + const TQString l_name = name.lower(); for (KexiPart::ItemDictIterator it( *dict ); it.current(); ++it) { if (it.current()->name().lower()==l_name) return it.current(); @@ -663,8 +663,8 @@ KexiPart::Item* KexiProject::item(int identifier) { KexiPart::ItemDict *dict; - for (QIntDictIterator<KexiPart::ItemDict> it(d->itemDictsCache); (dict = it.current()); ++it) { - KexiPart::Item *item = dict->find(identifier); + for (TQIntDictIterator<KexiPart::ItemDict> it(d->itemDictsCache); (dict = it.current()); ++it) { + KexiPart::Item *item = dict->tqfind(identifier); if (item) return item; } @@ -674,10 +674,10 @@ KexiProject::item(int identifier) /*void KexiProject::clearMsg() { clearError(); -// d->error_title=QString::null; +// d->error_title=TQString(); } -void KexiProject::setError(int code, const QString &msg ) +void KexiProject::setError(int code, const TQString &msg ) { Object::setError(code, msg); if (Object::error()) @@ -686,7 +686,7 @@ void KexiProject::setError(int code, const QString &msg ) } -void KexiProject::setError( const QString &msg ) +void KexiProject::setError( const TQString &msg ) { Object::setError(msg); if (Object::error()) @@ -704,7 +704,7 @@ void KexiProject::setError( KexiDB::Object *obj ) // emit error(d->error_title, obj); } -void KexiProject::setError(const QString &msg, const QString &desc) +void KexiProject::setError(const TQString &msg, const TQString &desc) { Object::setError(msg); //ok? ERRMSG(msg, desc); //not KexiDB-related @@ -723,7 +723,7 @@ KexiPart::Part *KexiProject::findPartFor(KexiPart::Item& item) } KexiDialogBase* KexiProject::openObject(KexiMainWindow *wnd, KexiPart::Item& item, - int viewMode, QMap<QString,QString>* staticObjectArgs) + int viewMode, TQMap<TQString,TQString>* staticObjectArgs) { clearError(); if (viewMode!=Kexi::DataViewMode && data()->userMode()) @@ -735,17 +735,17 @@ KexiDialogBase* KexiProject::openObject(KexiMainWindow *wnd, KexiPart::Item& ite return 0; KexiDialogBase *dlg = part->openInstance(wnd, item, viewMode, staticObjectArgs); if (!dlg) { - if (part->lastOperationStatus().error()) - setError(i18n("Opening object \"%1\" failed.").arg(item.name())+"<br>" - +part->lastOperationStatus().message, - part->lastOperationStatus().description); + if (part->lastOperationtqStatus().error()) + setError(i18n("Opening object \"%1\" failed.").tqarg(item.name())+"<br>" + +part->lastOperationtqStatus().message, + part->lastOperationtqStatus().description); return 0; } return dlg; } -KexiDialogBase* KexiProject::openObject(KexiMainWindow *wnd, const QCString &mimeType, - const QString& name, int viewMode) +KexiDialogBase* KexiProject::openObject(KexiMainWindow *wnd, const TQCString &mimeType, + const TQString& name, int viewMode) { KexiPart::Item *it = itemForMimeType(mimeType, name); return it ? openObject(wnd, *it, viewMode) : 0; @@ -801,14 +801,14 @@ bool KexiProject::removeObject(KexiMainWindow *wnd, KexiPart::Item& item) return true; } -bool KexiProject::renameObject( KexiMainWindow *wnd, KexiPart::Item& item, const QString& _newName ) +bool KexiProject::renameObject( KexiMainWindow *wnd, KexiPart::Item& item, const TQString& _newName ) { clearError(); if (data()->userMode()) return 0; KexiUtils::WaitCursor wait; - QString newName = _newName.stripWhiteSpace(); + TQString newName = _newName.stripWhiteSpace(); { KexiDB::MessageTitle et(this); if (newName.isEmpty()) { @@ -817,13 +817,13 @@ bool KexiProject::renameObject( KexiMainWindow *wnd, KexiPart::Item& item, const } if (this->itemForMimeType(item.mimeType(), newName)!=0) { setError( i18n("Could not use this name. Object with name \"%1\" already exists.") - .arg(newName) ); + .tqarg(newName) ); return false; } } KexiDB::MessageTitle et(this, - i18n("Could not rename object \"%1\".").arg(item.name()) ); + i18n("Could not rename object \"%1\".").tqarg(item.name()) ); if (!checkWritable()) return false; KexiPart::Part *part = findPartFor(item); @@ -835,12 +835,12 @@ bool KexiProject::renameObject( KexiMainWindow *wnd, KexiPart::Item& item, const return false; } if (!part->rename(wnd, item, newName)) { - setError(part->lastOperationStatus().message, part->lastOperationStatus().description); + setError(part->lastOperationtqStatus().message, part->lastOperationtqStatus().description); return false; } if (!d->connection->executeSQL( "update kexi__objects set o_name=" + d->connection->driver()->valueToSQL( KexiDB::Field::Text, newName ) - + " where o_id=" + QString::number(item.identifier()) )) { + + " where o_id=" + TQString::number(item.identifier()) )) { setError(d->connection); return false; } @@ -848,13 +848,13 @@ bool KexiProject::renameObject( KexiMainWindow *wnd, KexiPart::Item& item, const setError(d->connection); return false; } - QCString oldName( item.name().latin1() ); + TQCString oldName( item.name().latin1() ); item.setName( newName ); emit itemRenamed(item, oldName); return true; } -KexiPart::Item* KexiProject::createPartItem(KexiPart::Info *info, const QString& suggestedCaption) +KexiPart::Item* KexiProject::createPartItem(KexiPart::Info *info, const TQString& suggestedCaption) { clearError(); if (data()->userMode()) @@ -871,8 +871,8 @@ KexiPart::Item* KexiProject::createPartItem(KexiPart::Info *info, const QString& //find new, unique default name for this item int n; - QString new_name; - QString base_name; + TQString new_name; + TQString base_name; if (suggestedCaption.isEmpty()) { n = 1; base_name = part->instanceName(); @@ -883,11 +883,11 @@ KexiPart::Item* KexiProject::createPartItem(KexiPart::Info *info, const QString& } base_name = KexiUtils::string2Identifier(base_name).lower(); KexiPart::ItemDictIterator it(*dict); - QPtrDictIterator<KexiPart::Item> itUnstored(d->unstoredItems); + TQPtrDictIterator<KexiPart::Item> itUnstored(d->unstoredItems); do { new_name = base_name; if (n>=1) - new_name += QString::number(n); + new_name += TQString::number(n); for (it.toFirst(); it.current(); ++it) { if (it.current()->name().lower()==new_name) break; @@ -908,9 +908,9 @@ KexiPart::Item* KexiProject::createPartItem(KexiPart::Info *info, const QString& if (n>=1000) return 0; - QString new_caption( suggestedCaption.isEmpty() ? part->instanceCaption() : suggestedCaption); + TQString new_caption( suggestedCaption.isEmpty() ? part->instanceCaption() : suggestedCaption); if (n>=1) - new_caption += QString::number(n); + new_caption += TQString::number(n); KexiPart::Item *item = new KexiPart::Item(); item->setIdentifier( --d->tempPartItemID_Counter );//temporary @@ -922,7 +922,7 @@ KexiPart::Item* KexiProject::createPartItem(KexiPart::Info *info, const QString& return item; } -KexiPart::Item* KexiProject::createPartItem(KexiPart::Part *part, const QString& suggestedCaption) +KexiPart::Item* KexiProject::createPartItem(KexiPart::Part *part, const TQString& suggestedCaption) { return createPartItem(part->info(), suggestedCaption); } @@ -944,7 +944,7 @@ KexiDB::Parser* KexiProject::sqlParser() return d->sqlParser; } -static const QString warningNoUndo = i18n("Warning: entire project's data will be removed."); +static const TQString warningNoUndo = i18n("Warning: entire project's data will be removed."); /*static*/ KexiProject* @@ -960,8 +960,8 @@ KexiProject::createBlankProject(bool &cancelled, KexiProjectData* data, if (KMessageBox::Yes != KMessageBox::warningYesNo(0, "<qt>"+i18n( "The project %1 already exists.\n" "Do you want to replace it with a new, blank one?") - .arg(prj->data()->infoString())+"\n"+warningNoUndo+"</qt>", - QString::null, KGuiItem(i18n("Replace")), KStdGuiItem::cancel() )) + .tqarg(prj->data()->infoString())+"\n"+warningNoUndo+"</qt>", + TQString(), KGuiItem(i18n("Replace")), KStdGuiItem::cancel() )) //todo add serverInfoString() for server-based prj { delete prj; @@ -985,7 +985,7 @@ tristate KexiProject::dropProject(KexiProjectData* data, KexiDB::MessageHandler* handler, bool dontAsk) { if (!dontAsk && KMessageBox::Yes != KMessageBox::warningYesNo(0, - i18n("Do you want to drop the project \"%1\"?").arg(data->objectName())+"\n"+warningNoUndo )) + i18n("Do you want to drop the project \"%1\"?").tqarg(data->KexiDB::SchemaData::objectName())+"\n"+warningNoUndo )) return cancelled; KexiProject prj( new KexiProjectData(*data), handler ); |