GeoWidget::GeoWidget( KABC::AddressBook *ab, QWidget *parent, const char *name ) : KAB::ContactEditorWidget( ab, parent, name ), mReadOnly( false ) { QLabel *label = 0; QGridLayout *topLayout = new QGridLayout( this, 4, 3 ); topLayout->setMargin( KDialog::marginHint() ); topLayout->setSpacing( KDialog::spacingHint() ); label = new QLabel( 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 ); topLayout->addMultiCellWidget( mGeoIsValid, 0, 0, 1, 2 ); label = new QLabel( i18n( "Latitude:" ), this ); topLayout->addWidget( label, 1, 1 ); mLatitudeBox = new KDoubleSpinBox( -90, 90, 1, 0, 6, this ); mLatitudeBox->setEnabled( false ); mLatitudeBox->setSuffix( "°" ); topLayout->addWidget( mLatitudeBox, 1, 2 ); label->setBuddy( mLatitudeBox ); label = new QLabel( i18n( "Longitude:" ), this ); topLayout->addWidget( label, 2, 1 ); mLongitudeBox = new KDoubleSpinBox( -180, 180, 1, 0, 6, this ); mLongitudeBox->setEnabled( false ); mLongitudeBox->setSuffix( "°" ); topLayout->addWidget( mLongitudeBox, 2, 2 ); label->setBuddy( mLongitudeBox ); mExtendedButton = new QPushButton( 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() ) ); }
GeoWidget::GeoWidget( KABC::AddressBook *ab, QWidget *parent ) : KAB::ContactEditorWidget( ab, parent ), mReadOnly( false ) { QLabel *label = 0; QGridLayout *topLayout = new QGridLayout( this ); topLayout->setMargin( KDialog::marginHint() ); topLayout->setSpacing( KDialog::spacingHint() ); label = new QLabel( this ); label->setPixmap( KIconLoader::global()->loadIcon( "applications-internet", KIconLoader::Desktop, KIconLoader::SizeMedium ) ); label->setAlignment( Qt::AlignTop ); topLayout->addWidget( label, 0, 0, 4, 1); mGeoIsValid = new QCheckBox( i18nc( "@option:check", "Use geo data" ), this ); topLayout->addWidget( mGeoIsValid, 0, 1, 1, 2 ); label = new QLabel( i18nc( "@label:textbox", "Latitude:" ), this ); topLayout->addWidget( label, 1, 1 ); mLatitudeBox = new QDoubleSpinBox( this ); mLatitudeBox->setMinimum( -90 ); mLatitudeBox->setMaximum( 90 ); mLatitudeBox->setSingleStep( 1 ); mLatitudeBox->setValue( 0 ); mLatitudeBox->setDecimals( 6 ); mLatitudeBox->setEnabled( false ); mLatitudeBox->setSuffix( QString::fromUtf8( "°" ) ); topLayout->addWidget( mLatitudeBox, 1, 2 ); label->setBuddy( mLatitudeBox ); label = new QLabel( i18nc( "@label:textbox", "Longitude:" ), this ); topLayout->addWidget( label, 2, 1 ); mLongitudeBox = new QDoubleSpinBox( this ); mLongitudeBox->setMinimum( -180 ); mLongitudeBox->setMaximum( 180 ); mLongitudeBox->setSingleStep( 1 ); mLongitudeBox->setValue( 0 ); mLongitudeBox->setDecimals( 6 ); mLongitudeBox->setEnabled( false ); mLongitudeBox->setSuffix( QString::fromUtf8( "°" ) ); topLayout->addWidget( mLongitudeBox, 2, 2 ); label->setBuddy( mLongitudeBox ); mExtendedButton = new QPushButton( i18nc( "@action:button", "Edit Geo Data..." ), this ); mExtendedButton->setEnabled( false ); topLayout->addWidget( mExtendedButton, 3, 1, 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() ) ); }