summaryrefslogtreecommitdiffstats
path: root/kmobile/devices/gnokii/gnokii_mobile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmobile/devices/gnokii/gnokii_mobile.cpp')
-rw-r--r--kmobile/devices/gnokii/gnokii_mobile.cpp118
1 files changed, 59 insertions, 59 deletions
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 <config.h>
#endif
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qdir.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqdir.h>
#include <klibloader.h>
#include <kconfig.h>
@@ -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; n<entry.subentries_count; n++) {
- QString s = QString(entry.subentries[n].data.number).simplifyWhiteSpace();
- GNOKII_DEBUG(QString(" Subentry#%1, entry_type=%2, number_type=%3, number=%4\n")
+ TQString s = TQString(entry.subentries[n].data.number).simplifyWhiteSpace();
+ GNOKII_DEBUG(TQString(" Subentry#%1, entry_type=%2, number_type=%3, number=%4\n")
.arg(n).arg(entry.subentries[n].entry_type)
.arg(entry.subentries[n].number_type).arg(s));
if (s.isEmpty())
@@ -430,7 +430,7 @@ static gn_error read_phone_entry_highlevel( int index, const gn_memory_type memt
a->insertEmail(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 &note )
+int KMobileGnokii::readNote( int index, TQString &note )
{
// 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"