summaryrefslogtreecommitdiffstats
path: root/kandy/src/mobilegui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kandy/src/mobilegui.cpp')
-rw-r--r--kandy/src/mobilegui.cpp190
1 files changed, 95 insertions, 95 deletions
diff --git a/kandy/src/mobilegui.cpp b/kandy/src/mobilegui.cpp
index 37466090..14c82838 100644
--- a/kandy/src/mobilegui.cpp
+++ b/kandy/src/mobilegui.cpp
@@ -24,15 +24,15 @@
#include <time.h>
-#include <qlabel.h>
-#include <qlistview.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qmessagebox.h>
+#include <tqlabel.h>
+#include <tqlistview.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqmessagebox.h>
-#include <qtextedit.h>
-#include <qgroupbox.h>
-#include <qpushbutton.h>
+#include <tqtextedit.h>
+#include <tqgroupbox.h>
+#include <tqpushbutton.h>
#include <kdebug.h>
#include <kfiledialog.h>
@@ -71,8 +71,8 @@ class SyncEntry
class SyncEntryKab : public SyncEntry
{
public:
- SyncEntryKab( bool on, const QString &index, const QString &name,
- const QString &phone )
+ SyncEntryKab( bool on, const TQString &index, const TQString &name,
+ const TQString &phone )
{
mOn = on;
@@ -84,9 +84,9 @@ class SyncEntryKab : public SyncEntry
mPhoneNumberIndex = -1;
}
- QString mIndex;
- QString mName;
- QString mPhone;
+ TQString mIndex;
+ TQString mName;
+ TQString mPhone;
KABC::Addressee mAddressee;
int mKABindex;
@@ -97,8 +97,8 @@ class SyncEntryKab : public SyncEntry
class SyncEntryMobile : public SyncEntry
{
public:
- SyncEntryMobile( bool on, const QString &index, const QString &phone,
- const QString &name )
+ SyncEntryMobile( bool on, const TQString &index, const TQString &phone,
+ const TQString &name )
{
mOn = on;
mToBeDeleted = false;
@@ -108,9 +108,9 @@ class SyncEntryMobile : public SyncEntry
mPhone = phone;
}
- QString mIndex;
- QString mName;
- QString mPhone;
+ TQString mIndex;
+ TQString mName;
+ TQString mPhone;
bool mToBeDeleted;
};
@@ -142,24 +142,24 @@ class AddressSyncer
mCommonEntries.setAutoDelete( true );
}
- QPtrList<SyncEntryKab> mKabEntries;
- QPtrList<SyncEntryMobile> mMobileEntries;
- QPtrList<SyncEntryCommon> mCommonEntries;
+ TQPtrList<SyncEntryKab> mKabEntries;
+ TQPtrList<SyncEntryMobile> mMobileEntries;
+ TQPtrList<SyncEntryCommon> mCommonEntries;
};
class PhoneBookItem : public QCheckListItem
{
public:
- PhoneBookItem( QListView *v ) :
- QCheckListItem( v, "", QCheckListItem::CheckBox )
+ PhoneBookItem( TQListView *v ) :
+ TQCheckListItem( v, "", TQCheckListItem::CheckBox )
{
mSyncEntry = 0;
}
- PhoneBookItem( QListView *v, SyncEntry *syncEntry, const QString &name,
- const QString &phone, const QString &index ) :
- QCheckListItem( v, index, QCheckListItem::CheckBox )
+ PhoneBookItem( TQListView *v, SyncEntry *syncEntry, const TQString &name,
+ const TQString &phone, const TQString &index ) :
+ TQCheckListItem( v, index, TQCheckListItem::CheckBox )
{
mSyncEntry = syncEntry;
@@ -183,7 +183,7 @@ class PhoneBookItem : public QCheckListItem
* TRUE to construct a modal dialog.
*/
MobileGui::MobileGui( CommandScheduler *scheduler, KandyPrefs *kprefs,
- QWidget* parent, const char* name, WFlags fl ) :
+ TQWidget* parent, const char* name, WFlags fl ) :
DCOPObject( "KandyIface" ), MobileGui_base( parent, name, fl )
{
// Setup links to related classes
@@ -220,10 +220,10 @@ MobileGui::MobileGui( CommandScheduler *scheduler, KandyPrefs *kprefs,
setMobState( UNLOADED );
// Setup signal handlers
- connect( mScheduler, SIGNAL( commandProcessed( ATCommand * ) ),
- SLOT( processResult( ATCommand * ) ) );
- connect( mScheduler->modem(), SIGNAL( gotLine( const char * ) ),
- SLOT( termAddOutput( const char * ) ) );
+ connect( mScheduler, TQT_SIGNAL( commandProcessed( ATCommand * ) ),
+ TQT_SLOT( processResult( ATCommand * ) ) );
+ connect( mScheduler->modem(), TQT_SIGNAL( gotLine( const char * ) ),
+ TQT_SLOT( termAddOutput( const char * ) ) );
}
@@ -282,7 +282,7 @@ void MobileGui::readPhonebook()
mComingFromReadPhonebook = true;
if ( !warnMobState( LOADED ) ) {
mComingFromReadPhonebook = false;
- QString tmp = "";
+ TQString tmp = "";
ATCommand *cmd = new ATCommand( "+cpbr=" );
cmd->setAutoDelete( true );
@@ -345,13 +345,13 @@ void MobileGui::writePhonebook()
for ( uint i = 0; i < mSyncer->mMobileEntries.count(); i++ ) {
SyncEntryMobile *entry = mSyncer->mMobileEntries.at( i );
- QString id;
+ TQString id;
// Only process changed items of the mobile phonebook in
// order to save time.
if ( entry->mToBeUpdated || entry->mToBeInserted ) {
- QString tmp = "";
+ TQString tmp = "";
if ( entry->mToBeUpdated ) {
@@ -403,7 +403,7 @@ void MobileGui::writePhonebook()
if ( !mPBIndexOccupied[ theIndex - mPBStartIndex ] ) {
// Index of item to be deleted still is 0, so that index position
// wasn't reused. We must delete it explicitly.
- QString id = "+cpbw=" + entry->mIndex;
+ TQString id = "+cpbw=" + entry->mIndex;
mLastWriteId = id;
@@ -441,7 +441,7 @@ void MobileGui::writePhonebookPostProcessing()
} else
if ( mComingFromReadPhonebook ) {
mComingFromReadPhonebook = false;
- QString tmp = "";
+ TQString tmp = "";
ATCommand *cmd = new ATCommand( "+cpbr=" );
cmd->setAutoDelete( true );
@@ -463,7 +463,7 @@ void MobileGui::writePhonebookPostProcessing()
void MobileGui::setClock()
{
char *timeStr = new char[50];
- QString id = "+cclk=";
+ TQString id = "+cclk=";
ATCommand *cmd = new ATCommand( id );
@@ -474,7 +474,7 @@ void MobileGui::setClock()
struct tm *theTime = localtime( &tloc );
strftime( timeStr, 50, "%y/%m/%d,%T+00", theTime );
- QString Time = timeStr;
+ TQString Time = timeStr;
cmd->addParameter( new ATParameter( quote( Time ) ) );
mScheduler->execute( cmd );
@@ -500,7 +500,7 @@ void MobileGui::readKabc()
for ( it = addressBook->begin(); it != addressBook->end();
it++, kabIndex++ ) {
- QString index, name;
+ TQString index, name;
KABC::PhoneNumber phoneNumber;
KABC::PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
KABC::PhoneNumber::List::Iterator it2;
@@ -512,7 +512,7 @@ void MobileGui::readKabc()
it2++, phoneNumberIndex++ ) {
bool excludeNumber = false;
phoneNumber = (*it2);
- QString phone = phoneNumber.number();
+ TQString phone = phoneNumber.number();
if ( (*mPrefs).excludeHome() &&
@@ -646,15 +646,15 @@ void MobileGui::readKabc()
}
-QString MobileGui::decodeSuffix( const QString &suffix )
+TQString MobileGui::decodeSuffix( const TQString &suffix )
{
- QString theSuffix = suffix;
+ TQString theSuffix = suffix;
// Check whether suffix is quoted. If so, it should be interpreted
// as Hex-Number of a special GSM character.
if ( ( theSuffix.left( 1 ) == "\"" ) && ( theSuffix.right( 1 ) == "\"" ) ) {
- QString tmp = "";
+ TQString tmp = "";
char suffixNumber = (char) dequote( suffix ).toUInt( 0, 16 );
tmp += suffixNumber;
@@ -665,9 +665,9 @@ QString MobileGui::decodeSuffix( const QString &suffix )
}
-void MobileGui::formatPBName( QString *name, QString suffix )
+void MobileGui::formatPBName( TQString *name, TQString suffix )
{
- QString theSuffix = decodeSuffix( suffix );
+ TQString theSuffix = decodeSuffix( suffix );
if ( name->length() + theSuffix.length() > mPBNameLength ) {
@@ -684,7 +684,7 @@ void MobileGui::formatPBName( QString *name, QString suffix )
}
-QString MobileGui::stripWhiteSpaces( const QString &theString )
+TQString MobileGui::stripWhiteSpaces( const TQString &theString )
{
int pos = 0;
int len = theString.length();
@@ -726,7 +726,7 @@ void MobileGui::writeKabc()
for ( uint i = 0; i < mSyncer->mKabEntries.count(); i++ ) {
SyncEntryKab *kabEntry = mSyncer->mKabEntries.at( i );
- QString phoneNumber = kabEntry->mPhone;
+ TQString phoneNumber = kabEntry->mPhone;
if ( kabEntry->mToBeUpdated ) {
@@ -751,7 +751,7 @@ void MobileGui::writeKabc()
bool goon = true;
KABC::AddressBook::Iterator it;
bool equivalentEntryFound = false;
- QString name = kabEntry->mName;
+ TQString name = kabEntry->mName;
//
@@ -759,7 +759,7 @@ void MobileGui::writeKabc()
// If a suffix is found, remove it from the name.
//
if ( goon && (*mPrefs).useHomeSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).homeSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).homeSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Home;
name = stripWhiteSpaces(
@@ -768,7 +768,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useWorkSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).workSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).workSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Work;
name = stripWhiteSpaces(
@@ -777,7 +777,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useMessagingSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).messagingSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).messagingSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Msg;
name = stripWhiteSpaces(
@@ -786,7 +786,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useFaxSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).faxSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).faxSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Fax;
name = stripWhiteSpaces(
@@ -795,7 +795,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useCellSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).cellSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).cellSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Cell;
name = stripWhiteSpaces(
@@ -804,7 +804,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useVideoSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).videoSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).videoSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Video;
name = stripWhiteSpaces(
@@ -813,7 +813,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useMailboxSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).mailboxSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).mailboxSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Bbs;
name = stripWhiteSpaces(
@@ -822,7 +822,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useModemSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).modemSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).modemSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Modem;
name = stripWhiteSpaces(
@@ -831,7 +831,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useCarSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).carSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).carSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Car;
name = stripWhiteSpaces(
@@ -840,7 +840,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).useISDNSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).iSDNSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).iSDNSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Isdn;
name = stripWhiteSpaces(
@@ -849,7 +849,7 @@ void MobileGui::writeKabc()
}
}
if ( goon && (*mPrefs).usePagerSuff() ) {
- QString theSuffix = decodeSuffix( (*mPrefs).pagerSuff() );
+ TQString theSuffix = decodeSuffix( (*mPrefs).pagerSuff() );
if ( name.right( theSuffix.length() ) == theSuffix ) {
phoneType = KABC::PhoneNumber::Pager;
name = stripWhiteSpaces(
@@ -865,7 +865,7 @@ void MobileGui::writeKabc()
//
for ( it = addressBook->begin(); it != addressBook->end(); it++ ) {
- QString kabName = (*it).familyName();
+ TQString kabName = (*it).familyName();
KABC::AddressBook::Iterator it3;
KABC::Addressee::List tmp;
bool firstCharIsUnique = true;
@@ -916,15 +916,15 @@ void MobileGui::writeKabc()
if ( !equivalentEntryFound ) {
KABC::Addressee entry;
- QStringList *fields = new QStringList;
+ TQStringList *fields = new QStringList;
- *fields = QStringList::split( ',', name );
+ *fields = TQStringList::split( ',', name );
if ( fields->count() > 1 ) {
// Name string contains comma separated entry so that we
// need to build family and given names out of them.
- QString givenName = "";
+ TQString givenName = "";
entry.setFamilyName( stripWhiteSpaces( (*fields)[ 0 ] ) );
@@ -985,8 +985,8 @@ void MobileGui::processResult( ATCommand *command )
else
if ( command->id() == "+cpbr=?" )
{
- QStringList tmpList = QStringList::split( "-", command->resultField( 0 ) );
- QString tmpString = tmpList.first().right( tmpList.first().length() - 1 );
+ TQStringList tmpList = TQStringList::split( "-", command->resultField( 0 ) );
+ TQString tmpString = tmpList.first().right( tmpList.first().length() - 1 );
mPBStartIndex = tmpString.toUInt();
mPBNameLength = command->resultField( 2 ).toUInt();
} else
@@ -1010,13 +1010,13 @@ void MobileGui::processResult( ATCommand *command )
writePhonebookPostProcessing();
else
if ( command->id() == "+cpbs=?" ) {
- QPtrList<QStringList> *list = command->resultFields();
- QStringList *fields = list->first();
+ TQPtrList<TQStringList> *list = command->resultFields();
+ TQStringList *fields = list->first();
while( fields ) {
for ( unsigned int i = 0; i < fields->count(); i++ ) {
- QString memory = dequote( (*fields)[ i ] );
+ TQString memory = dequote( (*fields)[ i ] );
if ( memory == "FD" )
@@ -1051,9 +1051,9 @@ void MobileGui::processResult( ATCommand *command )
}
-QString MobileGui::noSpaces( const QString &theString )
+TQString MobileGui::noSpaces( const TQString &theString )
{
- QString result = "";
+ TQString result = "";
for ( unsigned int i = 0; i < theString.length(); i++ )
@@ -1083,9 +1083,9 @@ int MobileGui::firstFreeIndex()
}
-QString MobileGui::string2GSM( const QString &theString )
+TQString MobileGui::string2GSM( const TQString &theString )
{
- QString result = "";
+ TQString result = "";
for ( unsigned int i = 0; i < theString.length(); i++ )
@@ -1107,9 +1107,9 @@ QString MobileGui::string2GSM( const QString &theString )
}
-QString MobileGui::GSM2String( const QString &theString )
+TQString MobileGui::GSM2String( const TQString &theString )
{
- QString result = "";
+ TQString result = "";
for ( unsigned int i = 0; i < theString.length(); i++ )
@@ -1135,17 +1135,17 @@ void MobileGui::fillPhonebook( ATCommand *cmd )
{
mSyncer->mMobileEntries.clear();
- QPtrList<QStringList> *list = cmd->resultFields();
- QStringList *fields = list->first();
+ TQPtrList<TQStringList> *list = cmd->resultFields();
+ TQStringList *fields = list->first();
while( fields ) {
if ( fields->count() != 4 )
kdDebug() << "Error! Unexpected number of address fields." << endl;
else {
- QString index = (*fields)[0];
- QString phone = (*fields)[1];
- QString type = (*fields)[2];
- QString name = GSM2String( (*fields)[3] );
+ TQString index = (*fields)[0];
+ TQString phone = (*fields)[1];
+ TQString type = (*fields)[2];
+ TQString name = GSM2String( (*fields)[3] );
SyncEntryMobile *phoneEntry = new SyncEntryMobile( true, dequote( index ),
dequote( phone ),
@@ -1166,7 +1166,7 @@ void MobileGui::fillPhonebook( ATCommand *cmd )
}
-QString MobileGui::quote( const QString &str )
+TQString MobileGui::quote( const TQString &str )
{
if ( ( str.left(1) == "\"" ) && ( str.right(1) == "\"" ) )
return str;
@@ -1175,7 +1175,7 @@ QString MobileGui::quote( const QString &str )
}
-QString MobileGui::dequote( const QString &str )
+TQString MobileGui::dequote( const TQString &str )
{
int pos = 0;
int len = str.length();
@@ -1198,11 +1198,11 @@ void MobileGui::savePhonebook()
if ( mMobState == UNLOADED )
return;
- QString fileName = KFileDialog::getSaveFileName( "phonebook.csv" );
- QFile outFile( fileName );
+ TQString fileName = KFileDialog::getSaveFileName( "phonebook.csv" );
+ TQFile outFile( fileName );
if ( outFile.open( IO_WriteOnly ) ) {
- QTextStream t( &outFile ); // use a text stream
+ TQTextStream t( &outFile ); // use a text stream
for( uint i = 0; i < mSyncer->mMobileEntries.count(); i++) {
SyncEntryMobile *e = mSyncer->mMobileEntries.at( i );
@@ -1310,16 +1310,16 @@ void MobileGui::mergePhonebooks()
} else {
// Conflict: 2 Entries have same name but different numbers.
// Prompt user.
- QString text = "<qt><b>" + i18n( "Kab Entry:" ) + "</b><br>";
+ TQString text = "<qt><b>" + i18n( "Kab Entry:" ) + "</b><br>";
text += " " + theCommonEntry->mKabEntry->mName + " " +
theCommonEntry->mKabEntry->mPhone + "<br>";
text += "<b>" + i18n( "Mobile Entry:" ) + "</b><br>";
text += " " + mobileEntry->mName + " " + mobileEntry->mPhone;
text += "</qt>";
- QMessageBox *msg =
- new QMessageBox( i18n( "Conflicting Entries" ), text,
- QMessageBox::Warning, 1, 2, 0, this );
+ TQMessageBox *msg =
+ new TQMessageBox( i18n( "Conflicting Entries" ), text,
+ TQMessageBox::Warning, 1, 2, 0, this );
msg->setButtonText( 1, i18n( "Use Kab Entry" ) );
msg->setButtonText( 2, i18n( "Use Mobile Entry" ) );
@@ -1560,12 +1560,12 @@ void MobileGui::setKabState( ABState newState )
void MobileGui::warnKabState( ABState newState )
{
if ( ( mKabState == MODIFIED ) && ( newState != MODIFIED ) ) {
- QString text = "<qt><b>" + i18n( "Warning" ) + "</b><br>";
+ TQString text = "<qt><b>" + i18n( "Warning" ) + "</b><br>";
text += i18n( "The KDE address book contains unsaved changes." ) +
"<br></qt>";
- QMessageBox *msg = new QMessageBox( i18n( "Unsaved Changes" ), text,
- QMessageBox::Critical, 1, 2, 0, this );
+ TQMessageBox *msg = new TQMessageBox( i18n( "Unsaved Changes" ), text,
+ TQMessageBox::Critical, 1, 2, 0, this );
msg->setButtonText( 1, i18n( "Save" ) );
msg->setButtonText( 2, i18n( "Discard" ) );
@@ -1645,12 +1645,12 @@ bool MobileGui::warnMobState( ABState newState )
{
if ( ( mMobState == MODIFIED ) && ( newState != MODIFIED ) )
{
- QString text = "<qt><b>" + i18n( "Warning" ) + "</b><br>";
+ TQString text = "<qt><b>" + i18n( "Warning" ) + "</b><br>";
text += i18n( "The mobile phone book contains unsaved changes." ) +
"<br></qt>";
- QMessageBox *msg = new QMessageBox( i18n( "Unsaved Changes" ), text,
- QMessageBox::Critical, 1, 2, 0, this );
+ TQMessageBox *msg = new TQMessageBox( i18n( "Unsaved Changes" ), text,
+ TQMessageBox::Critical, 1, 2, 0, this );
msg->setButtonText( 1, i18n( "Save" ) );
msg->setButtonText( 2, i18n( "Discard" ) );