diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
commit | ffe8a83e053396df448e9413828527613ca3bd46 (patch) | |
tree | a73d4169e02df4a50f9a12cb165fcd0ab5bac7c6 /kabc/plugins/sql | |
parent | 682bf3bfdcbcbb1fca85e8a36ed03e062e0555d5 (diff) | |
download | tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.tar.gz tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kabc/plugins/sql')
-rw-r--r-- | kabc/plugins/sql/resourcesql.cpp | 74 | ||||
-rw-r--r-- | kabc/plugins/sql/resourcesql.h | 20 | ||||
-rw-r--r-- | kabc/plugins/sql/resourcesqlconfig.cpp | 30 | ||||
-rw-r--r-- | kabc/plugins/sql/resourcesqlconfig.h | 4 |
4 files changed, 64 insertions, 64 deletions
diff --git a/kabc/plugins/sql/resourcesql.cpp b/kabc/plugins/sql/resourcesql.cpp index 2e6eb6902..55f02bae7 100644 --- a/kabc/plugins/sql/resourcesql.cpp +++ b/kabc/plugins/sql/resourcesql.cpp @@ -18,8 +18,8 @@ Boston, MA 02110-1301, USA. */ -#include <qsqldatabase.h> -#include <qsqlcursor.h> +#include <tqsqldatabase.h> +#include <tqsqlcursor.h> #include <kdebug.h> #include <kglobal.h> @@ -42,7 +42,7 @@ extern "C" ResourceSql::ResourceSql( AddressBook *ab, const KConfig *config ) : Resource( ab ), mDb( 0 ) { - QString user, password, db, host; + TQString user, password, db, host; user = config->readEntry( "SqlUser" ); password = cryptStr( config->readEntry( "SqlPassword " ) ); @@ -52,15 +52,15 @@ ResourceSql::ResourceSql( AddressBook *ab, const KConfig *config ) init( user, password, db, host ); } -ResourceSql::ResourceSql( AddressBook *ab, const QString &user, - const QString &password, const QString &db, const QString &host ) +ResourceSql::ResourceSql( AddressBook *ab, const TQString &user, + const TQString &password, const TQString &db, const TQString &host ) : Resource( ab ), mDb( 0 ) { init( user, password, db, host ); } -void ResourceSql::init( const QString &user, const QString &password, - const QString &db, const QString &host ) +void ResourceSql::init( const TQString &user, const TQString &password, + const TQString &db, const TQString &host ) { mUser = user; mPassword = password; @@ -80,12 +80,12 @@ Ticket *ResourceSql::requestSaveTicket() bool ResourceSql::open() { - QStringList drivers = QSqlDatabase::drivers(); - for ( QStringList::Iterator it = drivers.begin(); it != drivers.end(); ++it ) { + TQStringList drivers = TQSqlDatabase::drivers(); + for ( TQStringList::Iterator it = drivers.begin(); it != drivers.end(); ++it ) { kdDebug(5700) << "Driver: " << (*it) << endl; } - mDb = QSqlDatabase::addDatabase( "QMYSQL3" ); + mDb = TQSqlDatabase::addDatabase( "QMYSQL3" ); if ( !mDb ) { kdDebug(5700) << "Error. Unable to connect to database." << endl; @@ -112,14 +112,14 @@ void ResourceSql::close() bool ResourceSql::load() { - QSqlQuery query( "select addressId, name, familyName, givenName, " + TQSqlQuery query( "select addressId, name, familyName, givenName, " "additionalName, prefix, suffix, nickname, birthday, " "mailer, timezone, geo_latitude, geo_longitude, title, " "role, organization, note, productId, revision, " "sortString, url from kaddressbook_main_" + mUser ); while ( query.next() ) { - QString addrId = query.value(0).toString(); + TQString addrId = query.value(0).toString(); Addressee addr; addr.setResource( this ); @@ -146,7 +146,7 @@ bool ResourceSql::load() // emails { - QSqlQuery emailsQuery( "select email, preferred from kaddressbook_emails " + TQSqlQuery emailsQuery( "select email, preferred from kaddressbook_emails " "where addressId = '" + addrId + "'" ); while ( emailsQuery.next() ) addr.insertEmail( emailsQuery.value( 0 ).toString(), @@ -155,7 +155,7 @@ bool ResourceSql::load() // phones { - QSqlQuery phonesQuery( "select number, type from kaddressbook_phones " + TQSqlQuery phonesQuery( "select number, type from kaddressbook_phones " "where addressId = '" + addrId + "'" ); while ( phonesQuery.next() ) addr.insertPhoneNumber( PhoneNumber( phonesQuery.value( 0 ).toString(), @@ -164,7 +164,7 @@ bool ResourceSql::load() // addresses { - QSqlQuery addressesQuery( "select postOfficeBox, extended, street, " + TQSqlQuery addressesQuery( "select postOfficeBox, extended, street, " "locality, region, postalCode, country, label, type " "from kaddressbook_addresses where addressId = '" + addrId + "'" ); while ( addressesQuery.next() ) { @@ -185,7 +185,7 @@ bool ResourceSql::load() // categories { - QSqlQuery categoriesQuery( "select category from kaddressbook_categories " + TQSqlQuery categoriesQuery( "select category from kaddressbook_categories " "where addressId = '" + addrId + "'" ); while ( categoriesQuery.next() ) addr.insertCategory( categoriesQuery.value( 0 ).toString() ); @@ -193,7 +193,7 @@ bool ResourceSql::load() // customs { - QSqlQuery customsQuery( "select app, name, value from kaddressbook_customs " + TQSqlQuery customsQuery( "select app, name, value from kaddressbook_customs " "where addressId = '" + addrId + "'" ); while ( customsQuery.next() ) addr.insertCustom( customsQuery.value( 0 ).toString(), @@ -210,11 +210,11 @@ bool ResourceSql::load() bool ResourceSql::save( Ticket * ) { // we have to delete all entries for this user and reinsert them - QSqlQuery query( "select addressId from kaddressbook_main_" + mUser ); + TQSqlQuery query( "select addressId from kaddressbook_main_" + mUser ); while ( query.next() ) { - QString addrId = query.value( 0 ).toString(); - QSqlQuery q; + TQString addrId = query.value( 0 ).toString(); + TQSqlQuery q; q.exec( "DELETE FROM kaddressbook_emails WHERE addressId = '" + addrId + "'" ); q.exec( "DELETE FROM kaddressbook_phones WHERE addressId = '" + addrId + "'" ); @@ -231,7 +231,7 @@ bool ResourceSql::save( Ticket * ) if ( (*it).resource() != this && (*it).resource() != 0 ) // save only my and new entries continue; - QString uid = (*it).uid(); + TQString uid = (*it).uid(); query.exec( "INSERT INTO kaddressbook_main_" + mUser + " VALUES ('" + (*it).uid() + "','" + @@ -244,9 +244,9 @@ bool ResourceSql::save( Ticket * ) (*it).nickName() + "','" + (*it).birthday().toString( Qt::ISODate ) + "','" + (*it).mailer() + "','" + - QString::number( (*it).timeZone().offset() ) + "','" + - QString::number( (*it).geo().latitude() ) + "','" + - QString::number( (*it).geo().longitude() ) + "','" + + TQString::number( (*it).timeZone().offset() ) + "','" + + TQString::number( (*it).geo().latitude() ) + "','" + + TQString::number( (*it).geo().longitude() ) + "','" + (*it).title() + "','" + (*it).role() + "','" + (*it).organization() + "','" + @@ -259,14 +259,14 @@ bool ResourceSql::save( Ticket * ) // emails { - QStringList emails = (*it).emails(); - QStringList::ConstIterator it; + TQStringList emails = (*it).emails(); + TQStringList::ConstIterator it; bool preferred = true; for( it = emails.begin(); it != emails.end(); ++it ) { query.exec("INSERT INTO kaddressbook_emails VALUES ('" + uid + "','" + (*it) + "','" + - QString::number(preferred) + "')"); + TQString::number(preferred) + "')"); preferred = false; } } @@ -279,7 +279,7 @@ bool ResourceSql::save( Ticket * ) query.exec("INSERT INTO kaddressbook_phones VALUES ('" + uid + "','" + (*it).number() + "','" + - QString::number( (*it).type() ) + "')"); + TQString::number( (*it).type() ) + "')"); } } @@ -298,14 +298,14 @@ bool ResourceSql::save( Ticket * ) (*it).postalCode() + "','" + (*it).country() + "','" + (*it).label() + "','" + - QString::number( (*it).type() ) + "')"); + TQString::number( (*it).type() ) + "')"); } } // categories { - QStringList categories = (*it).categories(); - QStringList::ConstIterator it; + TQStringList categories = (*it).categories(); + TQStringList::ConstIterator it; for( it = categories.begin(); it != categories.end(); ++it ) query.exec("INSERT INTO kaddressbook_categories VALUES ('" + uid + "','" + @@ -314,14 +314,14 @@ bool ResourceSql::save( Ticket * ) // customs { - QStringList list = (*it).customs(); - QStringList::ConstIterator it; + TQStringList list = (*it).customs(); + TQStringList::ConstIterator it; for( it = list.begin(); it != list.end(); ++it ) { int dashPos = (*it).find( '-' ); int colonPos = (*it).find( ':' ); - QString app = (*it).left( dashPos ); - QString name = (*it).mid( dashPos + 1, colonPos - dashPos - 1 ); - QString value = (*it).right( (*it).length() - colonPos - 1 ); + TQString app = (*it).left( dashPos ); + TQString name = (*it).mid( dashPos + 1, colonPos - dashPos - 1 ); + TQString value = (*it).right( (*it).length() - colonPos - 1 ); query.exec("INSERT INTO kaddressbook_categories VALUES ('" + uid + "','" + app + "','" + name + "','" + value + "')"); @@ -332,7 +332,7 @@ bool ResourceSql::save( Ticket * ) return true; } -QString ResourceSql::identifier() const +TQString ResourceSql::identifier() const { return mHost + "_" + mDbName; } diff --git a/kabc/plugins/sql/resourcesql.h b/kabc/plugins/sql/resourcesql.h index c0b61b69b..a5fc60b55 100644 --- a/kabc/plugins/sql/resourcesql.h +++ b/kabc/plugins/sql/resourcesql.h @@ -33,8 +33,8 @@ namespace KABC { class ResourceSql : public Resource { public: - ResourceSql( AddressBook *ab, const QString &user, const QString &password, - const QString &db, const QString &host ); + ResourceSql( AddressBook *ab, const TQString &user, const TQString &password, + const TQString &db, const TQString &host ); ResourceSql( AddressBook *ab, const KConfig * ); bool open(); @@ -45,18 +45,18 @@ public: bool load(); bool save( Ticket * ticket ); - QString identifier() const; + TQString identifier() const; private: - void init(const QString &user, const QString &password, - const QString &db, const QString &host ); + void init(const TQString &user, const TQString &password, + const TQString &db, const TQString &host ); - QString mUser; - QString mPassword; - QString mDbName; - QString mHost; + TQString mUser; + TQString mPassword; + TQString mDbName; + TQString mHost; - QSqlDatabase *mDb; + TQSqlDatabase *mDb; }; } diff --git a/kabc/plugins/sql/resourcesqlconfig.cpp b/kabc/plugins/sql/resourcesqlconfig.cpp index d9abffa30..ef1651cde 100644 --- a/kabc/plugins/sql/resourcesqlconfig.cpp +++ b/kabc/plugins/sql/resourcesqlconfig.cpp @@ -18,10 +18,10 @@ Boston, MA 02110-1301, USA. */ -#include <qlabel.h> -#include <qlayout.h> -#include <qspinbox.h> -#include <qvbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqspinbox.h> +#include <tqvbox.h> #include <klineedit.h> #include <klocale.h> @@ -31,43 +31,43 @@ using namespace KABC; -ResourceSqlConfig::ResourceSqlConfig( QWidget* parent, const char* name ) +ResourceSqlConfig::ResourceSqlConfig( TQWidget* parent, const char* name ) : ResourceConfigWidget( parent, name ) { resize( 290, 170 ); - QGridLayout *mainLayout = new QGridLayout( this, 4, 2 ); + TQGridLayout *mainLayout = new TQGridLayout( this, 4, 2 ); - QLabel *label = new QLabel( i18n( "Username:" ), this ); + TQLabel *label = new TQLabel( i18n( "Username:" ), this ); mUser = new KLineEdit( this ); mainLayout->addWidget( label, 0, 0 ); mainLayout->addWidget( mUser, 0, 1 ); - label = new QLabel( i18n( "Password:" ), this ); + label = new TQLabel( i18n( "Password:" ), this ); mPassword = new KLineEdit( this ); mPassword->setEchoMode( KLineEdit::Password ); mainLayout->addWidget( label, 1, 0 ); mainLayout->addWidget( mPassword, 1, 1 ); - label = new QLabel( i18n( "Host:" ), this ); + label = new TQLabel( i18n( "Host:" ), this ); mHost = new KLineEdit( this ); mainLayout->addWidget( label, 2, 0 ); mainLayout->addWidget( mHost, 2, 1 ); - label = new QLabel( i18n( "Port:" ), this ); - QVBox *box = new QVBox(this); - mPort = new QSpinBox(0, 65535, 1, box ); - mPort->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred)); + label = new TQLabel( i18n( "Port:" ), this ); + TQVBox *box = new TQVBox(this); + mPort = new TQSpinBox(0, 65535, 1, box ); + mPort->setSizePolicy(TQSizePolicy(TQSizePolicy::Maximum, TQSizePolicy::Preferred)); mPort->setValue(389); - new QWidget(box, "dummy"); + new TQWidget(box, "dummy"); mainLayout->addWidget( label, 3, 0 ); mainLayout->addWidget( box, 3, 1 ); - label = new QLabel( i18n( "Database:" ), this ); + label = new TQLabel( i18n( "Database:" ), this ); mDbName = new KLineEdit( this ); mainLayout->addWidget( label, 4, 0 ); diff --git a/kabc/plugins/sql/resourcesqlconfig.h b/kabc/plugins/sql/resourcesqlconfig.h index d7230870e..cb96563b7 100644 --- a/kabc/plugins/sql/resourcesqlconfig.h +++ b/kabc/plugins/sql/resourcesqlconfig.h @@ -33,7 +33,7 @@ class ResourceSqlConfig : public ResourceConfigWidget Q_OBJECT public: - ResourceSqlConfig( QWidget* parent = 0, const char* name = 0 ); + ResourceSqlConfig( TQWidget* parent = 0, const char* name = 0 ); public slots: void loadSettings( KConfig *config ); @@ -44,7 +44,7 @@ private: KLineEdit* mPassword; KLineEdit* mDbName; KLineEdit* mHost; - QSpinBox* mPort; + TQSpinBox* mPort; }; } |