From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmobile/devices/gnokii/gnokii_mobile.cpp | 118 +++++++++++++++---------------- kmobile/devices/gnokii/gnokii_mobile.h | 26 +++---- kmobile/devices/gnokii/gnokiiconfig.cpp | 30 ++++---- kmobile/devices/gnokii/gnokiiconfig.h | 10 +-- 4 files changed, 92 insertions(+), 92 deletions(-) (limited to 'kmobile/devices/gnokii') diff --git a/kmobile/devices/gnokii/gnokii_mobile.cpp b/kmobile/devices/gnokii/gnokii_mobile.cpp index 871442847..7061493ac 100644 --- a/kmobile/devices/gnokii/gnokii_mobile.cpp +++ b/kmobile/devices/gnokii/gnokii_mobile.cpp @@ -21,9 +21,9 @@ #include #endif -#include -#include -#include +#include +#include +#include #include #include @@ -48,7 +48,7 @@ #define GNOKII_CHECK_ERROR(error) \ do { \ if (error) \ - PRINT_DEBUG << QString("ERROR %1: %2\n").arg(error).arg(gn_error_print(error));\ + PRINT_DEBUG << TQString("ERROR %1: %2\n").arg(error).arg(gn_error_print(error));\ } while (0) @@ -56,8 +56,8 @@ K_EXPORT_COMPONENT_FACTORY( libkmobile_gnokii, KMobileGnokii() ) /* createObject needs to be reimplemented by every KMobileDevice driver */ -QObject *KMobileGnokii::createObject( QObject *parent, const char *name, - const char *, const QStringList &args ) +TQObject *KMobileGnokii::createObject( TQObject *parent, const char *name, + const char *, const TQStringList &args ) { return new KMobileGnokii( parent, name, args ); } @@ -66,7 +66,7 @@ QObject *KMobileGnokii::createObject( QObject *parent, const char *name, static char *BinDir; static char *lockfile = NULL; static char model[GN_MODEL_MAX_LENGTH+1], revision[GN_REVISION_MAX_LENGTH+1], imei[GN_IMEI_MAX_LENGTH+1]; -static QString PhoneProductId; +static TQString PhoneProductId; static gn_statemachine state; static gn_data data; @@ -77,7 +77,7 @@ static gn_calnote_list calnote_list; * The KDE gnokii mobile device driver. */ -KMobileGnokii::KMobileGnokii(QObject *obj, const char *name, const QStringList &args ) +KMobileGnokii::KMobileGnokii(TQObject *obj, const char *name, const TQStringList &args ) : KMobileDevice(obj, name, args) { // set initial device info @@ -103,7 +103,7 @@ KMobileGnokii::KMobileGnokii(QObject *obj, const char *name, const QStringList & m_baud = "9600"; } - PRINT_DEBUG << QString("Using GNOKII configuration: %1 %2 %3 %4\n").arg(m_modelnr) + PRINT_DEBUG << TQString("Using GNOKII configuration: %1 %2 %3 %4\n").arg(m_modelnr) .arg(m_connection).arg(m_port).arg(m_baud); saveDeviceConfiguration(); @@ -119,7 +119,7 @@ KMobileGnokii::~KMobileGnokii() * GNOKII lowlevel interface ******************************************************************************************/ -static gn_connection_type connectionToValue( QString connectionName ) +static gn_connection_type connectionToValue( TQString connectionName ) { if (connectionName == "serial") return GN_CT_Serial; @@ -154,7 +154,7 @@ bool KMobileGnokii::setGnokiiStateMachine() return true; } -bool KMobileGnokii::saveConfig( KConfig &conf, QString group ) +bool KMobileGnokii::saveConfig( KConfig &conf, TQString group ) { conf.setGroup(group); conf.writeEntry("model", m_modelnr ); @@ -170,7 +170,7 @@ bool KMobileGnokii::saveConfig( KConfig &conf, QString group ) return true; } -bool KMobileGnokii::loadConfig( KConfig &conf, QString group ) +bool KMobileGnokii::loadConfig( KConfig &conf, TQString group ) { conf.setGroup(group); m_modelnr = conf.readEntry("model", m_modelnr ); @@ -182,13 +182,13 @@ bool KMobileGnokii::loadConfig( KConfig &conf, QString group ) bool KMobileGnokii::saveGnokiiConfiguration() { - KConfig conf( QDir::homeDirPath() + "/.gnokiirc", false, false, "" ); + KConfig conf( TQDir::homeDirPath() + "/.gnokiirc", false, false, "" ); return saveConfig( conf, "global" ); } bool KMobileGnokii::loadGnokiiConfiguration() { - KConfig conf( QDir::homeDirPath() + "/.gnokiirc", true, false, "" ); + KConfig conf( TQDir::homeDirPath() + "/.gnokiirc", true, false, "" ); return loadConfig( conf, "global" ); } @@ -209,7 +209,7 @@ static void busterminate(void) if (lockfile) gn_device_unlock(lockfile); } -static QString businit(void) +static TQString businit(void) { gn_error error; char *aux; @@ -264,12 +264,12 @@ static QString businit(void) GNOKII_CHECK_ERROR(error); data.imei = NULL; - GNOKII_DEBUG( QString("Found mobile phone: Model: %1, Revision: %2, IMEI: %3\n") + GNOKII_DEBUG( TQString("Found mobile phone: Model: %1, Revision: %2, IMEI: %3\n") .arg(model).arg(revision).arg(imei) ); - PhoneProductId = QString("%1-%2-%3-%4").arg(APP).arg(model).arg(revision).arg(imei); + PhoneProductId = TQString("%1-%2-%3-%4").arg(APP).arg(model).arg(revision).arg(imei); - return QString::null; + return TQString::null; } @@ -298,7 +298,7 @@ static gn_error read_phone_memstat( gn_memory_type memtype, gn_memory_status *me break; } } - GNOKII_DEBUG( QString("\n\nMobile phone memory status: Type: %1, used=%2, free=%3, total=%4\n\n") + GNOKII_DEBUG( TQString("\n\nMobile phone memory status: Type: %1, used=%2, free=%3, total=%4\n\n") .arg(memtype).arg(memstat->used).arg(memstat->free).arg(memstat->used+memstat->free) ); return error; } @@ -360,8 +360,8 @@ static int gn_error2kio_error( gn_error err ) static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memtype, KABC::Addressee *a ) { gn_phonebook_entry entry; - QStringList addrlist; - QString s, country; + TQStringList addrlist; + TQString s, country; KABC::Address *addr; gn_error error; @@ -372,21 +372,21 @@ static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memt if (error != GN_ERR_NONE) return error; - GNOKII_DEBUG(QString("%1: %2, num=%3, location=%4, group=%5, count=%6\n").arg(index).arg(entry.name) + GNOKII_DEBUG(TQString("%1: %2, num=%3, location=%4, group=%5, count=%6\n").arg(index).arg(entry.name) .arg(entry.number).arg(entry.location).arg(entry.caller_group).arg(entry.subentries_count)); // try to split Name into FamilyName and GivenName - s = QString(entry.name).simplifyWhiteSpace(); + s = TQString(entry.name).simplifyWhiteSpace(); a->setFormattedName(s); if (s.find(',')!=-1) { - addrlist = QStringList::split(',', s); + addrlist = TQStringList::split(',', s); if (addrlist.count()==2) { a->setFamilyName(addrlist[0].simplifyWhiteSpace()); a->setGivenName(addrlist[1].simplifyWhiteSpace()); } else a->setGivenName(s); } else { - addrlist = QStringList::split(' ', s); + addrlist = TQStringList::split(' ', s); if (addrlist.count()==2) { a->setFamilyName(addrlist[1].simplifyWhiteSpace()); a->setGivenName(addrlist[0].simplifyWhiteSpace()); @@ -395,19 +395,19 @@ static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memt } a->insertCustom(APP, "X_GSM_CALLERGROUP", s.setNum(entry.caller_group)); - a->insertCustom(APP, "X_GSM_STORE_AT", QString("%1_%2").arg(GN_MT_ME).arg(entry.location)); + a->insertCustom(APP, "X_GSM_STORE_AT", TQString("%1_%2").arg(GN_MT_ME).arg(entry.location)); // set ProductId a->setProductId(PhoneProductId); // evaluate timestamp (ignore timezone) - QDateTime datetime; + TQDateTime datetime; if (entry.date.year<1998) - datetime = QDateTime::currentDateTime(); + datetime = TQDateTime::currentDateTime(); else - datetime = QDateTime( QDate(entry.date.year, entry.date.month, entry.date.day), - QTime(entry.date.hour, entry.date.minute, entry.date.second) ); - GNOKII_DEBUG(QString(" date=%1\n").arg(datetime.toString())); + datetime = TQDateTime( TQDate(entry.date.year, entry.date.month, entry.date.day), + TQTime(entry.date.hour, entry.date.minute, entry.date.second) ); + GNOKII_DEBUG(TQString(" date=%1\n").arg(datetime.toString())); a->setRevision(datetime); if (!entry.subentries_count) @@ -416,8 +416,8 @@ static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memt /* scan sub-entries */ if (entry.subentries_count) for (int n=0; ninsertEmail(s); break; case GN_PHONEBOOK_ENTRY_Postal: - addrlist = QStringList::split(',', s, true); + addrlist = TQStringList::split(',', s, true); addr = new KABC::Address(KABC::Address::Work); switch (addrlist.count()) { case 4: addr->setStreet(addrlist[0].simplifyWhiteSpace()); @@ -477,7 +477,7 @@ static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memt a->insertCategory(s); break; default: - GNOKII_DEBUG(QString(" Not handled id=%1, entry=%2\n") + GNOKII_DEBUG(TQString(" Not handled id=%1, entry=%2\n") .arg(entry.subentries[n].entry_type).arg(s)); break; } // switch() @@ -494,32 +494,32 @@ static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memt // connect the device and ask user to turn device on (if necessary) -bool KMobileGnokii::connectDevice(QWidget * /*parent*/) +bool KMobileGnokii::connectDevice(TQWidget * /*parent*/) { if (connected()) return true; - QString err = businit(); + TQString err = businit(); m_connected = err.isEmpty(); - PRINT_DEBUG << QString("connectDevice() : %1\n").arg(m_connected ? "Ok" : err); + PRINT_DEBUG << TQString("connectDevice() : %1\n").arg(m_connected ? "Ok" : err); return m_connected; } // disconnect the device and return true, if sucessful -bool KMobileGnokii::disconnectDevice(QWidget * /*parent*/) +bool KMobileGnokii::disconnectDevice(TQWidget * /*parent*/) { if (!connected()) return true; busterminate(); m_connected = false; - PRINT_DEBUG << QString("disconnectDevice() : %1\n").arg("done"); + PRINT_DEBUG << TQString("disconnectDevice() : %1\n").arg("done"); return true; } // provice the own configuration dialog -bool KMobileGnokii::configDialog(QWidget *parent) +bool KMobileGnokii::configDialog(TQWidget *parent) { - QString model, connection, port, baud; + TQString model, connection, port, baud; int ok = 0; GnokiiConfig *dialog = new GnokiiConfig(parent); if (dialog) { @@ -528,7 +528,7 @@ bool KMobileGnokii::configDialog(QWidget *parent) } dialog->getValues(model, connection, port, baud); delete dialog; - if (ok == QDialog::Accepted) { + if (ok == TQDialog::Accepted) { m_modelnr = model; m_connection = connection; m_port = port; @@ -538,16 +538,16 @@ bool KMobileGnokii::configDialog(QWidget *parent) return true; } -QString KMobileGnokii::iconFileName() const +TQString KMobileGnokii::iconFileName() const { return "mobile_phone"; } // return a unique ID, e.g. the IMEI number of phones, or a serial number // this String is used to have a unique identification for syncronisation. -QString KMobileGnokii::deviceUniqueID() +TQString KMobileGnokii::deviceUniqueID() { - return QString("GNOKII-IMEI-%1").arg(QString::fromLocal8Bit(imei)); + return TQString("GNOKII-IMEI-%1").arg(TQString::fromLocal8Bit(imei)); } @@ -587,7 +587,7 @@ int KMobileGnokii::numAddresses() int KMobileGnokii::readAddress( int index, KABC::Addressee &addr ) { - PRINT_DEBUG << QString("############ GET ADDRESS #%1\n").arg(index); + PRINT_DEBUG << TQString("############ GET ADDRESS #%1\n").arg(index); // index is zero-based, but in gnokii the first address starts at 1 if (index<0 || index>=numAddresses()) return KIO::ERR_DOES_NOT_EXIST; @@ -619,7 +619,7 @@ int KMobileGnokii::storeAddress( int, const KABC::Addressee &, bool ) * Calendar support * **********************************************************************************/ -static void QDateTime_2_timestamp( const QDateTime &qdt, gn_timestamp &ts ) +static void QDateTime_2_timestamp( const TQDateTime &qdt, gn_timestamp &ts ) { ts.year = qdt.date().year(); ts.month = qdt.date().month(); @@ -630,10 +630,10 @@ static void QDateTime_2_timestamp( const QDateTime &qdt, gn_timestamp &ts ) ts.timezone = 0; } -static QDateTime timestamp_2_QDateTime( const gn_timestamp &ts ) +static TQDateTime timestamp_2_QDateTime( const gn_timestamp &ts ) { - return QDateTime( QDate(ts.year, ts.month, ts.day), - QTime(ts.hour, ts.minute, ts.second) ); + return TQDateTime( TQDate(ts.year, ts.month, ts.day), + TQTime(ts.hour, ts.minute, ts.second) ); } static void print_calnote( const gn_calnote &entry ) @@ -700,11 +700,11 @@ int KMobileGnokii::readCalendarEntry( int index, KCal::Event &event ) print_calnote( entry ); - QDateTime dt_start = timestamp_2_QDateTime(entry.time); - QDateTime dt_end = dt_start.addSecs( 60*60 ); // XXX: assume one hour + TQDateTime dt_start = timestamp_2_QDateTime(entry.time); + TQDateTime dt_end = dt_start.addSecs( 60*60 ); // XXX: assume one hour event.setDtStart( dt_start ); event.setDtEnd( dt_end ); - event.setSummary( QString::fromUtf8(entry.text) ); + event.setSummary( TQString::fromUtf8(entry.text) ); // type: switch (entry.type) { @@ -713,7 +713,7 @@ int KMobileGnokii::readCalendarEntry( int index, KCal::Event &event ) break; case GN_CALNOTE_CALL: event.setCategories(i18n("PHONE CALL")); - event.setDescription(QString::fromUtf8(entry.phone_number)); + event.setDescription(TQString::fromUtf8(entry.phone_number)); break; case GN_CALNOTE_BIRTHDAY: event.setCategories(i18n("BIRTHDAY")); @@ -727,7 +727,7 @@ int KMobileGnokii::readCalendarEntry( int index, KCal::Event &event ) // alarm: if (entry.alarm.enabled) { - QDateTime at = timestamp_2_QDateTime(entry.alarm.timestamp); + TQDateTime at = timestamp_2_QDateTime(entry.alarm.timestamp); if (at.isValid() && dt_start.isValid()) { int seconds = abs(at.secsTo(dt_start)); seconds %= 60*60*24; /* max. 1 day in advance... */ @@ -805,7 +805,7 @@ int KMobileGnokii::storeCalendarEntry( int index, const KCal::Event &event ) QDateTime_2_timestamp( eventalarm->time(), entry.alarm.timestamp ); } else if (eventalarm->hasStartOffset()) { - QDateTime dt = event.dtStart(); + TQDateTime dt = event.dtStart(); dt = dt.addSecs(-eventalarm->startOffset().asSeconds()); QDateTime_2_timestamp( dt, entry.alarm.timestamp ); } @@ -858,13 +858,13 @@ int KMobileGnokii::numNotes() return 100; /* we simulate one address */ } -int KMobileGnokii::readNote( int index, QString ¬e ) +int KMobileGnokii::readNote( int index, TQString ¬e ) { // index is zero-based, and we only have one simulated note if (index<0 || index>=numNotes()) return KIO::ERR_DOES_NOT_EXIST; - note = QString("NOTE #%1\n" + note = TQString("NOTE #%1\n" "--------\n" "This is a sample note #%2\n\n" "DeviceClassName: %3\n" diff --git a/kmobile/devices/gnokii/gnokii_mobile.h b/kmobile/devices/gnokii/gnokii_mobile.h index fdc61e30e..6be2196a0 100644 --- a/kmobile/devices/gnokii/gnokii_mobile.h +++ b/kmobile/devices/gnokii/gnokii_mobile.h @@ -31,24 +31,24 @@ class KMobileGnokii : public KMobileDevice { Q_OBJECT public: - KMobileGnokii( QObject *obj=0, const char *name=0, const QStringList &args=QStringList() ); + KMobileGnokii( TQObject *obj=0, const char *name=0, const TQStringList &args=TQStringList() ); ~KMobileGnokii(); // createObject needs to be reimplemented by every KMobileDevice driver - QObject *createObject( QObject *parent=0, const char *name=0, - const char *classname="QObject", const QStringList &args=QStringList() ); + TQObject *createObject( TQObject *parent=0, const char *name=0, + const char *classname="TQObject", const TQStringList &args=TQStringList() ); // connect, disconnect and current status - bool connectDevice(QWidget *parent); - bool disconnectDevice(QWidget *parent); + bool connectDevice(TQWidget *parent); + bool disconnectDevice(TQWidget *parent); // provide a device-specific configure dialog - bool configDialog(QWidget *parent); + bool configDialog(TQWidget *parent); // filename and path to gnokii-icon - QString iconFileName() const; + TQString iconFileName() const; - QString deviceUniqueID(); + TQString deviceUniqueID(); /* * Addressbook / Phonebook support @@ -68,23 +68,23 @@ public: * Notes support */ int numNotes(); - int readNote( int index, QString ¬e ); + int readNote( int index, TQString ¬e ); signals: void connectionChanged( bool connected ); - void message( int msgLevel, const QString &msg ); + void message( int msgLevel, const TQString &msg ); protected: bool setGnokiiStateMachine(); - bool saveConfig( KConfig &conf, QString group ); - bool loadConfig( KConfig &conf, QString group ); + bool saveConfig( KConfig &conf, TQString group ); + bool loadConfig( KConfig &conf, TQString group ); bool saveGnokiiConfiguration(); bool loadGnokiiConfiguration(); bool saveDeviceConfiguration(); bool loadDeviceConfiguration(); private: - QString m_modelnr, m_connection, m_port, m_baud; + TQString m_modelnr, m_connection, m_port, m_baud; int m_numAddresses; KABC::Addressee::List m_addrList; diff --git a/kmobile/devices/gnokii/gnokiiconfig.cpp b/kmobile/devices/gnokii/gnokiiconfig.cpp index 780dc23ce..07bc46f46 100644 --- a/kmobile/devices/gnokii/gnokiiconfig.cpp +++ b/kmobile/devices/gnokii/gnokiiconfig.cpp @@ -17,11 +17,11 @@ */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "gnokiiconfigui.h" #include "gnokiiconfig.h" @@ -43,19 +43,19 @@ #define BAUDRATES "57600 38400 19200 14400 9600 4800 2400" -GnokiiConfig::GnokiiConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) +GnokiiConfig::GnokiiConfig( TQWidget* parent, const char* name, bool modal, WFlags fl ) : GnokiiConfigUI(parent, name, modal, fl) { - QStringList list = QStringList::split(" ", MODELS); + TQStringList list = TQStringList::split(" ", MODELS); cb_Model->insertStringList(list); - list = QStringList::split(" ", CONNECTIONS); + list = TQStringList::split(" ", CONNECTIONS); cb_Connection->insertStringList(list); - list = QStringList::split(" ", AVAILABLE_PORTS); + list = TQStringList::split(" ", AVAILABLE_PORTS); cb_Port->insertStringList(list); - list = QStringList::split(" ", BAUDRATES); + list = TQStringList::split(" ", BAUDRATES); cb_Baud->insertStringList(list); } @@ -63,7 +63,7 @@ GnokiiConfig::~GnokiiConfig() { } -void GnokiiConfig::setValues(const QString &model, const QString &connection, const QString &port, const QString &baud) +void GnokiiConfig::setValues(const TQString &model, const TQString &connection, const TQString &port, const TQString &baud) { cb_Model->setCurrentText(model); cb_Connection->setCurrentText(connection); @@ -72,10 +72,10 @@ void GnokiiConfig::setValues(const QString &model, const QString &connection, co slotCheckValues(); - connect( cb_Connection, SIGNAL(textChanged(const QString &)), this, SLOT(slotCheckValues(const QString &)) ); + connect( cb_Connection, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slotCheckValues(const TQString &)) ); } -void GnokiiConfig::getValues(QString &model, QString &connection, QString &port, QString &baud) const +void GnokiiConfig::getValues(TQString &model, TQString &connection, TQString &port, TQString &baud) const { model = cb_Model->currentText(); connection = cb_Connection->currentText(); @@ -83,9 +83,9 @@ void GnokiiConfig::getValues(QString &model, QString &connection, QString &port, baud = cb_Baud->currentText(); } -void GnokiiConfig::slotCheckValues(const QString &txt) +void GnokiiConfig::slotCheckValues(const TQString &txt) { - bool disable_serial = (QString("infrared irda").find(txt,0,false)>=0); + bool disable_serial = (TQString("infrared irda").find(txt,0,false)>=0); textLabelBaudRate->setDisabled(disable_serial); cb_Baud->setDisabled(disable_serial); } diff --git a/kmobile/devices/gnokii/gnokiiconfig.h b/kmobile/devices/gnokii/gnokiiconfig.h index 662386010..30f548bf3 100644 --- a/kmobile/devices/gnokii/gnokiiconfig.h +++ b/kmobile/devices/gnokii/gnokiiconfig.h @@ -19,7 +19,7 @@ #ifndef GNOKIICONFIG_H #define GNOKIICONFIG_H -#include +#include #include @@ -27,15 +27,15 @@ class GnokiiConfig : public GnokiiConfigUI { Q_OBJECT public: - GnokiiConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + GnokiiConfig( TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~GnokiiConfig(); - void setValues(const QString &model, const QString &connection, const QString &port, const QString &baud); - void getValues(QString &model, QString &connection, QString &port, QString &baud) const; + void setValues(const TQString &model, const TQString &connection, const TQString &port, const TQString &baud); + void getValues(TQString &model, TQString &connection, TQString &port, TQString &baud) const; private slots: void slotCheckValues(); - void slotCheckValues(const QString &); + void slotCheckValues(const TQString &); }; #endif -- cgit v1.2.1