00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOEDITWIDGET_H
00023 #define GEOEDITWIDGET_H
00024
00025 #include <kabc/geo.h>
00026 #include <kdialog.h>
00027
00028 #include <QtGui/QWidget>
00029
00030 namespace KABC
00031 {
00032 class Addressee;
00033 }
00034
00035 class QDoubleSpinBox;
00036 class QLabel;
00037 class QPushButton;
00038 class QSpinBox;
00039
00040 class KComboBox;
00041
00042 class GeoMapWidget;
00043
00044 class GeoEditWidget : public QWidget
00045 {
00046 Q_OBJECT
00047
00048 public:
00049 GeoEditWidget( QWidget *parent = 0 );
00050 ~GeoEditWidget();
00051
00052 void loadContact( const KABC::Addressee &contact );
00053 void storeContact( KABC::Addressee &contact ) const;
00054
00055 void setReadOnly( bool readOnly );
00056
00057 private Q_SLOTS:
00058 void changeClicked();
00059
00060 private:
00061 void updateView();
00062
00063 GeoMapWidget *mMap;
00064 QLabel *mLatitudeLabel;
00065 QLabel *mLongitudeLabel;
00066 QPushButton *mChangeButton;
00067 KABC::Geo mCoordinates;
00068 bool mReadOnly;
00069 };
00070
00071 class GeoDialog : public KDialog
00072 {
00073 Q_OBJECT
00074
00075 public:
00076 GeoDialog( const KABC::Geo &coordinates, QWidget *parent );
00077
00078 KABC::Geo coordinates() const;
00079
00080 private:
00081 enum ExceptType {
00082 ExceptNone = 0,
00083 ExceptCity = 1,
00084 ExceptSexagesimal = 2,
00085 ExceptDecimal = 4
00086 };
00087
00088 private Q_SLOTS:
00089 void updateInputs( ExceptType type = ExceptNone );
00090
00091 void decimalInputChanged();
00092 void sexagesimalInputChanged();
00093 void cityInputChanged();
00094
00095 private:
00096 void loadCityList();
00097 int nearestCity( double, double ) const;
00098
00099 typedef struct {
00100 double latitude;
00101 double longitude;
00102 QString country;
00103 } GeoData;
00104
00105 KComboBox *mCityCombo;
00106
00107 QDoubleSpinBox *mLatitude;
00108 QDoubleSpinBox *mLongitude;
00109
00110 QSpinBox *mLatDegrees;
00111 QSpinBox *mLatMinutes;
00112 QSpinBox *mLatSeconds;
00113 KComboBox *mLatDirection;
00114
00115 QSpinBox *mLongDegrees;
00116 QSpinBox *mLongMinutes;
00117 QSpinBox *mLongSeconds;
00118 KComboBox *mLongDirection;
00119
00120 KABC::Geo mCoordinates;
00121 QMap<QString, GeoData> mGeoDataMap;
00122 bool mUpdateSexagesimalInput;
00123 };
00124
00125 #endif