-rw-r--r-- | desktop/rpm/kdepim_rpm | 2 | ||||
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/phoneeditwidget.cpp | 80 | ||||
-rw-r--r-- | kaddressbook/phoneeditwidget.h | 21 | ||||
-rw-r--r-- | version | 2 |
5 files changed, 75 insertions, 32 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm index 2b5b390..9076943 100644 --- a/desktop/rpm/kdepim_rpm +++ b/desktop/rpm/kdepim_rpm | |||
@@ -1,67 +1,67 @@ | |||
1 | Summary: A collection of PIM programs | 1 | Summary: A collection of PIM programs |
2 | Name: KDE-Pim-Pi | 2 | Name: KDE-Pim-Pi |
3 | Version: 2.2.5 | 3 | Version: 2.2.6 |
4 | Release: SuSE_9.2 | 4 | Release: SuSE_9.2 |
5 | Copyright:GPL | 5 | Copyright:GPL |
6 | Group: Productivity/Pim | 6 | Group: Productivity/Pim |
7 | Source:http://sourceforge.net/projects/kdepimpi/ | 7 | Source:http://sourceforge.net/projects/kdepimpi/ |
8 | URL:http://sourceforge.net/projects/kdepimpi/ | 8 | URL:http://sourceforge.net/projects/kdepimpi/ |
9 | Packager: zautrix | 9 | Packager: zautrix |
10 | 10 | ||
11 | %description | 11 | %description |
12 | This package contains the platform-independent PIM programs from | 12 | This package contains the platform-independent PIM programs from |
13 | www.pi-sync.info, compiled for SuSE 9.2: | 13 | www.pi-sync.info, compiled for SuSE 9.2: |
14 | KTimeTacker/Pi | 14 | KTimeTacker/Pi |
15 | KPhone/Pi | 15 | KPhone/Pi |
16 | KAddressbook/Pi | 16 | KAddressbook/Pi |
17 | KOrganizer/Pi | 17 | KOrganizer/Pi |
18 | PasswordManager/Pi | 18 | PasswordManager/Pi |
19 | KOPieMail/Pi | 19 | KOPieMail/Pi |
20 | 20 | ||
21 | These applications do not need anything from the KDE-desktop | 21 | These applications do not need anything from the KDE-desktop |
22 | at all to run on Linux. However, there is a dependency from | 22 | at all to run on Linux. However, there is a dependency from |
23 | two KDE libs, because a small command line program is included | 23 | two KDE libs, because a small command line program is included |
24 | to make it possible to sync with the KDE-desktop applications. | 24 | to make it possible to sync with the KDE-desktop applications. |
25 | 25 | ||
26 | These applications are independent from the KDE-desktop | 26 | These applications are independent from the KDE-desktop |
27 | environment. That means, nothing of your existing | 27 | environment. That means, nothing of your existing |
28 | KDE-desktop setup will be changed, or any data | 28 | KDE-desktop setup will be changed, or any data |
29 | (calendar-addressbook) used by the KDE-desktop | 29 | (calendar-addressbook) used by the KDE-desktop |
30 | applications will be changed or accessed. | 30 | applications will be changed or accessed. |
31 | These applications stores their data and config in | 31 | These applications stores their data and config in |
32 | $HOME/kdepim/ | 32 | $HOME/kdepim/ |
33 | However, because the same file format is used, | 33 | However, because the same file format is used, |
34 | an easy exchange of data with the KDE-desktop | 34 | an easy exchange of data with the KDE-desktop |
35 | is possible. | 35 | is possible. |
36 | A small command line program is included | 36 | A small command line program is included |
37 | to make it possible to sync with the KDE-desktop applications. | 37 | to make it possible to sync with the KDE-desktop applications. |
38 | You do not need to call this program from the commandline, | 38 | You do not need to call this program from the commandline, |
39 | it is called from the KDE-Pim/Pi apps when you choose there: | 39 | it is called from the KDE-Pim/Pi apps when you choose there: |
40 | Sync with KDE_Desktop. | 40 | Sync with KDE_Desktop. |
41 | If something is going wrong, please start the | 41 | If something is going wrong, please start the |
42 | KDE-Pim/Pi program itself from the console to get detailed output. | 42 | KDE-Pim/Pi program itself from the console to get detailed output. |
43 | 43 | ||
44 | After installation, you should have a | 44 | After installation, you should have a |
45 | PIM-pi | 45 | PIM-pi |
46 | folder in your KDE start menu, where you can | 46 | folder in your KDE start menu, where you can |
47 | start the applications from. | 47 | start the applications from. |
48 | 48 | ||
49 | These programs makes it possible to sync your Zaurus easily | 49 | These programs makes it possible to sync your Zaurus easily |
50 | (with the KDE-Pim/Pi programs running on the Zaurus) | 50 | (with the KDE-Pim/Pi programs running on the Zaurus) |
51 | with the KDE-desktop calendar/addressbook data. | 51 | with the KDE-desktop calendar/addressbook data. |
52 | If you want to use that, you have to update your | 52 | If you want to use that, you have to update your |
53 | KDE-desktop to version 3.3.0 or higher. | 53 | KDE-desktop to version 3.3.0 or higher. |
54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. | 54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. |
55 | Actually - after the (non difficult) configuration is set up - | 55 | Actually - after the (non difficult) configuration is set up - |
56 | with two mouseklicks on the Zaurus, | 56 | with two mouseklicks on the Zaurus, |
57 | the Zaurus syncs with the corresponding KDE-Pim/Pi | 57 | the Zaurus syncs with the corresponding KDE-Pim/Pi |
58 | program on the Linux Desktop which syncs automatically | 58 | program on the Linux Desktop which syncs automatically |
59 | with the KDE-desktop data. | 59 | with the KDE-desktop data. |
60 | 60 | ||
61 | If you want to use the KDE-desktop calendar/addressbook applications, | 61 | If you want to use the KDE-desktop calendar/addressbook applications, |
62 | just install these apps in this package and use them as a syncing tool for the | 62 | just install these apps in this package and use them as a syncing tool for the |
63 | Zaurus <-> KDE-desktop sync. | 63 | Zaurus <-> KDE-desktop sync. |
64 | The sync requires a network connection from your Zaurus to | 64 | The sync requires a network connection from your Zaurus to |
65 | the PC. A detailed Sync HowTo is available in the | 65 | the PC. A detailed Sync HowTo is available in the |
66 | Help menu of the applications. | 66 | Help menu of the applications. |
67 | 67 | ||
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp index 9814cd5..966efa5 100644 --- a/kaddressbook/addresseeeditorwidget.cpp +++ b/kaddressbook/addresseeeditorwidget.cpp | |||
@@ -1127,129 +1127,129 @@ void AddresseeEditorWidget::save() | |||
1127 | mAddressee.setNickName( mNicknameEdit->text() ); | 1127 | mAddressee.setNickName( mNicknameEdit->text() ); |
1128 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); | 1128 | mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); |
1129 | 1129 | ||
1130 | mAddressee.setGeo( mGeoWidget->geo() ); | 1130 | mAddressee.setGeo( mGeoWidget->geo() ); |
1131 | mAddressee.setPhoto( mImageWidget->photo() ); | 1131 | mAddressee.setPhoto( mImageWidget->photo() ); |
1132 | mAddressee.setLogo( mImageWidget->logo() ); | 1132 | mAddressee.setLogo( mImageWidget->logo() ); |
1133 | mAddressee.setKeys( mKeyWidget->keys() ); | 1133 | mAddressee.setKeys( mKeyWidget->keys() ); |
1134 | #ifndef KAB_EMBEDDED | 1134 | #ifndef KAB_EMBEDDED |
1135 | mAddressee.setSound( mSoundWidget->sound() ); | 1135 | mAddressee.setSound( mSoundWidget->sound() ); |
1136 | #else //KAB_EMBEDDED | 1136 | #else //KAB_EMBEDDED |
1137 | //US qDebug("AddresseeEditorWidget::save sound not supported"); | 1137 | //US qDebug("AddresseeEditorWidget::save sound not supported"); |
1138 | #endif //KAB_EMBEDDED | 1138 | #endif //KAB_EMBEDDED |
1139 | mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); | 1139 | mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); |
1140 | 1140 | ||
1141 | // save custom fields | 1141 | // save custom fields |
1142 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); | 1142 | mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); |
1143 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); | 1143 | mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); |
1144 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); | 1144 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Children", mChildEdit->text() ); |
1145 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); | 1145 | mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); |
1146 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); | 1146 | mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); |
1147 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); | 1147 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); |
1148 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); | 1148 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); |
1149 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); | 1149 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); |
1150 | if ( mAnniversaryPicker->inputIsValid() ) { | 1150 | if ( mAnniversaryPicker->inputIsValid() ) { |
1151 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); | 1151 | QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); |
1152 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); | 1152 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); |
1153 | } | 1153 | } |
1154 | else { | 1154 | else { |
1155 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); | 1155 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); |
1156 | mAnniversaryPicker->clear(); | 1156 | mAnniversaryPicker->clear(); |
1157 | } | 1157 | } |
1158 | int gen = mGenderBox->currentItem (); | 1158 | int gen = mGenderBox->currentItem (); |
1159 | if ( gen == 1 ) | 1159 | if ( gen == 1 ) |
1160 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); | 1160 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female"); |
1161 | else if ( gen == 2 ) | 1161 | else if ( gen == 2 ) |
1162 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); | 1162 | mAddressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male"); |
1163 | else | 1163 | else |
1164 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); | 1164 | mAddressee.removeCustom( "KADDRESSBOOK", "X-Gender" ); |
1165 | 1165 | ||
1166 | // Save the email addresses | 1166 | // Save the email addresses |
1167 | QStringList emails = mAddressee.emails(); | 1167 | QStringList emails = mAddressee.emails(); |
1168 | QStringList::Iterator iter; | 1168 | QStringList::Iterator iter; |
1169 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) | 1169 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) |
1170 | mAddressee.removeEmail( *iter ); | 1170 | mAddressee.removeEmail( *iter ); |
1171 | 1171 | ||
1172 | emails = mEmailWidget->emails(); | 1172 | emails = mEmailWidget->emails(); |
1173 | bool first = true; | 1173 | bool first = true; |
1174 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { | 1174 | for ( iter = emails.begin(); iter != emails.end(); ++iter ) { |
1175 | mAddressee.insertEmail( *iter, first ); | 1175 | mAddressee.insertEmail( *iter, first ); |
1176 | first = false; | 1176 | first = false; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | // Save the phone numbers | 1179 | // Save the phone numbers |
1180 | KABC::PhoneNumber::List phoneNumbers; | 1180 | KABC::PhoneNumber::List phoneNumbers; |
1181 | KABC::PhoneNumber::List::Iterator phoneIter; | 1181 | KABC::PhoneNumber::List::Iterator phoneIter; |
1182 | phoneNumbers = mAddressee.phoneNumbers(); | 1182 | phoneNumbers = mAddressee.phoneNumbers(); |
1183 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1183 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1184 | ++phoneIter ) | 1184 | ++phoneIter ) |
1185 | mAddressee.removePhoneNumber( *phoneIter ); | 1185 | mAddressee.removePhoneNumber( *phoneIter ); |
1186 | 1186 | ||
1187 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); | 1187 | phoneNumbers = mPhoneEditWidget->phoneNumbers(); |
1188 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); | 1188 | for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); |
1189 | ++phoneIter ) | 1189 | ++phoneIter ) |
1190 | mAddressee.insertPhoneNumber( *phoneIter ); | 1190 | mAddressee.insertPhoneNumber( *phoneIter ); |
1191 | 1191 | mAddressee.makePhoneNumbersOLcompatible(); | |
1192 | // Save the addresses | 1192 | // Save the addresses |
1193 | KABC::Address::List addresses; | 1193 | KABC::Address::List addresses; |
1194 | KABC::Address::List::Iterator addressIter; | 1194 | KABC::Address::List::Iterator addressIter; |
1195 | addresses = mAddressee.addresses(); | 1195 | addresses = mAddressee.addresses(); |
1196 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1196 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1197 | ++addressIter ) | 1197 | ++addressIter ) |
1198 | mAddressee.removeAddress( *addressIter ); | 1198 | mAddressee.removeAddress( *addressIter ); |
1199 | 1199 | ||
1200 | addresses = mAddressEditWidget->addresses(); | 1200 | addresses = mAddressEditWidget->addresses(); |
1201 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); | 1201 | for ( addressIter = addresses.begin(); addressIter != addresses.end(); |
1202 | ++addressIter ) | 1202 | ++addressIter ) |
1203 | mAddressee.insertAddress( *addressIter ); | 1203 | mAddressee.insertAddress( *addressIter ); |
1204 | mDirty = false; | 1204 | mDirty = false; |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | bool AddresseeEditorWidget::dirty() | 1207 | bool AddresseeEditorWidget::dirty() |
1208 | { | 1208 | { |
1209 | 1209 | ||
1210 | if ( ! mDirty ) { | 1210 | if ( ! mDirty ) { |
1211 | if ( mBirthdayPicker->inputIsValid() ) { | 1211 | if ( mBirthdayPicker->inputIsValid() ) { |
1212 | QDate da = mBirthdayPicker->date(); | 1212 | QDate da = mBirthdayPicker->date(); |
1213 | if ( !(da == mAddressee.birthday().date())) | 1213 | if ( !(da == mAddressee.birthday().date())) |
1214 | mDirty = true; | 1214 | mDirty = true; |
1215 | } | 1215 | } |
1216 | else { | 1216 | else { |
1217 | mBirthdayPicker->clear(); | 1217 | mBirthdayPicker->clear(); |
1218 | } | 1218 | } |
1219 | if ( mAnniversaryPicker->inputIsValid() ) { | 1219 | if ( mAnniversaryPicker->inputIsValid() ) { |
1220 | QDate da = mAnniversaryPicker->date(); | 1220 | QDate da = mAnniversaryPicker->date(); |
1221 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), | 1221 | if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), |
1222 | "%Y-%m-%d")) | 1222 | "%Y-%m-%d")) |
1223 | mDirty = true; | 1223 | mDirty = true; |
1224 | } | 1224 | } |
1225 | else { | 1225 | else { |
1226 | mAnniversaryPicker->clear(); | 1226 | mAnniversaryPicker->clear(); |
1227 | } | 1227 | } |
1228 | } | 1228 | } |
1229 | return mDirty; | 1229 | return mDirty; |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) | 1232 | void AddresseeEditorWidget::nameTextChanged( const QString &text ) |
1233 | { | 1233 | { |
1234 | if ( mBlockSignals ) | 1234 | if ( mBlockSignals ) |
1235 | return; | 1235 | return; |
1236 | // use the addressee class to parse the name for us | 1236 | // use the addressee class to parse the name for us |
1237 | mAConfig->setUid( mAddressee.uid() ); | 1237 | mAConfig->setUid( mAddressee.uid() ); |
1238 | if ( mAConfig->automaticNameParsing() ) { | 1238 | if ( mAConfig->automaticNameParsing() ) { |
1239 | if ( !mAddressee.formattedName().isEmpty() ) { | 1239 | if ( !mAddressee.formattedName().isEmpty() ) { |
1240 | QString fn = mAddressee.formattedName(); | 1240 | QString fn = mAddressee.formattedName(); |
1241 | mAddressee.setNameFromString( text ); | 1241 | mAddressee.setNameFromString( text ); |
1242 | mAddressee.setFormattedName( fn ); | 1242 | mAddressee.setFormattedName( fn ); |
1243 | } else { | 1243 | } else { |
1244 | // use extra addressee to avoid a formatted name assignment | 1244 | // use extra addressee to avoid a formatted name assignment |
1245 | Addressee addr; | 1245 | Addressee addr; |
1246 | addr.setNameFromString( text ); | 1246 | addr.setNameFromString( text ); |
1247 | mAddressee.setPrefix( addr.prefix() ); | 1247 | mAddressee.setPrefix( addr.prefix() ); |
1248 | mAddressee.setGivenName( addr.givenName() ); | 1248 | mAddressee.setGivenName( addr.givenName() ); |
1249 | mAddressee.setAdditionalName( addr.additionalName() ); | 1249 | mAddressee.setAdditionalName( addr.additionalName() ); |
1250 | mAddressee.setFamilyName( addr.familyName() ); | 1250 | mAddressee.setFamilyName( addr.familyName() ); |
1251 | mAddressee.setSuffix( addr.suffix() ); | 1251 | mAddressee.setSuffix( addr.suffix() ); |
1252 | } | 1252 | } |
1253 | } | 1253 | } |
1254 | nameBoxChanged(); | 1254 | nameBoxChanged(); |
1255 | 1255 | ||
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp index 997fc05..9e7e221 100644 --- a/kaddressbook/phoneeditwidget.cpp +++ b/kaddressbook/phoneeditwidget.cpp | |||
@@ -1,166 +1,202 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | #include <qlistbox.h> | 30 | #include <qlistbox.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qbuttongroup.h> | 32 | #include <qbuttongroup.h> |
33 | #include <qhbox.h> | 33 | #include <qhbox.h> |
34 | #include <qcursor.h> | ||
34 | 35 | ||
35 | #include <kbuttonbox.h> | 36 | #include <kbuttonbox.h> |
36 | #include <klistview.h> | 37 | #include <klistview.h> |
37 | #include <kapplication.h> | 38 | #include <kapplication.h> |
38 | #include <qapplication.h> | 39 | #include <qapplication.h> |
39 | #include <kconfig.h> | 40 | #include <kconfig.h> |
40 | #include <klineedit.h> | 41 | #include <klineedit.h> |
41 | #include <kcombobox.h> | 42 | #include <kcombobox.h> |
42 | #include <klocale.h> | 43 | #include <klocale.h> |
43 | #include <kdebug.h> | 44 | #include <kdebug.h> |
44 | #include <kglobal.h> | 45 | #include <kglobal.h> |
45 | #include <kiconloader.h> | 46 | #include <kiconloader.h> |
46 | 47 | ||
47 | #include <kabc/phonenumber.h> | 48 | #include <kabc/phonenumber.h> |
48 | 49 | ||
49 | #include "typecombo.h" | 50 | #include "typecombo.h" |
50 | 51 | ||
51 | #include "phoneeditwidget.h" | 52 | #include "phoneeditwidget.h" |
52 | 53 | ||
53 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) | 54 | PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name ) |
54 | : QScrollView(parent,name) | 55 | : QWidget(parent,name) |
55 | { | 56 | { |
56 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); | 57 | QGridLayout* gridLayout = new QGridLayout ( this, 2,2 ); |
57 | setLineWidth ( 1 ); | 58 | |
58 | setMidLineWidth ( 1 ); | 59 | QLabel *temp = new QLabel( "", this ); |
59 | mw = new QWidget ( viewport() ); | 60 | temp->setAlignment( Qt::AlignCenter ); |
60 | addChild(mw); | 61 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); |
61 | setResizePolicy( AutoOneFit ); | 62 | gridLayout->addWidget( temp, 1, 0 ); |
63 | QPushButton *addBut = new QPushButton ( "add", this ); | ||
64 | addBut->setPixmap ( SmallIcon("plus")); | ||
65 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | ||
66 | connect(addBut,SIGNAL(clicked ()),SLOT(addNumber())); | ||
67 | gridLayout->addWidget( addBut, 0, 0 ); | ||
68 | |||
69 | sv = new QScrollView( this ); | ||
70 | sv->setFrameStyle ( QFrame::Panel | QFrame::Plain ); | ||
71 | sv->setLineWidth ( 1 ); | ||
72 | sv->setMidLineWidth ( 1 ); | ||
73 | mw = new QWidget ( sv->viewport() ); | ||
74 | sv->addChild(mw); | ||
75 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
62 | mainLayout = new QVBoxLayout ( mw ); | 76 | mainLayout = new QVBoxLayout ( mw ); |
63 | mainLayout->setMargin( 2 ); | 77 | mainLayout->setMargin( 2 ); |
64 | mainLayout->setSpacing( 2 ); | 78 | mainLayout->setSpacing( 2 ); |
65 | QWidget* hb = new QWidget ( mw ); | 79 | gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 ); |
66 | mainLayout->add( hb ); | ||
67 | QHBoxLayout* hbLayout = new QHBoxLayout ( hb ); | ||
68 | QPushButton *addBut = new QPushButton ( "add", hb ); | ||
69 | hbLayout->add( addBut ); | ||
70 | addBut->setPixmap ( SmallIcon("plus")); | ||
71 | addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() ); | ||
72 | connect(addBut,SIGNAL(clicked()),SLOT(addNumber())); | ||
73 | //QLabel * temp = new QLabel( i18n("Phone Type"), hb ); | ||
74 | QLabel *temp = new QLabel( i18n("Phone Number"),hb ); | ||
75 | temp->setAlignment( Qt::AlignCenter ); | ||
76 | temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) ); | ||
77 | hbLayout->add( temp ); | ||
78 | setDefaults(); | 80 | setDefaults(); |
79 | mTypeNumberEditList.setAutoDelete( true ); | 81 | mTypeNumberEditList.setAutoDelete( true ); |
82 | mPopup = new QPopupMenu( this ); | ||
83 | QStringList list = PhoneNumber::supportedTypeListNames(); | ||
84 | mPopupCount = list.count(); | ||
85 | int i = 0; | ||
86 | while ( i < mPopupCount ) { | ||
87 | mPopup->insertItem( list[ i ], i ); | ||
88 | ++i; | ||
89 | } | ||
90 | connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int))); | ||
91 | |||
80 | } | 92 | } |
81 | 93 | ||
82 | PhoneEditWidget::~PhoneEditWidget() | 94 | PhoneEditWidget::~PhoneEditWidget() |
83 | { | 95 | { |
84 | } | 96 | } |
85 | void PhoneEditWidget::setDefaults() | 97 | void PhoneEditWidget::setDefaults() |
86 | { | 98 | { |
87 | mTypeNumberEditList.clear(); | 99 | mTypeNumberEditList.clear(); |
88 | PhoneTypeNumberEdit* edit = appendEditCombo(); | 100 | PhoneTypeNumberEdit* edit = appendEditCombo(); |
89 | KABC::PhoneNumber phoneNumber; | 101 | KABC::PhoneNumber phoneNumber; |
90 | phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); | 102 | phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref ); |
91 | edit->setPhoneNumber( phoneNumber ); | 103 | edit->setPhoneNumber( phoneNumber ); |
92 | edit = appendEditCombo(); | 104 | edit = appendEditCombo(); |
93 | phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); | 105 | phoneNumber.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); |
94 | edit->setPhoneNumber( phoneNumber ); | 106 | edit->setPhoneNumber( phoneNumber ); |
95 | edit = appendEditCombo(); | 107 | edit = appendEditCombo(); |
96 | phoneNumber.setType( KABC::PhoneNumber::Cell ); | 108 | phoneNumber.setType( KABC::PhoneNumber::Cell ); |
97 | edit->setPhoneNumber( phoneNumber ); | 109 | edit->setPhoneNumber( phoneNumber ); |
98 | 110 | ||
99 | } | 111 | } |
112 | void PhoneEditWidget::addNumberInt( int index ) | ||
113 | { | ||
114 | PhoneTypeNumberEdit* edit = appendEditCombo(); | ||
115 | KABC::PhoneNumber phoneNumber; | ||
116 | phoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | ||
117 | edit->setPhoneNumber( phoneNumber ); | ||
118 | //verticalScrollBar()->setValue( 1024); | ||
119 | QTimer::singleShot( 0, this, SLOT ( bottomVisible() ) ); | ||
120 | } | ||
121 | void PhoneEditWidget::bottomVisible() | ||
122 | { | ||
123 | sv->setContentsPos ( 0, 1024 ); | ||
124 | } | ||
100 | void PhoneEditWidget::addNumber() | 125 | void PhoneEditWidget::addNumber() |
101 | { | 126 | { |
102 | 127 | int i = 0; | |
128 | while ( i < mPopupCount ) { | ||
129 | mPopup->setItemEnabled( i, true ); | ||
130 | ++i; | ||
131 | } | ||
132 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); | ||
133 | while ( edit ) { | ||
134 | if ( edit->currentType() < mPopupCount -1 ) | ||
135 | mPopup->setItemEnabled( edit->currentType(), false ); | ||
136 | edit = mTypeNumberEditList.next(); | ||
137 | } | ||
138 | mPopup->popup( QCursor::pos() ); | ||
103 | } | 139 | } |
104 | PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() | 140 | PhoneTypeNumberEdit* PhoneEditWidget::appendEditCombo() |
105 | { | 141 | { |
106 | PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); | 142 | PhoneTypeNumberEdit* edit = new PhoneTypeNumberEdit( mw ); |
107 | connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); | 143 | connect ( edit, SIGNAL ( typeChange( int , int) ), this, SIGNAL ( typeChange( int , int)) ); |
108 | connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); | 144 | connect ( edit, SIGNAL ( modified() ), this, SIGNAL ( modified() ) ); |
109 | connect ( edit, SIGNAL ( deleteMe( PhoneTypeNumberEdit* ) ), this, SLOT ( deleteEdit( PhoneTypeNumberEdit*) ) ); | 145 | connect ( edit, SIGNAL ( deleteMe( PhoneTypeNumberEdit* ) ), this, SLOT ( deleteEdit( PhoneTypeNumberEdit*) ) ); |
110 | connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) ); | 146 | connect ( this, SIGNAL ( typeChange( int , int)), edit, SLOT ( typeExternalChanged( int, int)) ); |
111 | 147 | ||
112 | mainLayout->add( edit ); | 148 | mainLayout->add( edit ); |
113 | mTypeNumberEditList.append( edit ); | 149 | mTypeNumberEditList.append( edit ); |
114 | return edit; | 150 | return edit; |
115 | } | 151 | } |
116 | 152 | ||
117 | void PhoneEditWidget::deleteEdit( PhoneTypeNumberEdit* ew ) | 153 | void PhoneEditWidget::deleteEdit( PhoneTypeNumberEdit* ew ) |
118 | { | 154 | { |
119 | mPendingDelete = ew; | 155 | mPendingDelete = ew; |
120 | QTimer::singleShot( 0, this, SLOT ( pendingDelete() ) ); | 156 | QTimer::singleShot( 0, this, SLOT ( pendingDelete() ) ); |
121 | } | 157 | } |
122 | void PhoneEditWidget::pendingDelete() | 158 | void PhoneEditWidget::pendingDelete() |
123 | { | 159 | { |
124 | mTypeNumberEditList.removeRef( mPendingDelete ); | 160 | mTypeNumberEditList.removeRef( mPendingDelete ); |
125 | emit modified(); | 161 | emit modified(); |
126 | } | 162 | } |
127 | 163 | ||
128 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) | 164 | void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li ) |
129 | { | 165 | { |
130 | if ( li.isEmpty() ) { | 166 | if ( li.isEmpty() ) { |
131 | setDefaults(); | 167 | setDefaults(); |
132 | return; | 168 | return; |
133 | } | 169 | } |
134 | mTypeNumberEditList.clear(); | 170 | mTypeNumberEditList.clear(); |
135 | KABC::PhoneNumber::List::Iterator it; | 171 | KABC::PhoneNumber::List::Iterator it; |
136 | KABC::PhoneNumber::List list = li; | 172 | KABC::PhoneNumber::List list = li; |
137 | PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first(); | 173 | PhoneTypeNumberEdit* edit = 0;//mTypeNumberEditList.first(); |
138 | for ( it = list.begin(); it != list.end(); ++it ) { | 174 | for ( it = list.begin(); it != list.end(); ++it ) { |
139 | if ( edit ) { | 175 | if ( edit ) { |
140 | edit->setPhoneNumber( (*it ) ); | 176 | edit->setPhoneNumber( (*it ) ); |
141 | edit = mTypeNumberEditList.next(); | 177 | edit = mTypeNumberEditList.next(); |
142 | } else { | 178 | } else { |
143 | PhoneTypeNumberEdit* editNew = appendEditCombo(); | 179 | PhoneTypeNumberEdit* editNew = appendEditCombo(); |
144 | editNew->setPhoneNumber( (*it ) ); | 180 | editNew->setPhoneNumber( (*it ) ); |
145 | } | 181 | } |
146 | } | 182 | } |
147 | while ( edit ) { | 183 | while ( edit ) { |
148 | edit->hide(); | 184 | edit->hide(); |
149 | edit = mTypeNumberEditList.next(); | 185 | edit = mTypeNumberEditList.next(); |
150 | } | 186 | } |
151 | } | 187 | } |
152 | KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() | 188 | KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers() |
153 | { | 189 | { |
154 | KABC::PhoneNumber::List retList; | 190 | KABC::PhoneNumber::List retList; |
155 | 191 | ||
156 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); | 192 | PhoneTypeNumberEdit* edit = mTypeNumberEditList.first(); |
157 | while ( edit ) { | 193 | while ( edit ) { |
158 | if ( edit->isValid() ) { | 194 | if ( edit->isValid() ) { |
159 | retList.append( edit->phoneNumber()); | 195 | retList.append( edit->phoneNumber()); |
160 | } | 196 | } |
161 | edit = mTypeNumberEditList.next(); | 197 | edit = mTypeNumberEditList.next(); |
162 | 198 | ||
163 | } | 199 | } |
164 | return retList; | 200 | return retList; |
165 | } | 201 | } |
166 | 202 | ||
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h index c730c7b..df5aff9 100644 --- a/kaddressbook/phoneeditwidget.h +++ b/kaddressbook/phoneeditwidget.h | |||
@@ -1,138 +1,144 @@ | |||
1 | #ifndef PHONEEDITWIDGET_H | 1 | #ifndef PHONEEDITWIDGET_H |
2 | #define PHONEEDITWIDGET_H | 2 | #define PHONEEDITWIDGET_H |
3 | /* | 3 | /* |
4 | This file is part of KAddressBook. | 4 | This file is part of KAddressBook. |
5 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 5 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <kdialogbase.h> | 26 | #include <kdialogbase.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qpopupmenu.h> | ||
30 | 31 | ||
31 | #include <qptrlist.h> | 32 | #include <qptrlist.h> |
32 | #include <qscrollview.h> | 33 | #include <qscrollview.h> |
33 | 34 | ||
34 | #include "addresseeconfig.h" | 35 | #include "addresseeconfig.h" |
35 | #include "typecombo.h" | 36 | #include "typecombo.h" |
36 | 37 | ||
37 | class QButtonGroup; | 38 | class QButtonGroup; |
38 | class QCheckBox; | 39 | class QCheckBox; |
39 | class PhoneTypeNumberEdit; | 40 | class PhoneTypeNumberEdit; |
40 | 41 | ||
41 | #include <klineedit.h> | 42 | #include <klineedit.h> |
42 | #include <kcombobox.h> | 43 | #include <kcombobox.h> |
43 | #include <kabc/phonenumber.h> | 44 | #include <kabc/phonenumber.h> |
44 | 45 | ||
45 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; | 46 | typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo; |
46 | 47 | ||
47 | /** | 48 | /** |
48 | Widget for editing phone numbers. | 49 | Widget for editing phone numbers. |
49 | */ | 50 | */ |
50 | class PhoneEditWidget : public QScrollView | 51 | class PhoneEditWidget : public QWidget |
51 | { | 52 | { |
52 | Q_OBJECT | 53 | Q_OBJECT |
53 | 54 | ||
54 | public: | 55 | public: |
55 | PhoneEditWidget( QWidget *parent, const char *name = 0 ); | 56 | PhoneEditWidget( QWidget *parent, const char *name = 0 ); |
56 | ~PhoneEditWidget(); | 57 | ~PhoneEditWidget(); |
57 | 58 | ||
58 | void setPhoneNumbers( const KABC::PhoneNumber::List &list ); | 59 | void setPhoneNumbers( const KABC::PhoneNumber::List &list ); |
59 | KABC::PhoneNumber::List phoneNumbers(); | 60 | KABC::PhoneNumber::List phoneNumbers(); |
60 | 61 | ||
61 | // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); | 62 | // void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); |
62 | //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); | 63 | //KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); |
63 | 64 | ||
64 | signals: | 65 | signals: |
65 | void modified(); | 66 | void modified(); |
66 | void typeChange( int oldType, int newType ); | 67 | void typeChange( int oldType, int newType ); |
67 | 68 | ||
68 | private slots: | 69 | private slots: |
70 | void bottomVisible(); | ||
71 | void addNumberInt( int ); | ||
69 | void deleteEdit( PhoneTypeNumberEdit* ew ); | 72 | void deleteEdit( PhoneTypeNumberEdit* ew ); |
70 | void addNumber(); | 73 | void addNumber(); |
71 | void pendingDelete(); | 74 | void pendingDelete(); |
72 | protected: | 75 | protected: |
73 | 76 | ||
74 | private: | 77 | private: |
78 | QScrollView* sv; | ||
79 | QPopupMenu *mPopup; | ||
80 | int mPopupCount; | ||
75 | PhoneTypeNumberEdit* mPendingDelete; | 81 | PhoneTypeNumberEdit* mPendingDelete; |
76 | void setDefaults(); | 82 | void setDefaults(); |
77 | PhoneTypeNumberEdit* appendEditCombo(); | 83 | PhoneTypeNumberEdit* appendEditCombo(); |
78 | QWidget* mw; | 84 | QWidget* mw; |
79 | QVBoxLayout* mainLayout; | 85 | QVBoxLayout* mainLayout; |
80 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; | 86 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; |
81 | 87 | ||
82 | KABC::PhoneNumber::List mPhoneList; | 88 | KABC::PhoneNumber::List mPhoneList; |
83 | }; | 89 | }; |
84 | 90 | ||
85 | 91 | ||
86 | 92 | ||
87 | 93 | ||
88 | 94 | ||
89 | #if 0 | 95 | #if 0 |
90 | class PhoneEditWidget : public QWidget | 96 | class PhoneEditWidget : public QWidget |
91 | { | 97 | { |
92 | Q___OBJECT | 98 | Q___OBJECT |
93 | 99 | ||
94 | public: | 100 | public: |
95 | PhoneEditWidget( QWidget *parent, const char *name = 0 ); | 101 | PhoneEditWidget( QWidget *parent, const char *name = 0 ); |
96 | ~PhoneEditWidget(); | 102 | ~PhoneEditWidget(); |
97 | 103 | ||
98 | void setPhoneNumbers( const KABC::PhoneNumber::List &list ); | 104 | void setPhoneNumbers( const KABC::PhoneNumber::List &list ); |
99 | KABC::PhoneNumber::List phoneNumbers(); | 105 | KABC::PhoneNumber::List phoneNumbers(); |
100 | 106 | ||
101 | void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); | 107 | void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* ); |
102 | KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); | 108 | KABC::PhoneNumber currentPhoneNumber( KComboBox*, int ); |
103 | 109 | ||
104 | sig_nals: | 110 | sig_nals: |
105 | void modified(); | 111 | void modified(); |
106 | void typeChange( int oldType, int newType ); | 112 | void typeChange( int oldType, int newType ); |
107 | 113 | ||
108 | private sl_ots: | 114 | private sl_ots: |
109 | void edit(); | 115 | void edit(); |
110 | 116 | ||
111 | void updatePrefEdit(); | 117 | void updatePrefEdit(); |
112 | void updateSecondEdit(); | 118 | void updateSecondEdit(); |
113 | void updateThirdEdit(); | 119 | void updateThirdEdit(); |
114 | void updateFourthEdit(); | 120 | void updateFourthEdit(); |
115 | 121 | ||
116 | void slotPrefEditChanged(); | 122 | void slotPrefEditChanged(); |
117 | void slotSecondEditChanged(); | 123 | void slotSecondEditChanged(); |
118 | void slotThirdEditChanged(); | 124 | void slotThirdEditChanged(); |
119 | void slotFourthEditChanged(); | 125 | void slotFourthEditChanged(); |
120 | 126 | ||
121 | protected: | 127 | protected: |
122 | void updateLineEdits(); | 128 | void updateLineEdits(); |
123 | void updateCombos(); | 129 | void updateCombos(); |
124 | 130 | ||
125 | private: | 131 | private: |
126 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; | 132 | QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList; |
127 | void updateEdit( PhoneTypeCombo *combo ); | 133 | void updateEdit( PhoneTypeCombo *combo ); |
128 | void updatePhoneNumber( PhoneTypeCombo *combo ); | 134 | void updatePhoneNumber( PhoneTypeCombo *combo ); |
129 | void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ); | 135 | void updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo ); |
130 | 136 | ||
131 | PhoneTypeCombo *mPrefCombo; | 137 | PhoneTypeCombo *mPrefCombo; |
132 | PhoneTypeCombo *mSecondCombo; | 138 | PhoneTypeCombo *mSecondCombo; |
133 | PhoneTypeCombo *mThirdCombo; | 139 | PhoneTypeCombo *mThirdCombo; |
134 | PhoneTypeCombo *mFourthCombo; | 140 | PhoneTypeCombo *mFourthCombo; |
135 | 141 | ||
136 | KLineEdit *mPrefEdit; | 142 | KLineEdit *mPrefEdit; |
137 | KLineEdit *mSecondEdit; | 143 | KLineEdit *mSecondEdit; |
138 | KLineEdit *mThirdEdit; | 144 | KLineEdit *mThirdEdit; |
@@ -165,123 +171,124 @@ class PhoneEditDialog : public KDialogBase | |||
165 | KABC::PhoneNumber::List mPhoneNumberList; | 171 | KABC::PhoneNumber::List mPhoneNumberList; |
166 | KABC::PhoneNumber::TypeList mTypeList; | 172 | KABC::PhoneNumber::TypeList mTypeList; |
167 | KComboBox *mTypeBox; | 173 | KComboBox *mTypeBox; |
168 | KListView *mListView; | 174 | KListView *mListView; |
169 | 175 | ||
170 | QPushButton *mRemoveButton; | 176 | QPushButton *mRemoveButton; |
171 | QPushButton *mEditButton; | 177 | QPushButton *mEditButton; |
172 | 178 | ||
173 | bool mChanged; | 179 | bool mChanged; |
174 | }; | 180 | }; |
175 | 181 | ||
176 | /** | 182 | /** |
177 | Dialog for editing phone number types. | 183 | Dialog for editing phone number types. |
178 | */ | 184 | */ |
179 | class PhoneTypeDialog : public KDialogBase | 185 | class PhoneTypeDialog : public KDialogBase |
180 | { | 186 | { |
181 | Q___OBJECT | 187 | Q___OBJECT |
182 | public: | 188 | public: |
183 | PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); | 189 | PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber, QWidget *parent, const char *name = 0 ); |
184 | 190 | ||
185 | KABC::PhoneNumber phoneNumber(); | 191 | KABC::PhoneNumber phoneNumber(); |
186 | 192 | ||
187 | private: | 193 | private: |
188 | KABC::PhoneNumber mPhoneNumber; | 194 | KABC::PhoneNumber mPhoneNumber; |
189 | KABC::PhoneNumber::TypeList mTypeList; | 195 | KABC::PhoneNumber::TypeList mTypeList; |
190 | 196 | ||
191 | QButtonGroup *mGroup; | 197 | QButtonGroup *mGroup; |
192 | QCheckBox *mPreferredBox; | 198 | QCheckBox *mPreferredBox; |
193 | KLineEdit *mNumber; | 199 | KLineEdit *mNumber; |
194 | }; | 200 | }; |
195 | #endif | 201 | #endif |
196 | 202 | ||
197 | class PhoneTypeNumberEdit : public QWidget | 203 | class PhoneTypeNumberEdit : public QWidget |
198 | { | 204 | { |
199 | Q_OBJECT | 205 | Q_OBJECT |
200 | public: | 206 | public: |
201 | PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) | 207 | PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent ) |
202 | { | 208 | { |
203 | QHBoxLayout * lay = new QHBoxLayout( this ); | 209 | QHBoxLayout * lay = new QHBoxLayout( this ); |
204 | lay->setSpacing( KDialogBase::spacingHintSmall() ); | 210 | lay->setSpacing( KDialogBase::spacingHintSmall() ); |
205 | lay->setMargin( KDialogBase::marginHintSmall() ); | 211 | lay->setMargin( KDialogBase::marginHintSmall() ); |
206 | mMinusButton = new QPushButton ( this ); | 212 | mMinusButton = new QPushButton ( this ); |
207 | mMinusButton->setPixmap ( SmallIcon("minus")); | 213 | mMinusButton->setPixmap ( SmallIcon("minus")); |
208 | mCombo = new KComboBox( this ); | 214 | mCombo = new KComboBox( this ); |
209 | mNumber = new KLineEdit( this ); | 215 | mNumber = new KLineEdit( this ); |
210 | lay->addWidget( mMinusButton ); | 216 | lay->addWidget( mMinusButton ); |
211 | lay->addWidget( mCombo ); | 217 | lay->addWidget( mCombo ); |
212 | lay->addWidget( mNumber ); | 218 | lay->addWidget( mNumber ); |
213 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); | 219 | connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) ); |
214 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); | 220 | connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) ); |
215 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), | 221 | connect( mNumber , SIGNAL ( textChanged ( const QString & ) ), |
216 | this, SLOT ( textChanged ( const QString & ) ) ); | 222 | this, SLOT ( textChanged ( const QString & ) ) ); |
217 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); | 223 | mCombo->insertStringList( PhoneNumber::supportedTypeListNames() ); |
218 | } | 224 | } |
219 | ~PhoneTypeNumberEdit() { | 225 | ~PhoneTypeNumberEdit() { |
220 | // qDebug("~PhoneTypeNumberEdit() "); | 226 | // qDebug("~PhoneTypeNumberEdit() "); |
221 | } | 227 | } |
222 | void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) | 228 | void setPhoneNumber( const KABC::PhoneNumber &phoneNumber ) |
223 | { | 229 | { |
224 | mPhoneNumber = phoneNumber; | 230 | mPhoneNumber = phoneNumber; |
225 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 231 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
226 | mCombo->setCurrentItem( index ); | 232 | mCombo->setCurrentItem( index ); |
227 | mNumber->setText( mPhoneNumber.number() ); | 233 | mNumber->setText( mPhoneNumber.number() ); |
228 | show(); | 234 | show(); |
229 | 235 | mNumber->setFocus(); | |
230 | } | 236 | } |
231 | KABC::PhoneNumber phoneNumber() | 237 | KABC::PhoneNumber phoneNumber() |
232 | { | 238 | { |
233 | mPhoneNumber.setNumber( mNumber->text() ); | 239 | mPhoneNumber.setNumber( mNumber->text() ); |
234 | int index = mCombo->currentItem(); | 240 | int index = mCombo->currentItem(); |
235 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); | 241 | mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] ); |
236 | return mPhoneNumber; | 242 | return mPhoneNumber; |
237 | } | 243 | } |
238 | bool isValid() | 244 | bool isValid() |
239 | { | 245 | { |
240 | if ( mNumber->text().isEmpty() )return false; | 246 | if ( mNumber->text().isEmpty() )return false; |
241 | return true; | 247 | return true; |
242 | } | 248 | } |
249 | int currentType() | ||
250 | { | ||
251 | return mCombo->currentItem(); | ||
252 | } | ||
243 | private slots: | 253 | private slots: |
244 | void typeExternalChanged( int oldType, int newType ) | 254 | void typeExternalChanged( int oldType, int newType ) |
245 | { | 255 | { |
246 | if ( mPhoneNumber.type() == newType ) { | 256 | if ( mPhoneNumber.type() == newType ) { |
247 | mPhoneNumber.setType(oldType); | 257 | mPhoneNumber.setType(oldType); |
248 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); | 258 | int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() ); |
249 | mCombo->setCurrentItem( index ); | 259 | mCombo->setCurrentItem( index ); |
250 | } | 260 | } |
251 | } | 261 | } |
252 | void deleteNumber() | 262 | void deleteNumber() |
253 | { | 263 | { |
254 | emit deleteMe( this ); | 264 | emit deleteMe( this ); |
255 | } | 265 | } |
256 | void comboTypeChange( int index ) | 266 | void comboTypeChange( int index ) |
257 | { | 267 | { |
258 | int old = mPhoneNumber.type(); | 268 | int old = mPhoneNumber.type(); |
259 | int newT = PhoneNumber::supportedTypeList()[index]; | 269 | int newT = PhoneNumber::supportedTypeList()[index]; |
260 | if ( old != newT ) { | 270 | if ( old != newT ) { |
261 | emit modified(); | 271 | emit modified(); |
262 | emit typeChange ( old, newT ); | 272 | if ( newT != PhoneNumber::Voice ) |
273 | emit typeChange ( old, newT ); | ||
263 | mPhoneNumber.setType(newT ); | 274 | mPhoneNumber.setType(newT ); |
264 | } | 275 | } |
265 | 276 | ||
266 | } | 277 | } |
267 | int currentType() | ||
268 | { | ||
269 | return mCombo->currentItem(); | ||
270 | } | ||
271 | void textChanged ( const QString & ) | 278 | void textChanged ( const QString & ) |
272 | { | 279 | { |
273 | emit modified(); | 280 | emit modified(); |
274 | } | 281 | } |
275 | signals: | 282 | signals: |
276 | void typeChange( int oldType, int newType ); | 283 | void typeChange( int oldType, int newType ); |
277 | void modified(); | 284 | void modified(); |
278 | void deleteMe( PhoneTypeNumberEdit* ); | 285 | void deleteMe( PhoneTypeNumberEdit* ); |
279 | 286 | ||
280 | private: | 287 | private: |
281 | KABC::PhoneNumber mPhoneNumber; | 288 | KABC::PhoneNumber mPhoneNumber; |
282 | QPushButton* mMinusButton; | 289 | QPushButton* mMinusButton; |
283 | KComboBox *mCombo; | 290 | KComboBox *mCombo; |
284 | KLineEdit *mNumber; | 291 | KLineEdit *mNumber; |
285 | }; | 292 | }; |
286 | 293 | ||
287 | #endif | 294 | #endif |
@@ -1 +1 @@ | |||
version = "2.2.5"; | version = "2.2.6"; | ||