diff options
Diffstat (limited to 'kaddressbook/geowidget.cpp')
-rw-r--r-- | kaddressbook/geowidget.cpp | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/kaddressbook/geowidget.cpp b/kaddressbook/geowidget.cpp index 3563f118e..40631147b 100644 --- a/kaddressbook/geowidget.cpp +++ b/kaddressbook/geowidget.cpp @@ -30,39 +30,39 @@ #include <knuminput.h> #include <kstandarddirs.h> -#include <qcheckbox.h> -#include <qfile.h> -#include <qgroupbox.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qlistbox.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qpushbutton.h> -#include <qregexp.h> -#include <qstring.h> +#include <tqcheckbox.h> +#include <tqfile.h> +#include <tqgroupbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqlistbox.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqpushbutton.h> +#include <tqregexp.h> +#include <tqstring.h> #include "geowidget.h" -GeoWidget::GeoWidget( KABC::AddressBook *ab, QWidget *parent, const char *name ) +GeoWidget::GeoWidget( KABC::AddressBook *ab, TQWidget *parent, const char *name ) : KAB::ContactEditorWidget( ab, parent, name ), mReadOnly( false ) { - QLabel *label = 0; + TQLabel *label = 0; - QGridLayout *topLayout = new QGridLayout( this, 4, 3 ); + TQGridLayout *topLayout = new TQGridLayout( this, 4, 3 ); topLayout->setMargin( KDialog::marginHint() ); topLayout->setSpacing( KDialog::spacingHint() ); - label = new QLabel( this ); + label = new TQLabel( this ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop, KIcon::SizeMedium ) ); label->setAlignment( Qt::AlignTop ); topLayout->addMultiCellWidget( label, 0, 3, 0, 0 ); - mGeoIsValid = new QCheckBox( i18n( "Use geo data" ), this ); + mGeoIsValid = new TQCheckBox( i18n( "Use geo data" ), this ); topLayout->addMultiCellWidget( mGeoIsValid, 0, 0, 1, 2 ); - label = new QLabel( i18n( "Latitude:" ), this ); + label = new TQLabel( i18n( "Latitude:" ), this ); topLayout->addWidget( label, 1, 1 ); mLatitudeBox = new KDoubleSpinBox( -90, 90, 1, 0, 6, this ); @@ -71,7 +71,7 @@ GeoWidget::GeoWidget( KABC::AddressBook *ab, QWidget *parent, const char *name ) topLayout->addWidget( mLatitudeBox, 1, 2 ); label->setBuddy( mLatitudeBox ); - label = new QLabel( i18n( "Longitude:" ), this ); + label = new TQLabel( i18n( "Longitude:" ), this ); topLayout->addWidget( label, 2, 1 ); mLongitudeBox = new KDoubleSpinBox( -180, 180, 1, 0, 6, this ); @@ -80,25 +80,25 @@ GeoWidget::GeoWidget( KABC::AddressBook *ab, QWidget *parent, const char *name ) topLayout->addWidget( mLongitudeBox, 2, 2 ); label->setBuddy( mLongitudeBox ); - mExtendedButton = new QPushButton( i18n( "Edit Geo Data..." ), this ); + mExtendedButton = new TQPushButton( i18n( "Edit Geo Data..." ), this ); mExtendedButton->setEnabled( false ); topLayout->addMultiCellWidget( mExtendedButton, 3, 3, 1, 2 ); - connect( mLatitudeBox, SIGNAL( valueChanged( double ) ), - SLOT( setModified() ) ); - connect( mLongitudeBox, SIGNAL( valueChanged( double ) ), - SLOT( setModified() ) ); - connect( mExtendedButton, SIGNAL( clicked() ), - SLOT( editGeoData() ) ); - - connect( mGeoIsValid, SIGNAL( toggled( bool ) ), - mLatitudeBox, SLOT( setEnabled( bool ) ) ); - connect( mGeoIsValid, SIGNAL( toggled( bool ) ), - mLongitudeBox, SLOT( setEnabled( bool ) ) ); - connect( mGeoIsValid, SIGNAL( toggled( bool ) ), - mExtendedButton, SLOT( setEnabled( bool ) ) ); - connect( mGeoIsValid, SIGNAL( toggled( bool ) ), - SLOT( setModified() ) ); + connect( mLatitudeBox, TQT_SIGNAL( valueChanged( double ) ), + TQT_SLOT( setModified() ) ); + connect( mLongitudeBox, TQT_SIGNAL( valueChanged( double ) ), + TQT_SLOT( setModified() ) ); + connect( mExtendedButton, TQT_SIGNAL( clicked() ), + TQT_SLOT( editGeoData() ) ); + + connect( mGeoIsValid, TQT_SIGNAL( toggled( bool ) ), + mLatitudeBox, TQT_SLOT( setEnabled( bool ) ) ); + connect( mGeoIsValid, TQT_SIGNAL( toggled( bool ) ), + mLongitudeBox, TQT_SLOT( setEnabled( bool ) ) ); + connect( mGeoIsValid, TQT_SIGNAL( toggled( bool ) ), + mExtendedButton, TQT_SLOT( setEnabled( bool ) ) ); + connect( mGeoIsValid, TQT_SIGNAL( toggled( bool ) ), + TQT_SLOT( setModified() ) ); } GeoWidget::~GeoWidget() @@ -157,14 +157,14 @@ void GeoWidget::editGeoData() -GeoDialog::GeoDialog( QWidget *parent, const char *name ) +GeoDialog::GeoDialog( TQWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "Geo Data Input" ), Ok | Cancel, Ok, parent, name, true, true ), mUpdateSexagesimalInput( true ) { - QFrame *page = plainPage(); + TQFrame *page = plainPage(); - QGridLayout *topLayout = new QGridLayout( page, 2, 2, marginHint(), + TQGridLayout *topLayout = new TQGridLayout( page, 2, 2, marginHint(), spacingHint() ); topLayout->setRowStretch( 1, 1 ); @@ -174,24 +174,24 @@ GeoDialog::GeoDialog( QWidget *parent, const char *name ) mCityCombo = new KComboBox( page ); topLayout->addWidget( mCityCombo, 0, 1 ); - QGroupBox *sexagesimalGroup = new QGroupBox( 0, Vertical, i18n( "Sexagesimal" ), page ); - QGridLayout *sexagesimalLayout = new QGridLayout( sexagesimalGroup->layout(), + TQGroupBox *sexagesimalGroup = new TQGroupBox( 0, Vertical, i18n( "Sexagesimal" ), page ); + TQGridLayout *sexagesimalLayout = new TQGridLayout( sexagesimalGroup->layout(), 2, 5, spacingHint() ); - QLabel *label = new QLabel( i18n( "Latitude:" ), sexagesimalGroup ); + TQLabel *label = new TQLabel( i18n( "Latitude:" ), sexagesimalGroup ); sexagesimalLayout->addWidget( label, 0, 0 ); - mLatDegrees = new QSpinBox( 0, 90, 1, sexagesimalGroup ); + mLatDegrees = new TQSpinBox( 0, 90, 1, sexagesimalGroup ); mLatDegrees->setSuffix( "°" ); mLatDegrees->setWrapping( false ); label->setBuddy( mLatDegrees ); sexagesimalLayout->addWidget( mLatDegrees, 0, 1 ); - mLatMinutes = new QSpinBox( 0, 59, 1, sexagesimalGroup ); + mLatMinutes = new TQSpinBox( 0, 59, 1, sexagesimalGroup ); mLatMinutes->setSuffix( "'" ); sexagesimalLayout->addWidget( mLatMinutes, 0, 2 ); - mLatSeconds = new QSpinBox( 0, 59, 1, sexagesimalGroup ); + mLatSeconds = new TQSpinBox( 0, 59, 1, sexagesimalGroup ); mLatSeconds->setSuffix( "\"" ); sexagesimalLayout->addWidget( mLatSeconds, 0, 3 ); @@ -200,19 +200,19 @@ GeoDialog::GeoDialog( QWidget *parent, const char *name ) mLatDirection->insertItem( i18n( "South" ) ); sexagesimalLayout->addWidget( mLatDirection, 0, 4 ); - label = new QLabel( i18n( "Longitude:" ), sexagesimalGroup ); + label = new TQLabel( i18n( "Longitude:" ), sexagesimalGroup ); sexagesimalLayout->addWidget( label, 1, 0 ); - mLongDegrees = new QSpinBox( 0, 180, 1, sexagesimalGroup ); + mLongDegrees = new TQSpinBox( 0, 180, 1, sexagesimalGroup ); mLongDegrees->setSuffix( "°" ); label->setBuddy( mLongDegrees ); sexagesimalLayout->addWidget( mLongDegrees, 1, 1 ); - mLongMinutes = new QSpinBox( 0, 59, 1, sexagesimalGroup ); + mLongMinutes = new TQSpinBox( 0, 59, 1, sexagesimalGroup ); mLongMinutes->setSuffix( "'" ); sexagesimalLayout->addWidget( mLongMinutes, 1, 2 ); - mLongSeconds = new QSpinBox( 0, 59, 1, sexagesimalGroup ); + mLongSeconds = new TQSpinBox( 0, 59, 1, sexagesimalGroup ); mLongSeconds->setSuffix( "\"" ); sexagesimalLayout->addWidget( mLongSeconds, 1, 3 ); @@ -225,26 +225,26 @@ GeoDialog::GeoDialog( QWidget *parent, const char *name ) loadCityList(); - connect( mMapWidget, SIGNAL( changed() ), - SLOT( geoMapChanged() ) ); - connect( mCityCombo, SIGNAL( activated( int ) ), - SLOT( cityInputChanged() ) ); - connect( mLatDegrees, SIGNAL( valueChanged( int ) ), - SLOT( sexagesimalInputChanged() ) ); - connect( mLatMinutes, SIGNAL( valueChanged( int ) ), - SLOT( sexagesimalInputChanged() ) ); - connect( mLatSeconds, SIGNAL( valueChanged( int ) ), - SLOT( sexagesimalInputChanged() ) ); - connect( mLatDirection, SIGNAL( activated( int ) ), - SLOT( sexagesimalInputChanged() ) ); - connect( mLongDegrees, SIGNAL( valueChanged( int ) ), - SLOT( sexagesimalInputChanged() ) ); - connect( mLongMinutes, SIGNAL( valueChanged( int ) ), - SLOT( sexagesimalInputChanged() ) ); - connect( mLongSeconds, SIGNAL( valueChanged( int ) ), - SLOT( sexagesimalInputChanged() ) ); - connect( mLongDirection, SIGNAL( activated( int ) ), - SLOT( sexagesimalInputChanged() ) ); + connect( mMapWidget, TQT_SIGNAL( changed() ), + TQT_SLOT( geoMapChanged() ) ); + connect( mCityCombo, TQT_SIGNAL( activated( int ) ), + TQT_SLOT( cityInputChanged() ) ); + connect( mLatDegrees, TQT_SIGNAL( valueChanged( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); + connect( mLatMinutes, TQT_SIGNAL( valueChanged( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); + connect( mLatSeconds, TQT_SIGNAL( valueChanged( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); + connect( mLatDirection, TQT_SIGNAL( activated( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); + connect( mLongDegrees, TQT_SIGNAL( valueChanged( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); + connect( mLongMinutes, TQT_SIGNAL( valueChanged( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); + connect( mLongSeconds, TQT_SIGNAL( valueChanged( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); + connect( mLongDirection, TQT_SIGNAL( activated( int ) ), + TQT_SLOT( sexagesimalInputChanged() ) ); KAcceleratorManager::manage( this ); } @@ -380,14 +380,14 @@ void GeoDialog::loadCityList() mCityCombo->clear(); mGeoDataMap.clear(); - QFile file( locate( "data", "kaddressbook/zone.tab" ) ); + TQFile file( locate( "data", "kaddressbook/zone.tab" ) ); if ( file.open( IO_ReadOnly ) ) { - QTextStream s( &file ); + TQTextStream s( &file ); - QString line, country; - QRegExp coord( "[+-]\\d+[+-]\\d+" ); - QRegExp name( "[^\\s]+/[^\\s]+" ); + TQString line, country; + TQRegExp coord( "[+-]\\d+[+-]\\d+" ); + TQRegExp name( "[^\\s]+/[^\\s]+" ); int pos; while ( !s.eof() ) { @@ -396,7 +396,7 @@ void GeoDialog::loadCityList() continue; country = line.left( 2 ); - QString c, n; + TQString c, n; pos = coord.search( line, 0 ); if ( pos >= 0 ) c = line.mid( pos, coord.matchedLength() ); @@ -421,7 +421,7 @@ void GeoDialog::loadCityList() } } } - QStringList items( mGeoDataMap.keys() ); + TQStringList items( mGeoDataMap.keys() ); items.prepend( i18n( "Undefined" ) ); mCityCombo->insertStringList( items ); @@ -429,11 +429,11 @@ void GeoDialog::loadCityList() } } -double GeoDialog::calculateCoordinate( const QString &coordinate ) const +double GeoDialog::calculateCoordinate( const TQString &coordinate ) const { int neg; int d = 0, m = 0, s = 0; - QString str = coordinate; + TQString str = coordinate; neg = str.left( 1 ) == "-"; str.remove( 0, 1 ); @@ -469,7 +469,7 @@ double GeoDialog::calculateCoordinate( const QString &coordinate ) const int GeoDialog::nearestCity( double x, double y ) const { - QMap<QString, GeoData>::ConstIterator it; + TQMap<TQString, GeoData>::ConstIterator it; int pos = 0; for ( it = mGeoDataMap.begin(); it != mGeoDataMap.end(); ++it, ++pos ) { double dist = ( (*it).longitude - x ) * ( (*it).longitude - x ) + @@ -482,8 +482,8 @@ int GeoDialog::nearestCity( double x, double y ) const } -GeoMapWidget::GeoMapWidget( QWidget *parent, const char *name ) - : QWidget( parent, name ), mLatitude( 0 ), mLongitude( 0 ) +GeoMapWidget::GeoMapWidget( TQWidget *parent, const char *name ) + : TQWidget( parent, name ), mLatitude( 0 ), mLongitude( 0 ) { setBackgroundMode( NoBackground ); @@ -516,7 +516,7 @@ double GeoMapWidget::longitude()const return mLongitude; } -void GeoMapWidget::mousePressEvent( QMouseEvent *event ) +void GeoMapWidget::mousePressEvent( TQMouseEvent *event ) { double latMid = height() / 2; double longMid = width() / 2; @@ -530,19 +530,19 @@ void GeoMapWidget::mousePressEvent( QMouseEvent *event ) emit changed(); } -void GeoMapWidget::paintEvent( QPaintEvent* ) +void GeoMapWidget::paintEvent( TQPaintEvent* ) { uint w = width(); uint h = height(); - QPixmap pm( w, h ); - QPainter p; + TQPixmap pm( w, h ); + TQPainter p; p.begin( &pm, this ); - p.setPen( QColor( 255, 0, 0 ) ); - p.setBrush( QColor( 255, 0, 0 ) ); + p.setPen( TQColor( 255, 0, 0 ) ); + p.setBrush( TQColor( 255, 0, 0 ) ); - QPixmap world( locate( "data", "kaddressbook/pics/world.jpg" ) ); + TQPixmap world( locate( "data", "kaddressbook/pics/world.jpg" ) ); p.drawPixmap( 0, 0, world ); double latMid = h / 2; |