kaddressbook Library API Documentation

geowidget.h

00001 /* 00002 This file is part of KAddressBook. 00003 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of Qt, and distribute the resulting executable, 00021 without including the source code for Qt in the source distribution. 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
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:08 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003