00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef SLZIPCONVERTOR_H
00010 #define SLZIPCONVERTOR_H
00011
00012 #include <qdialog.h>
00013 #include <qlistbox.h>
00014 #include <qlist.h>
00015
00016 class SlZIPPrivate;
00017 class QPushButton;
00018 class QCheckBox;
00019 class QLabel;
00020
00021 class SLAddressItem
00022 {
00023 public:
00024 SLAddressItem(QString &s,QString &c,QString &z,bool isDraw)
00025 {
00026 state = s;
00027 city = c;
00028 zip = z;
00029 isDrawZip = isDraw;
00030 }
00031
00032 QString stateStr(void) const {return state;}
00033 QString cityStr(void) const {return city;}
00034 QString zipStr(void) const {return zip;}
00035 bool drawZip(void) {return isDrawZip;}
00036 private:
00037 QString state;
00038 QString city;
00039 QString zip;
00040 bool isDrawZip;
00041 };
00042
00043 typedef QList<SLAddressItem> SlAddressList;
00044 typedef QListIterator<SLAddressItem> SlAddressListIterator;
00045
00046 class SlAddressListBox : public QListBox
00047 {
00048 Q_OBJECT
00049
00050 public:
00051 SlAddressListBox(QWidget* parent, const char* name = 0);
00052 ~SlAddressListBox();
00053
00054 void insertAdrsList(SlAddressList &list);
00055
00056 SLAddressItem* currentAdrItem(void);
00057
00058 virtual void clear();
00059
00060 protected:
00061
00062 private:
00063 SlAddressList *adrList;
00064 };
00065
00066 class SlZIPConvertor : public QDialog
00067 {
00068 Q_OBJECT
00069
00070 public:
00071 SlZIPConvertor( QWidget* parent=0, bool isShow = TRUE,
00072 const char* name=0, bool modal = TRUE );
00073 ~SlZIPConvertor();
00074
00075 bool isExecute();
00076 enum SearchMode { Zip2Adr,Adr2Zip };
00077 void setSearchMode(SlZIPConvertor::SearchMode mode);
00078
00079 void setZip(QString &zipStr);
00080 void setAddress(QString &adrStr);
00081
00082 void setStateAdoption(bool isCheck);
00083
00084 bool isSelectZip(void);
00085 bool isSelectAddress(void);
00086
00087 QString selectedZip(void);
00088 QString selectedState(void);
00089 QString selectedCity(void);
00090
00091 int convertor();
00092
00093 protected:
00094
00095 bool eventFilter(QObject*, QEvent *e);
00096
00097 private slots:
00098 void slotZipClicked();
00099 void slotAdrClicked();
00100 void slotAdrZipClicked();
00101 void slotSelectChanged();
00102 void slotClicked(QListBoxItem*);
00103
00104 private:
00105 SlZIPPrivate *d;
00106
00107 SlAddressListBox *adrList;
00108 QPushButton *zipBtn;
00109 QPushButton *adrBtn;
00110 QPushButton *zipadrBtn;
00111 QCheckBox *stateCheck;
00112 QLabel *zipLabel;
00113
00114 void init(bool);
00115 bool settingData();
00116 void settingAdrsList(SlAddressList &list,bool isDraw);
00117 };
00118
00119
00120 #endif