akonadi/contact
geoeditwidget.h
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,
00083 ExceptSexagesimal,
00084 ExceptDecimal
00085 };
00086
00087 private Q_SLOTS:
00088 void updateInputs( ExceptType type = ExceptNone );
00089
00090 void decimalInputChanged();
00091 void sexagesimalInputChanged();
00092 void cityInputChanged();
00093
00094 private:
00095 void loadCityList();
00096 int nearestCity( double, double ) const;
00097
00098 typedef struct {
00099 double latitude;
00100 double longitude;
00101 QString country;
00102 } GeoData;
00103
00104 KComboBox *mCityCombo;
00105
00106 QDoubleSpinBox *mLatitude;
00107 QDoubleSpinBox *mLongitude;
00108
00109 QSpinBox *mLatDegrees;
00110 QSpinBox *mLatMinutes;
00111 QSpinBox *mLatSeconds;
00112 KComboBox *mLatDirection;
00113
00114 QSpinBox *mLongDegrees;
00115 QSpinBox *mLongMinutes;
00116 QSpinBox *mLongSeconds;
00117 KComboBox *mLongDirection;
00118
00119 KABC::Geo mCoordinates;
00120 QMap<QString, GeoData> mGeoDataMap;
00121 bool mUpdateSexagesimalInput;
00122 };
00123
00124 #endif