summaryrefslogtreecommitdiffstats
path: root/kaddressbook/customfieldswidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kaddressbook/customfieldswidget.cpp')
-rw-r--r--kaddressbook/customfieldswidget.cpp198
1 files changed, 99 insertions, 99 deletions
diff --git a/kaddressbook/customfieldswidget.cpp b/kaddressbook/customfieldswidget.cpp
index a2a6e7011..4fc41819c 100644
--- a/kaddressbook/customfieldswidget.cpp
+++ b/kaddressbook/customfieldswidget.cpp
@@ -21,14 +21,14 @@
without including the source code for Qt in the source distribution.
*/
-#include <qcheckbox.h>
-#include <qdatetimeedit.h>
-#include <qframe.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qvalidator.h>
-#include <qspinbox.h>
+#include <tqcheckbox.h>
+#include <tqdatetimeedit.h>
+#include <tqframe.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqpushbutton.h>
+#include <tqvalidator.h>
+#include <tqspinbox.h>
#include <kaccelmanager.h>
#include <kcombobox.h>
@@ -42,35 +42,35 @@
#include "customfieldswidget.h"
-AddFieldDialog::AddFieldDialog( QWidget *parent, const char *name )
+AddFieldDialog::AddFieldDialog( TQWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Add Field" ), Ok | Cancel,
Ok, parent, name, true, true )
{
- QWidget *page = plainPage();
+ TQWidget *page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 3, 2, marginHint(), spacingHint() );
+ TQGridLayout *layout = new TQGridLayout( page, 3, 2, marginHint(), spacingHint() );
- QLabel *label = new QLabel( i18n( "Title:" ), page );
+ TQLabel *label = new TQLabel( i18n( "Title:" ), page );
layout->addWidget( label, 0, 0 );
mTitle = new KLineEdit( page );
- mTitle->setValidator( new QRegExpValidator( QRegExp( "([a-zA-Z]|\\d|-)+" ), mTitle ) );
+ mTitle->setValidator( new TQRegExpValidator( TQRegExp( "([a-zA-Z]|\\d|-)+" ), mTitle ) );
label->setBuddy( mTitle );
layout->addWidget( mTitle, 0, 1 );
- label = new QLabel( i18n( "Type:" ), page );
+ label = new TQLabel( i18n( "Type:" ), page );
layout->addWidget( label, 1, 0 );
mType = new KComboBox( page );
label->setBuddy( mType );
layout->addWidget( mType, 1, 1 );
- mGlobal = new QCheckBox( i18n( "Is available for all contacts" ), page );
+ mGlobal = new TQCheckBox( i18n( "Is available for all contacts" ), page );
mGlobal->setChecked( true );
layout->addMultiCellWidget( mGlobal, 2, 2, 0, 1 );
- connect( mTitle, SIGNAL( textChanged( const QString& ) ),
- this, SLOT( nameChanged( const QString& ) ) );
+ connect( mTitle, TQT_SIGNAL( textChanged( const TQString& ) ),
+ this, TQT_SLOT( nameChanged( const TQString& ) ) );
KAcceleratorManager::manage( this );
@@ -95,18 +95,18 @@ AddFieldDialog::AddFieldDialog( QWidget *parent, const char *name )
mTitle->setFocus();
}
-QString AddFieldDialog::title() const
+TQString AddFieldDialog::title() const
{
return mTitle->text();
}
-QString AddFieldDialog::identifier() const
+TQString AddFieldDialog::identifier() const
{
- QString id = mTitle->text().lower();
+ TQString id = mTitle->text().lower();
return id.replace( ",", "_" ).replace( " ", "_" );
}
-QString AddFieldDialog::type() const
+TQString AddFieldDialog::type() const
{
return mTypeList[ mType->currentItem() ];
}
@@ -116,79 +116,79 @@ bool AddFieldDialog::isGlobal() const
return mGlobal->isChecked();
}
-void AddFieldDialog::nameChanged( const QString &name )
+void AddFieldDialog::nameChanged( const TQString &name )
{
enableButton( Ok, !name.isEmpty() );
}
-FieldWidget::FieldWidget( QWidget *parent, const char *name )
- : QWidget( parent, name )
+FieldWidget::FieldWidget( TQWidget *parent, const char *name )
+ : TQWidget( parent, name )
{
- QVBoxLayout *layout = new QVBoxLayout( this, KDialog::marginHint(),
+ TQVBoxLayout *layout = new TQVBoxLayout( this, KDialog::marginHint(),
KDialog::spacingHint() );
- mGlobalLayout = new QVBoxLayout( layout, KDialog::spacingHint() );
+ mGlobalLayout = new TQVBoxLayout( layout, KDialog::spacingHint() );
mGlobalLayout->setAlignment( Qt::AlignTop );
- mSeparator = new QFrame( this );
- mSeparator->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ mSeparator = new TQFrame( this );
+ mSeparator->setFrameStyle( TQFrame::HLine | TQFrame::Sunken );
mSeparator->hide();
layout->addWidget( mSeparator );
- mLocalLayout = new QVBoxLayout( layout, KDialog::spacingHint() );
+ mLocalLayout = new TQVBoxLayout( layout, KDialog::spacingHint() );
mLocalLayout->setAlignment( Qt::AlignTop );
}
-void FieldWidget::addField( const QString &identifier, const QString &title,
- const QString &type, bool isGlobal )
+void FieldWidget::addField( const TQString &identifier, const TQString &title,
+ const TQString &type, bool isGlobal )
{
FieldRecord record;
record.mIdentifier = identifier;
record.mTitle = title;
- record.mLabel = new QLabel( title + ":", this );
+ record.mLabel = new TQLabel( title + ":", this );
record.mGlobal = isGlobal;
if ( type == "integer" ) {
- QSpinBox *wdg = new QSpinBox( 0, 1000, 1, this );
+ TQSpinBox *wdg = new TQSpinBox( 0, 1000, 1, this );
record.mWidget = wdg;
- connect( wdg, SIGNAL( valueChanged( int ) ),
- this, SIGNAL( changed() ) );
+ connect( wdg, TQT_SIGNAL( valueChanged( int ) ),
+ this, TQT_SIGNAL( changed() ) );
} else if ( type == "boolean" ) {
- QCheckBox *wdg = new QCheckBox( this );
+ TQCheckBox *wdg = new TQCheckBox( this );
record.mWidget = wdg;
- connect( wdg, SIGNAL( toggled( bool ) ),
- this, SIGNAL( changed() ) );
+ connect( wdg, TQT_SIGNAL( toggled( bool ) ),
+ this, TQT_SIGNAL( changed() ) );
} else if ( type == "date" ) {
QDateEdit *wdg = new QDateEdit( this );
record.mWidget = wdg;
- connect( wdg, SIGNAL( valueChanged( const QDate& ) ),
- this, SIGNAL( changed() ) );
+ connect( wdg, TQT_SIGNAL( valueChanged( const TQDate& ) ),
+ this, TQT_SIGNAL( changed() ) );
} else if ( type == "time" ) {
QTimeEdit *wdg = new QTimeEdit( this );
record.mWidget = wdg;
- connect( wdg, SIGNAL( valueChanged( const QTime& ) ),
- this, SIGNAL( changed() ) );
+ connect( wdg, TQT_SIGNAL( valueChanged( const TQTime& ) ),
+ this, TQT_SIGNAL( changed() ) );
} else if ( type == "datetime" ) {
QDateTimeEdit *wdg = new QDateTimeEdit( this );
record.mWidget = wdg;
- connect( wdg, SIGNAL( valueChanged( const QDateTime& ) ),
- this, SIGNAL( changed() ) );
+ connect( wdg, TQT_SIGNAL( valueChanged( const TQDateTime& ) ),
+ this, TQT_SIGNAL( changed() ) );
} else if ( type == "text" ) {
- QLineEdit *wdg = new QLineEdit( this );
+ TQLineEdit *wdg = new TQLineEdit( this );
record.mWidget = wdg;
- connect( wdg, SIGNAL( textChanged( const QString& ) ),
- this, SIGNAL( changed() ) );
+ connect( wdg, TQT_SIGNAL( textChanged( const TQString& ) ),
+ this, TQT_SIGNAL( changed() ) );
}
record.mLabel->show();
record.mWidget->show();
if ( isGlobal ) {
- record.mLayout = new QHBoxLayout( mGlobalLayout );
+ record.mLayout = new TQHBoxLayout( mGlobalLayout );
record.mLayout->addWidget( record.mLabel );
record.mLayout->addWidget( record.mWidget, Qt::AlignLeft );
} else {
- record.mLayout = new QHBoxLayout( mLocalLayout );
+ record.mLayout = new TQHBoxLayout( mLocalLayout );
record.mLayout->addWidget( record.mLabel );
record.mLayout->addWidget( record.mWidget, Qt::AlignLeft );
mSeparator->show();
@@ -199,7 +199,7 @@ void FieldWidget::addField( const QString &identifier, const QString &title,
recalculateLayout();
}
-void FieldWidget::removeField( const QString &identifier )
+void FieldWidget::removeField( const TQString &identifier )
{
FieldRecordList::Iterator it;
for ( it = mFieldList.begin(); it != mFieldList.end(); ++it ) {
@@ -227,37 +227,37 @@ void FieldWidget::clearFields()
{
FieldRecordList::ConstIterator fieldIt;
for ( fieldIt = mFieldList.begin(); fieldIt != mFieldList.end(); ++fieldIt ) {
- if ( (*fieldIt).mWidget->isA( "QLineEdit" ) ) {
- QLineEdit *wdg = static_cast<QLineEdit*>( (*fieldIt).mWidget );
- wdg->setText( QString() );
- } else if ( (*fieldIt).mWidget->isA( "QSpinBox" ) ) {
- QSpinBox *wdg = static_cast<QSpinBox*>( (*fieldIt).mWidget );
+ if ( (*fieldIt).mWidget->isA( "TQLineEdit" ) ) {
+ TQLineEdit *wdg = static_cast<TQLineEdit*>( (*fieldIt).mWidget );
+ wdg->setText( TQString() );
+ } else if ( (*fieldIt).mWidget->isA( "TQSpinBox" ) ) {
+ TQSpinBox *wdg = static_cast<TQSpinBox*>( (*fieldIt).mWidget );
wdg->setValue( 0 );
- } else if ( (*fieldIt).mWidget->isA( "QCheckBox" ) ) {
- QCheckBox *wdg = static_cast<QCheckBox*>( (*fieldIt).mWidget );
+ } else if ( (*fieldIt).mWidget->isA( "TQCheckBox" ) ) {
+ TQCheckBox *wdg = static_cast<TQCheckBox*>( (*fieldIt).mWidget );
wdg->setChecked( true );
} else if ( (*fieldIt).mWidget->isA( "QDateEdit" ) ) {
QDateEdit *wdg = static_cast<QDateEdit*>( (*fieldIt).mWidget );
- wdg->setDate( QDate::currentDate() );
+ wdg->setDate( TQDate::currentDate() );
} else if ( (*fieldIt).mWidget->isA( "QTimeEdit" ) ) {
QTimeEdit *wdg = static_cast<QTimeEdit*>( (*fieldIt).mWidget );
- wdg->setTime( QTime::currentTime() );
+ wdg->setTime( TQTime::currentTime() );
} else if ( (*fieldIt).mWidget->isA( "QDateTimeEdit" ) ) {
QDateTimeEdit *wdg = static_cast<QDateTimeEdit*>( (*fieldIt).mWidget );
- wdg->setDateTime( QDateTime::currentDateTime() );
+ wdg->setDateTime( TQDateTime::currentDateTime() );
}
}
}
void FieldWidget::loadContact( KABC::Addressee *addr )
{
- const QStringList customs = addr->customs();
+ const TQStringList customs = addr->customs();
clearFields();
- QStringList::ConstIterator it;
+ TQStringList::ConstIterator it;
for ( it = customs.begin(); it != customs.end(); ++it ) {
- QString app, name, value;
+ TQString app, name, value;
splitField( *it, app, name, value );
if ( app != "KADDRESSBOOK" )
continue;
@@ -265,24 +265,24 @@ void FieldWidget::loadContact( KABC::Addressee *addr )
FieldRecordList::ConstIterator fieldIt;
for ( fieldIt = mFieldList.begin(); fieldIt != mFieldList.end(); ++fieldIt ) {
if ( (*fieldIt).mIdentifier == name ) {
- if ( (*fieldIt).mWidget->isA( "QLineEdit" ) ) {
- QLineEdit *wdg = static_cast<QLineEdit*>( (*fieldIt).mWidget );
+ if ( (*fieldIt).mWidget->isA( "TQLineEdit" ) ) {
+ TQLineEdit *wdg = static_cast<TQLineEdit*>( (*fieldIt).mWidget );
wdg->setText( value );
- } else if ( (*fieldIt).mWidget->isA( "QSpinBox" ) ) {
- QSpinBox *wdg = static_cast<QSpinBox*>( (*fieldIt).mWidget );
+ } else if ( (*fieldIt).mWidget->isA( "TQSpinBox" ) ) {
+ TQSpinBox *wdg = static_cast<TQSpinBox*>( (*fieldIt).mWidget );
wdg->setValue( value.toInt() );
- } else if ( (*fieldIt).mWidget->isA( "QCheckBox" ) ) {
- QCheckBox *wdg = static_cast<QCheckBox*>( (*fieldIt).mWidget );
+ } else if ( (*fieldIt).mWidget->isA( "TQCheckBox" ) ) {
+ TQCheckBox *wdg = static_cast<TQCheckBox*>( (*fieldIt).mWidget );
wdg->setChecked( value == "true" || value == "1" );
} else if ( (*fieldIt).mWidget->isA( "QDateEdit" ) ) {
QDateEdit *wdg = static_cast<QDateEdit*>( (*fieldIt).mWidget );
- wdg->setDate( QDate::fromString( value, Qt::ISODate ) );
+ wdg->setDate( TQDate::fromString( value, Qt::ISODate ) );
} else if ( (*fieldIt).mWidget->isA( "QTimeEdit" ) ) {
QTimeEdit *wdg = static_cast<QTimeEdit*>( (*fieldIt).mWidget );
- wdg->setTime( QTime::fromString( value, Qt::ISODate ) );
+ wdg->setTime( TQTime::fromString( value, Qt::ISODate ) );
} else if ( (*fieldIt).mWidget->isA( "QDateTimeEdit" ) ) {
QDateTimeEdit *wdg = static_cast<QDateTimeEdit*>( (*fieldIt).mWidget );
- wdg->setDateTime( QDateTime::fromString( value, Qt::ISODate ) );
+ wdg->setDateTime( TQDateTime::fromString( value, Qt::ISODate ) );
}
}
}
@@ -293,15 +293,15 @@ void FieldWidget::storeContact( KABC::Addressee *addr )
{
FieldRecordList::ConstIterator it;
for ( it = mFieldList.begin(); it != mFieldList.end(); ++it ) {
- QString value;
- if ( (*it).mWidget->isA( "QLineEdit" ) ) {
- QLineEdit *wdg = static_cast<QLineEdit*>( (*it).mWidget );
+ TQString value;
+ if ( (*it).mWidget->isA( "TQLineEdit" ) ) {
+ TQLineEdit *wdg = static_cast<TQLineEdit*>( (*it).mWidget );
value = wdg->text();
- } else if ( (*it).mWidget->isA( "QSpinBox" ) ) {
- QSpinBox *wdg = static_cast<QSpinBox*>( (*it).mWidget );
- value = QString::number( wdg->value() );
- } else if ( (*it).mWidget->isA( "QCheckBox" ) ) {
- QCheckBox *wdg = static_cast<QCheckBox*>( (*it).mWidget );
+ } else if ( (*it).mWidget->isA( "TQSpinBox" ) ) {
+ TQSpinBox *wdg = static_cast<TQSpinBox*>( (*it).mWidget );
+ value = TQString::number( wdg->value() );
+ } else if ( (*it).mWidget->isA( "TQCheckBox" ) ) {
+ TQCheckBox *wdg = static_cast<TQCheckBox*>( (*it).mWidget );
value = ( wdg->isChecked() ? "true" : "false" );
} else if ( (*it).mWidget->isA( "QDateEdit" ) ) {
QDateEdit *wdg = static_cast<QDateEdit*>( (*it).mWidget );
@@ -350,15 +350,15 @@ void FieldWidget::recalculateLayout()
}
CustomFieldsWidget::CustomFieldsWidget( KABC::AddressBook *ab,
- QWidget *parent, const char *name )
+ TQWidget *parent, const char *name )
: KAB::ContactEditorWidget( ab, parent, name )
{
initGUI();
- connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addField() ) );
- connect( mRemoveButton, SIGNAL( clicked() ), this, SLOT( removeField() ) );
+ connect( mAddButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( addField() ) );
+ connect( mRemoveButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( removeField() ) );
- connect( mFieldWidget, SIGNAL( changed() ), this, SLOT( setModified() ) );
+ connect( mFieldWidget, TQT_SIGNAL( changed() ), this, TQT_SLOT( setModified() ) );
}
void CustomFieldsWidget::loadContact( KABC::Addressee *addr )
@@ -368,7 +368,7 @@ void CustomFieldsWidget::loadContact( KABC::Addressee *addr )
mFieldWidget->removeLocalFields();
AddresseeConfig addrConfig( mAddressee );
- QStringList fields = addrConfig.customFields();
+ TQStringList fields = addrConfig.customFields();
if ( !fields.isEmpty() ) {
for ( uint i = 0; i < fields.count(); i += 3 ) {
@@ -424,14 +424,14 @@ void CustomFieldsWidget::removeField()
{
const FieldRecordList list = mFieldWidget->fields();
- QStringList fields;
+ TQStringList fields;
FieldRecordList::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it )
fields.append( (*it).mTitle );
bool ok;
- QString title = KInputDialog::getItem( i18n( "Remove Field" ),
+ TQString title = KInputDialog::getItem( i18n( "Remove Field" ),
i18n( "Select the field you want to remove:" ),
fields, 0, false, &ok, this );
@@ -457,21 +457,21 @@ void CustomFieldsWidget::removeField()
void CustomFieldsWidget::initGUI()
{
- QGridLayout *layout = new QGridLayout( this, 2, 3, KDialog::marginHint(),
+ TQGridLayout *layout = new TQGridLayout( this, 2, 3, KDialog::marginHint(),
KDialog::spacingHint() );
mFieldWidget = new FieldWidget( this );
layout->addMultiCellWidget( mFieldWidget, 0, 0, 0, 2 );
- mAddButton = new QPushButton( i18n( "Add Field..." ), this );
+ mAddButton = new TQPushButton( i18n( "Add Field..." ), this );
layout->addWidget( mAddButton, 1, 1, Qt::AlignRight );
- mRemoveButton = new QPushButton( i18n( "Remove Field..." ), this );
+ mRemoveButton = new TQPushButton( i18n( "Remove Field..." ), this );
mRemoveButton->setEnabled( false );
layout->addWidget( mRemoveButton, 1, 2, Qt::AlignRight );
// load global fields
- QStringList globalFields = KABPrefs::instance()->globalCustomFields();
+ TQStringList globalFields = KABPrefs::instance()->globalCustomFields();
if ( globalFields.isEmpty() )
return;
@@ -483,9 +483,9 @@ void CustomFieldsWidget::initGUI()
}
}
-QStringList CustomFieldsWidget::marshallFields( bool global ) const
+TQStringList CustomFieldsWidget::marshallFields( bool global ) const
{
- QStringList retval;
+ TQStringList retval;
const FieldRecordList list = mFieldWidget->fields();
FieldRecordList::ConstIterator it;
@@ -494,10 +494,10 @@ QStringList CustomFieldsWidget::marshallFields( bool global ) const
retval.append( (*it).mIdentifier );
retval.append( (*it).mTitle );
- QString type = "text";
- if ( (*it).mWidget->isA( "QSpinBox" ) ) {
+ TQString type = "text";
+ if ( (*it).mWidget->isA( "TQSpinBox" ) ) {
type = "integer";
- } else if ( (*it).mWidget->isA( "QCheckBox" ) ) {
+ } else if ( (*it).mWidget->isA( "TQCheckBox" ) ) {
type = "boolean";
} else if ( (*it).mWidget->isA( "QDateEdit" ) ) {
type = "date";
@@ -505,7 +505,7 @@ QStringList CustomFieldsWidget::marshallFields( bool global ) const
type = "time";
} else if ( (*it).mWidget->isA( "QDateTimeEdit" ) ) {
type = "datetime";
- } else if ( (*it).mWidget->isA( "QLineEdit" ) ) {
+ } else if ( (*it).mWidget->isA( "TQLineEdit" ) ) {
type = "text";
}
@@ -517,11 +517,11 @@ QStringList CustomFieldsWidget::marshallFields( bool global ) const
}
-void splitField( const QString &str, QString &app, QString &name, QString &value )
+void splitField( const TQString &str, TQString &app, TQString &name, TQString &value )
{
int colon = str.find( ':' );
if ( colon != -1 ) {
- QString tmp = str.left( colon );
+ TQString tmp = str.left( colon );
value = str.mid( colon + 1 );
int dash = tmp.find( '-' );