geowidget.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GEOWIDGET_H
00025 #define GEOWIDGET_H
00026
00027 #include <qwidget.h>
00028 #include <kdialogbase.h>
00029
00030 namespace KABC {
00031 class Geo;
00032 }
00033
00034 class GeoMapWidget;
00035
00036 class KComboBox;
00037 class KDoubleSpinBox;
00038
00039 class QCheckBox;
00040 class QLabel;
00041 class QSpinBox;
00042 class QPushButton;
00043
00044 typedef struct {
00045 double latitude;
00046 double longitude;
00047 QString country;
00048 } GeoData;
00049
00050 class GeoWidget : public QWidget
00051 {
00052 Q_OBJECT
00053
00054 public:
00055 GeoWidget( QWidget *parent, const char *name = 0 );
00056 ~GeoWidget();
00057
00061 void setGeo( const KABC::Geo &geo );
00062
00066 KABC::Geo geo() const;
00067
00068 void setReadOnly( bool readOnly );
00069
00070 signals:
00071 void changed();
00072
00073 private slots:
00074 void editGeoData();
00075
00076 private:
00077 KDoubleSpinBox *mLatitudeBox;
00078 KDoubleSpinBox *mLongitudeBox;
00079
00080 QCheckBox *mGeoIsValid;
00081 QPushButton *mExtendedButton;
00082
00083 bool mReadOnly;
00084 };
00085
00086 class GeoDialog : public KDialogBase
00087 {
00088 Q_OBJECT
00089
00090 public:
00091 GeoDialog( QWidget *parent, const char *name = 0 );
00092 ~GeoDialog();
00093
00094 void setLatitude( double latitude );
00095 double latitude() const;
00096
00097 void setLongitude( double longitude );
00098 double longitude() const;
00099
00100 private slots:
00101 void updateInputs();
00102
00103 void sexagesimalInputChanged();
00104 void geoMapChanged();
00105 void cityInputChanged();
00106
00107 private:
00108 void loadCityList();
00109 double calculateCoordinate( const QString& );
00110 int nearestCity( double, double );
00111
00112 GeoMapWidget *mMapWidget;
00113 KComboBox *mCityCombo;
00114
00115 QSpinBox *mLatDegrees;
00116 QSpinBox *mLatMinutes;
00117 QSpinBox *mLatSeconds;
00118 KComboBox *mLatDirection;
00119
00120 QSpinBox *mLongDegrees;
00121 QSpinBox *mLongMinutes;
00122 QSpinBox *mLongSeconds;
00123 KComboBox *mLongDirection;
00124
00125 double mLatitude;
00126 double mLongitude;
00127 QMap<QString, GeoData> mGeoDataMap;
00128 bool mUpdateSexagesimalInput;
00129 };
00130
00131 class GeoMapWidget : public QWidget
00132 {
00133 Q_OBJECT
00134
00135 public:
00136 GeoMapWidget( QWidget *parent, const char *name = 0 );
00137 ~GeoMapWidget();
00138
00139 void setLatitude( double latitude );
00140 double latitude()const;
00141
00142 void setLongitude( double longitude );
00143 double longitude()const;
00144
00145 signals:
00146 void changed();
00147
00148 protected:
00149 virtual void mousePressEvent( QMouseEvent* );
00150 virtual void paintEvent( QPaintEvent* );
00151
00152 private:
00153 double mLatitude;
00154 double mLongitude;
00155 };
00156
00157 #endif
This file is part of the documentation for kaddressbook Library Version 3.2.2.