summaryrefslogtreecommitdiffabout
path: root/kaddressbook/geowidget.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/geowidget.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/geowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/geowidget.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/kaddressbook/geowidget.cpp b/kaddressbook/geowidget.cpp
index 13cd084..caff3b2 100644
--- a/kaddressbook/geowidget.cpp
+++ b/kaddressbook/geowidget.cpp
@@ -18,67 +18,74 @@
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kabc/geo.h>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#else //KAB_EMBEDDED
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <QMouseEvent>
#include <kglobal.h>
#endif //KAB_EMBEDDED
+#include <QDesktopWidget>
+
#include <knuminput.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <qcheckbox.h>
#include <qfile.h>
#include <qapplication.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qregexp.h>
#include <qstring.h>
#include <stdlib.h>
#include "geowidget.h"
GeoWidget::GeoWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
QLabel *label = 0;
- QGridLayout *topLayout = new QGridLayout( this, 4, 3 );
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 4, 3 );
topLayout->setMargin( KDialog::marginHint() );
topLayout->setSpacing( KDialog::spacingHint() );
label = new QLabel( this );
//US ambiguous call to loadIcon. Add an additional parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop, 0 ) );
label->setAlignment( Qt::AlignTop );
topLayout->addMultiCellWidget( label, 0, 3, 0, 0 );
- label->setAlignment( AlignCenter );
+ label->setAlignment( Qt::AlignCenter );
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 );
@@ -158,34 +165,34 @@ void GeoWidget::editGeoData()
emit changed();
}
}
GeoDialog::GeoDialog( QWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Geo Data Input" ), Ok | Cancel, Ok,
parent, name, true, true ),
mUpdateSexagesimalInput( true )
{
- QFrame *page = plainPage();
+ Q3Frame *page = plainPage();
- QGridLayout *topLayout = new QGridLayout( page, 1, 1, marginHintSmall(),
+ Q3GridLayout *topLayout = new Q3GridLayout( page, 1, 1, marginHintSmall(),
spacingHint() );
//topLayout->setRowStretch( 1, 1 );
mMapWidget = new GeoMapWidget( page );
mCityCombo = new KComboBox( page );
- QGroupBox *sexagesimalGroup = new QGroupBox( 0, Vertical, i18n( "Sexagesimal" ), page );
- QGridLayout *sexagesimalLayout = new QGridLayout( sexagesimalGroup->layout(),
+ Q3GroupBox *sexagesimalGroup = new Q3GroupBox( 0, Qt::Vertical, i18n( "Sexagesimal" ), page );
+ Q3GridLayout *sexagesimalLayout = new Q3GridLayout( sexagesimalGroup->layout(),
2, 5, spacingHint() );
QLabel *label;
if ( QApplication::desktop()->width() < 320 ) {
label = new QLabel( i18n( "La." ), sexagesimalGroup );
sexagesimalLayout->setSpacing ( spacingHintSmall() );
sexagesimalLayout->setMargin ( marginHintSmall() );
topLayout->setMargin ( 0 );
mCityCombo->setMaximumWidth( 220 );
sexagesimalGroup->setMaximumWidth( 220 );
}
else
label = new QLabel( i18n( "Latitude:" ), sexagesimalGroup );
@@ -420,26 +427,26 @@ void GeoDialog::loadCityList()
#ifndef _WIN32_
fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/zone.tab";
#else
fileName = qApp->applicationDirPath () + "\\kdepim\\kaddressbook\\zone.tab";
#endif
#else
fileName = getenv("QPEDIR");
fileName += "/pics/kdepim/kaddressbook/zone.tab";
#endif
QFile file( fileName);
- if ( file.open( IO_ReadOnly ) ) {
- QTextStream s( &file );
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ Q3TextStream s( &file );
QString line, country;
QRegExp coord( "[+-]\\d+[+-]\\d+" );
QRegExp name( "[^\\s]+/[^\\s]+" );
int posc, posn, pos;
while ( !s.eof() ) {
line = s.readLine().stripWhiteSpace();
if ( line.isEmpty() || line[ 0 ] == '#' )
continue;
country = line.left( 2 );
@@ -543,25 +550,25 @@ int GeoDialog::nearestCity( double x, double y )
( (*it).latitude - y ) * ( (*it).latitude - y );
if ( dist < 1.5 )
return pos;
}
return -1;
}
GeoMapWidget::GeoMapWidget( QWidget *parent, const char *name )
: QWidget( parent, name ), mLatitude( 0 ), mLongitude( 0 )
{
- setBackgroundMode( NoBackground );
+ setBackgroundMode( Qt::NoBackground );
setFixedSize( 240, 120 );
update();
}
GeoMapWidget::~GeoMapWidget()
{
}
void GeoMapWidget::setLatitude( double latitude )
{
@@ -615,15 +622,15 @@ void GeoMapWidget::paintEvent( QPaintEvent* )
double latOffset = ( mLatitude * latMid ) / 90;
double longOffset = ( mLongitude * longMid ) / 180;
int x = (int)(longMid + longOffset);
int y = (int)(latMid - latOffset);
p.drawEllipse( x, y, 4, 4 );
p.end();
bitBlt( this, 0, 0, &world );
}
-#ifndef KAB_EMBEDDED
-#include "geowidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_geowidget.cpp"
#endif //KAB_EMBEDDED