akonadi
geoeditwidget.h
00001 /* 00002 This file is part of Akonadi Contact. 00003 00004 Copyright (c) 2009 Tobias Koenig <tokoe@kde.org> 00005 00006 This library is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU Library General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00014 License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to the 00018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 02110-1301, USA. 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
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:00:43 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue May 8 2012 00:00:43 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.