author | zautrix <zautrix> | 2005-01-17 19:49:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-17 19:49:42 (UTC) |
commit | 522486966ecf041a6e49913b6e420d58d4284837 (patch) (unidiff) | |
tree | d15da3e6ef9ec4638eba4aaf9f14ef0c5eaecd04 | |
parent | 32479683283fc9f20d369ac9671ba0f8a33d3381 (diff) | |
download | kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.zip kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.gz kdepimpi-522486966ecf041a6e49913b6e420d58d4284837.tar.bz2 |
const fixes
-rw-r--r-- | kabc/addressbook.cpp | 4 | ||||
-rw-r--r-- | kabc/addressbook.h | 2 | ||||
-rw-r--r-- | kabc/addressee.cpp | 10 | ||||
-rw-r--r-- | kabc/addressee.h | 10 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 33 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 5 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 2 | ||||
-rw-r--r-- | microkde/kidmanager.cpp | 10 | ||||
-rw-r--r-- | microkde/kidmanager.h | 10 |
10 files changed, 55 insertions, 33 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 4de7da2..9e61261 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -835,259 +835,259 @@ void AddressBook::removeAddressee( const Addressee &a ) | |||
835 | if ( ! id.isEmpty() ) { | 835 | if ( ! id.isEmpty() ) { |
836 | QString des = (*it).note(); | 836 | QString des = (*it).note(); |
837 | if( des.find( id ) < 0 ) { | 837 | if( des.find( id ) < 0 ) { |
838 | des += id + ","; | 838 | des += id + ","; |
839 | (*it).setNote( des ); | 839 | (*it).setNote( des ); |
840 | } | 840 | } |
841 | } | 841 | } |
842 | } | 842 | } |
843 | 843 | ||
844 | } | 844 | } |
845 | } | 845 | } |
846 | 846 | ||
847 | if ( found ) | 847 | if ( found ) |
848 | removeAddressee( it2 ); | 848 | removeAddressee( it2 ); |
849 | 849 | ||
850 | } | 850 | } |
851 | 851 | ||
852 | void AddressBook::removeSyncAddressees( bool removeDeleted ) | 852 | void AddressBook::removeSyncAddressees( bool removeDeleted ) |
853 | { | 853 | { |
854 | Iterator it = begin(); | 854 | Iterator it = begin(); |
855 | Iterator it2 ; | 855 | Iterator it2 ; |
856 | QDateTime dt ( QDate( 2003,1,1) ); | 856 | QDateTime dt ( QDate( 2003,1,1) ); |
857 | while ( it != end() ) { | 857 | while ( it != end() ) { |
858 | (*it).setRevision( dt ); | 858 | (*it).setRevision( dt ); |
859 | if (( *it).IDStr() != "changed" ) { | 859 | if (( *it).IDStr() != "changed" ) { |
860 | // "changed" is used for tagging changed addressees when syncing with KDE or OL | 860 | // "changed" is used for tagging changed addressees when syncing with KDE or OL |
861 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); | 861 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); |
862 | (*it).setIDStr(":"); | 862 | (*it).setIDStr(":"); |
863 | } | 863 | } |
864 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { | 864 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { |
865 | it2 = it; | 865 | it2 = it; |
866 | //qDebug("removing %s ",(*it).uid().latin1() ); | 866 | //qDebug("removing %s ",(*it).uid().latin1() ); |
867 | ++it; | 867 | ++it; |
868 | removeAddressee( it2 ); | 868 | removeAddressee( it2 ); |
869 | } else { | 869 | } else { |
870 | //qDebug("skipping %s ",(*it).uid().latin1() ); | 870 | //qDebug("skipping %s ",(*it).uid().latin1() ); |
871 | if ( removeDeleted ) { | 871 | if ( removeDeleted ) { |
872 | // we have no postprocessing in the resource, we have to do it here | 872 | // we have no postprocessing in the resource, we have to do it here |
873 | // we have to compute csum for all, because it could be the first sync | 873 | // we have to compute csum for all, because it could be the first sync |
874 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 874 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
875 | } | 875 | } |
876 | ++it; | 876 | ++it; |
877 | } | 877 | } |
878 | } | 878 | } |
879 | deleteRemovedAddressees(); | 879 | deleteRemovedAddressees(); |
880 | } | 880 | } |
881 | 881 | ||
882 | void AddressBook::removeAddressee( const Iterator &it ) | 882 | void AddressBook::removeAddressee( const Iterator &it ) |
883 | { | 883 | { |
884 | d->mRemovedAddressees.append( (*it) ); | 884 | d->mRemovedAddressees.append( (*it) ); |
885 | d->mAddressees.remove( it.d->mIt ); | 885 | d->mAddressees.remove( it.d->mIt ); |
886 | } | 886 | } |
887 | 887 | ||
888 | AddressBook::Iterator AddressBook::find( const Addressee &a ) | 888 | AddressBook::Iterator AddressBook::find( const Addressee &a ) |
889 | { | 889 | { |
890 | Iterator it; | 890 | Iterator it; |
891 | for ( it = begin(); it != end(); ++it ) { | 891 | for ( it = begin(); it != end(); ++it ) { |
892 | if ( a.uid() == (*it).uid() ) { | 892 | if ( a.uid() == (*it).uid() ) { |
893 | return it; | 893 | return it; |
894 | } | 894 | } |
895 | } | 895 | } |
896 | return end(); | 896 | return end(); |
897 | } | 897 | } |
898 | 898 | ||
899 | Addressee AddressBook::findByUid( const QString &uid ) | 899 | Addressee AddressBook::findByUid( const QString &uid ) |
900 | { | 900 | { |
901 | Iterator it; | 901 | Iterator it; |
902 | for ( it = begin(); it != end(); ++it ) { | 902 | for ( it = begin(); it != end(); ++it ) { |
903 | if ( uid == (*it).uid() ) { | 903 | if ( uid == (*it).uid() ) { |
904 | return *it; | 904 | return *it; |
905 | } | 905 | } |
906 | } | 906 | } |
907 | return Addressee(); | 907 | return Addressee(); |
908 | } | 908 | } |
909 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) | 909 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) |
910 | { | 910 | { |
911 | //qDebug("AddressBook::preExternSync "); | 911 | //qDebug("AddressBook::preExternSync "); |
912 | AddressBook::Iterator it; | 912 | AddressBook::Iterator it; |
913 | for ( it = begin(); it != end(); ++it ) { | 913 | for ( it = begin(); it != end(); ++it ) { |
914 | (*it).setID( csd, (*it).externalUID() ); | 914 | (*it).setID( csd, (*it).externalUID() ); |
915 | (*it).computeCsum( csd ); | 915 | (*it).computeCsum( csd ); |
916 | } | 916 | } |
917 | mergeAB( aBook ,csd, isSubset ); | 917 | mergeAB( aBook ,csd, isSubset ); |
918 | } | 918 | } |
919 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) | 919 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) |
920 | { | 920 | { |
921 | //qDebug("AddressBook::postExternSync "); | 921 | //qDebug("AddressBook::postExternSync "); |
922 | AddressBook::Iterator it; | 922 | AddressBook::Iterator it; |
923 | int foundEmpty = 0; | 923 | int foundEmpty = 0; |
924 | for ( it = begin(); it != end(); ++it ) { | 924 | for ( it = begin(); it != end(); ++it ) { |
925 | //qDebug("check uid %s ", (*it).uid().latin1() ); | 925 | //qDebug("check uid %s ", (*it).uid().latin1() ); |
926 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || | 926 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || |
927 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || | 927 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || |
928 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { | 928 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { |
929 | Addressee ad = aBook->findByUid( ( (*it).uid() )); | 929 | Addressee ad = aBook->findByUid( ( (*it).uid() )); |
930 | if ( ad.isEmpty() ) { | 930 | if ( ad.isEmpty() ) { |
931 | ++foundEmpty; | 931 | ++foundEmpty; |
932 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); | 932 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); |
933 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); | 933 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); |
934 | } else { | 934 | } else { |
935 | (*it).setIDStr(":"); | 935 | (*it).setIDStr(":"); |
936 | if ( setID ) { | 936 | if ( setID ) { |
937 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) | 937 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) |
938 | ad.setID( csd, (*it).externalUID() ); | 938 | ad.setID( csd, (*it).externalUID() ); |
939 | } else | 939 | } else |
940 | ad.setID( csd, (*it).uid() ); | 940 | ad.setID( csd, (*it).uid() ); |
941 | (*it).computeCsum( csd ); | 941 | (*it).computeCsum( csd ); |
942 | ad.setCsum( csd, (*it).getCsum( csd ) ); | 942 | ad.setCsum( csd, (*it).getCsum( csd ) ); |
943 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); | 943 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); |
944 | aBook->insertAddressee( ad , false); | 944 | aBook->insertAddressee( ad , false); |
945 | } | 945 | } |
946 | } | 946 | } |
947 | } | 947 | } |
948 | if ( foundEmpty ) { | 948 | if ( foundEmpty ) { |
949 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); | 949 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); |
950 | } | 950 | } |
951 | 951 | ||
952 | } | 952 | } |
953 | 953 | ||
954 | bool AddressBook::containsExternalUid( const QString& uid ) | 954 | bool AddressBook::containsExternalUid( const QString& uid ) |
955 | { | 955 | { |
956 | Iterator it; | 956 | Iterator it; |
957 | for ( it = begin(); it != end(); ++it ) { | 957 | for ( it = begin(); it != end(); ++it ) { |
958 | if ( uid == (*it).externalUID( ) ) | 958 | if ( uid == (*it).externalUID( ) ) |
959 | return true; | 959 | return true; |
960 | } | 960 | } |
961 | return false; | 961 | return false; |
962 | } | 962 | } |
963 | Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) | 963 | const Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) const |
964 | { | 964 | { |
965 | Iterator it; | 965 | ConstIterator it; |
966 | for ( it = begin(); it != end(); ++it ) { | 966 | for ( it = begin(); it != end(); ++it ) { |
967 | if ( uid == (*it).getID( profile ) ) | 967 | if ( uid == (*it).getID( profile ) ) |
968 | return (*it); | 968 | return (*it); |
969 | } | 969 | } |
970 | return Addressee(); | 970 | return Addressee(); |
971 | } | 971 | } |
972 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) | 972 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) |
973 | { | 973 | { |
974 | Iterator it; | 974 | Iterator it; |
975 | Addressee ad; | 975 | Addressee ad; |
976 | for ( it = begin(); it != end(); ++it ) { | 976 | for ( it = begin(); it != end(); ++it ) { |
977 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); | 977 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); |
978 | if ( !ad.isEmpty() ) { | 978 | if ( !ad.isEmpty() ) { |
979 | (*it).mergeContact( ad ,isSubset); | 979 | (*it).mergeContact( ad ,isSubset); |
980 | } | 980 | } |
981 | } | 981 | } |
982 | #if 0 | 982 | #if 0 |
983 | // test only | 983 | // test only |
984 | for ( it = begin(); it != end(); ++it ) { | 984 | for ( it = begin(); it != end(); ++it ) { |
985 | 985 | ||
986 | qDebug("uid %s ", (*it).uid().latin1()); | 986 | qDebug("uid %s ", (*it).uid().latin1()); |
987 | } | 987 | } |
988 | #endif | 988 | #endif |
989 | } | 989 | } |
990 | 990 | ||
991 | #if 0 | 991 | #if 0 |
992 | Addressee::List AddressBook::getExternLastSyncAddressees() | 992 | Addressee::List AddressBook::getExternLastSyncAddressees() |
993 | { | 993 | { |
994 | Addressee::List results; | 994 | Addressee::List results; |
995 | 995 | ||
996 | Iterator it; | 996 | Iterator it; |
997 | for ( it = begin(); it != end(); ++it ) { | 997 | for ( it = begin(); it != end(); ++it ) { |
998 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { | 998 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { |
999 | if ( (*it).familyName().left(4) == "!E: " ) | 999 | if ( (*it).familyName().left(4) == "!E: " ) |
1000 | results.append( *it ); | 1000 | results.append( *it ); |
1001 | } | 1001 | } |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | return results; | 1004 | return results; |
1005 | } | 1005 | } |
1006 | #endif | 1006 | #endif |
1007 | void AddressBook::resetTempSyncStat() | 1007 | void AddressBook::resetTempSyncStat() |
1008 | { | 1008 | { |
1009 | Iterator it; | 1009 | Iterator it; |
1010 | for ( it = begin(); it != end(); ++it ) { | 1010 | for ( it = begin(); it != end(); ++it ) { |
1011 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); | 1011 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | QStringList AddressBook:: uidList() | 1016 | QStringList AddressBook:: uidList() |
1017 | { | 1017 | { |
1018 | QStringList results; | 1018 | QStringList results; |
1019 | Iterator it; | 1019 | Iterator it; |
1020 | for ( it = begin(); it != end(); ++it ) { | 1020 | for ( it = begin(); it != end(); ++it ) { |
1021 | results.append( (*it).uid() ); | 1021 | results.append( (*it).uid() ); |
1022 | } | 1022 | } |
1023 | return results; | 1023 | return results; |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | 1026 | ||
1027 | Addressee::List AddressBook::allAddressees() | 1027 | Addressee::List AddressBook::allAddressees() |
1028 | { | 1028 | { |
1029 | return d->mAddressees; | 1029 | return d->mAddressees; |
1030 | 1030 | ||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | Addressee::List AddressBook::findByName( const QString &name ) | 1033 | Addressee::List AddressBook::findByName( const QString &name ) |
1034 | { | 1034 | { |
1035 | Addressee::List results; | 1035 | Addressee::List results; |
1036 | 1036 | ||
1037 | Iterator it; | 1037 | Iterator it; |
1038 | for ( it = begin(); it != end(); ++it ) { | 1038 | for ( it = begin(); it != end(); ++it ) { |
1039 | if ( name == (*it).realName() ) { | 1039 | if ( name == (*it).realName() ) { |
1040 | results.append( *it ); | 1040 | results.append( *it ); |
1041 | } | 1041 | } |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | return results; | 1044 | return results; |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | Addressee::List AddressBook::findByEmail( const QString &email ) | 1047 | Addressee::List AddressBook::findByEmail( const QString &email ) |
1048 | { | 1048 | { |
1049 | Addressee::List results; | 1049 | Addressee::List results; |
1050 | QStringList mailList; | 1050 | QStringList mailList; |
1051 | 1051 | ||
1052 | Iterator it; | 1052 | Iterator it; |
1053 | for ( it = begin(); it != end(); ++it ) { | 1053 | for ( it = begin(); it != end(); ++it ) { |
1054 | mailList = (*it).emails(); | 1054 | mailList = (*it).emails(); |
1055 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { | 1055 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { |
1056 | if ( email == (*ite) ) { | 1056 | if ( email == (*ite) ) { |
1057 | results.append( *it ); | 1057 | results.append( *it ); |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | return results; | 1062 | return results; |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | Addressee::List AddressBook::findByCategory( const QString &category ) | 1065 | Addressee::List AddressBook::findByCategory( const QString &category ) |
1066 | { | 1066 | { |
1067 | Addressee::List results; | 1067 | Addressee::List results; |
1068 | 1068 | ||
1069 | Iterator it; | 1069 | Iterator it; |
1070 | for ( it = begin(); it != end(); ++it ) { | 1070 | for ( it = begin(); it != end(); ++it ) { |
1071 | if ( (*it).hasCategory( category) ) { | 1071 | if ( (*it).hasCategory( category) ) { |
1072 | results.append( *it ); | 1072 | results.append( *it ); |
1073 | } | 1073 | } |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | return results; | 1076 | return results; |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | void AddressBook::dump() const | 1079 | void AddressBook::dump() const |
1080 | { | 1080 | { |
1081 | kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl; | 1081 | kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl; |
1082 | 1082 | ||
1083 | ConstIterator it; | 1083 | ConstIterator it; |
1084 | for( it = begin(); it != end(); ++it ) { | 1084 | for( it = begin(); it != end(); ++it ) { |
1085 | (*it).dump(); | 1085 | (*it).dump(); |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | kdDebug(5700) << "AddressBook::dump() --- end ---" << endl; | 1088 | kdDebug(5700) << "AddressBook::dump() --- end ---" << endl; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | QString AddressBook::identifier() | 1091 | QString AddressBook::identifier() |
1092 | { | 1092 | { |
1093 | QStringList identifier; | 1093 | QStringList identifier; |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index 2351add..18c03b5 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -179,172 +179,172 @@ class AddressBook : public QObject | |||
179 | 179 | ||
180 | /** | 180 | /** |
181 | Insert an Addressee object into address book. If an object with the same | 181 | Insert an Addressee object into address book. If an object with the same |
182 | unique id already exists in the address book it it replaced by the new | 182 | unique id already exists in the address book it it replaced by the new |
183 | one. If not the new object is appended to the address book. | 183 | one. If not the new object is appended to the address book. |
184 | */ | 184 | */ |
185 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); | 185 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); |
186 | 186 | ||
187 | /** | 187 | /** |
188 | Removes entry from the address book. | 188 | Removes entry from the address book. |
189 | */ | 189 | */ |
190 | void removeAddressee( const Addressee & ); | 190 | void removeAddressee( const Addressee & ); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | This is like @ref removeAddressee() just above, with the difference that | 193 | This is like @ref removeAddressee() just above, with the difference that |
194 | the first element is a iterator, returned by @ref begin(). | 194 | the first element is a iterator, returned by @ref begin(). |
195 | */ | 195 | */ |
196 | void removeAddressee( const Iterator & ); | 196 | void removeAddressee( const Iterator & ); |
197 | 197 | ||
198 | /** | 198 | /** |
199 | Find the specified entry in address book. Returns end(), if the entry | 199 | Find the specified entry in address book. Returns end(), if the entry |
200 | couldn't be found. | 200 | couldn't be found. |
201 | */ | 201 | */ |
202 | Iterator find( const Addressee & ); | 202 | Iterator find( const Addressee & ); |
203 | 203 | ||
204 | /** | 204 | /** |
205 | Find the entry specified by an unique id. Returns an empty Addressee | 205 | Find the entry specified by an unique id. Returns an empty Addressee |
206 | object, if the address book does not contain an entry with this id. | 206 | object, if the address book does not contain an entry with this id. |
207 | */ | 207 | */ |
208 | Addressee findByUid( const QString & ); | 208 | Addressee findByUid( const QString & ); |
209 | 209 | ||
210 | 210 | ||
211 | /** | 211 | /** |
212 | Returns a list of all addressees in the address book. This list can | 212 | Returns a list of all addressees in the address book. This list can |
213 | be sorted with @ref KABC::AddresseeList for example. | 213 | be sorted with @ref KABC::AddresseeList for example. |
214 | */ | 214 | */ |
215 | Addressee::List allAddressees(); | 215 | Addressee::List allAddressees(); |
216 | 216 | ||
217 | /** | 217 | /** |
218 | Find all entries with the specified name in the address book. Returns | 218 | Find all entries with the specified name in the address book. Returns |
219 | an empty list, if no entries could be found. | 219 | an empty list, if no entries could be found. |
220 | */ | 220 | */ |
221 | Addressee::List findByName( const QString & ); | 221 | Addressee::List findByName( const QString & ); |
222 | 222 | ||
223 | /** | 223 | /** |
224 | Find all entries with the specified email address in the address book. | 224 | Find all entries with the specified email address in the address book. |
225 | Returns an empty list, if no entries could be found. | 225 | Returns an empty list, if no entries could be found. |
226 | */ | 226 | */ |
227 | Addressee::List findByEmail( const QString & ); | 227 | Addressee::List findByEmail( const QString & ); |
228 | 228 | ||
229 | /** | 229 | /** |
230 | Find all entries wich have the specified category in the address book. | 230 | Find all entries wich have the specified category in the address book. |
231 | Returns an empty list, if no entries could be found. | 231 | Returns an empty list, if no entries could be found. |
232 | */ | 232 | */ |
233 | Addressee::List findByCategory( const QString & ); | 233 | Addressee::List findByCategory( const QString & ); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | Return a string identifying this addressbook. | 236 | Return a string identifying this addressbook. |
237 | */ | 237 | */ |
238 | virtual QString identifier(); | 238 | virtual QString identifier(); |
239 | 239 | ||
240 | /** | 240 | /** |
241 | Used for debug output. | 241 | Used for debug output. |
242 | */ | 242 | */ |
243 | void dump() const; | 243 | void dump() const; |
244 | 244 | ||
245 | void emitAddressBookLocked() { emit addressBookLocked( this ); } | 245 | void emitAddressBookLocked() { emit addressBookLocked( this ); } |
246 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } | 246 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } |
247 | void emitAddressBookChanged() { emit addressBookChanged( this ); } | 247 | void emitAddressBookChanged() { emit addressBookChanged( this ); } |
248 | 248 | ||
249 | /** | 249 | /** |
250 | Return list of all Fields known to the address book which are associated | 250 | Return list of all Fields known to the address book which are associated |
251 | with the given field category. | 251 | with the given field category. |
252 | */ | 252 | */ |
253 | Field::List fields( int category = Field::All ); | 253 | Field::List fields( int category = Field::All ); |
254 | 254 | ||
255 | /** | 255 | /** |
256 | Add custom field to address book. | 256 | Add custom field to address book. |
257 | 257 | ||
258 | @param label User visible label of the field. | 258 | @param label User visible label of the field. |
259 | @param category Ored list of field categories. | 259 | @param category Ored list of field categories. |
260 | @param key Identifier used as key for reading and writing the field. | 260 | @param key Identifier used as key for reading and writing the field. |
261 | @param app String used as application key for reading and writing | 261 | @param app String used as application key for reading and writing |
262 | the field. | 262 | the field. |
263 | */ | 263 | */ |
264 | bool addCustomField( const QString &label, int category = Field::All, | 264 | bool addCustomField( const QString &label, int category = Field::All, |
265 | const QString &key = QString::null, | 265 | const QString &key = QString::null, |
266 | const QString &app = QString::null ); | 266 | const QString &app = QString::null ); |
267 | 267 | ||
268 | 268 | ||
269 | /** | 269 | /** |
270 | Add address book resource. | 270 | Add address book resource. |
271 | */ | 271 | */ |
272 | bool addResource( Resource * ); | 272 | bool addResource( Resource * ); |
273 | 273 | ||
274 | /** | 274 | /** |
275 | Remove address book resource. | 275 | Remove address book resource. |
276 | */ | 276 | */ |
277 | void removeResources(); | 277 | void removeResources(); |
278 | bool removeResource( Resource * ); | 278 | bool removeResource( Resource * ); |
279 | 279 | ||
280 | /** | 280 | /** |
281 | Return pointer list of all resources. | 281 | Return pointer list of all resources. |
282 | */ | 282 | */ |
283 | QPtrList<Resource> resources(); | 283 | QPtrList<Resource> resources(); |
284 | 284 | ||
285 | /** | 285 | /** |
286 | Set the @p ErrorHandler, that is used by @ref error() to | 286 | Set the @p ErrorHandler, that is used by @ref error() to |
287 | provide gui-independend error messages. | 287 | provide gui-independend error messages. |
288 | */ | 288 | */ |
289 | void setErrorHandler( ErrorHandler * ); | 289 | void setErrorHandler( ErrorHandler * ); |
290 | 290 | ||
291 | /** | 291 | /** |
292 | Shows gui independend error messages. | 292 | Shows gui independend error messages. |
293 | */ | 293 | */ |
294 | void error( const QString& ); | 294 | void error( const QString& ); |
295 | 295 | ||
296 | /** | 296 | /** |
297 | Query all resources to clean up their lock files | 297 | Query all resources to clean up their lock files |
298 | */ | 298 | */ |
299 | void cleanUp(); | 299 | void cleanUp(); |
300 | 300 | ||
301 | // sync stuff | 301 | // sync stuff |
302 | //Addressee::List getExternLastSyncAddressees(); | 302 | //Addressee::List getExternLastSyncAddressees(); |
303 | void resetTempSyncStat(); | 303 | void resetTempSyncStat(); |
304 | QStringList uidList(); | 304 | QStringList uidList(); |
305 | void removeSyncAddressees( bool removeDeleted = false ); | 305 | void removeSyncAddressees( bool removeDeleted = false ); |
306 | void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); | 306 | void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); |
307 | Addressee findByExternUid( const QString& uid , const QString& profile ); | 307 | const Addressee findByExternUid( const QString& uid , const QString& profile ) const; |
308 | bool containsExternalUid( const QString& uid ); | 308 | bool containsExternalUid( const QString& uid ); |
309 | 309 | ||
310 | void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); | 310 | void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); |
311 | void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); | 311 | void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); |
312 | signals: | 312 | signals: |
313 | /** | 313 | /** |
314 | Emitted, when the address book has changed on disk. | 314 | Emitted, when the address book has changed on disk. |
315 | */ | 315 | */ |
316 | void addressBookChanged( AddressBook * ); | 316 | void addressBookChanged( AddressBook * ); |
317 | 317 | ||
318 | /** | 318 | /** |
319 | Emitted, when the address book has been locked for writing. | 319 | Emitted, when the address book has been locked for writing. |
320 | */ | 320 | */ |
321 | void addressBookLocked( AddressBook * ); | 321 | void addressBookLocked( AddressBook * ); |
322 | 322 | ||
323 | /** | 323 | /** |
324 | Emitted, when the address book has been unlocked. | 324 | Emitted, when the address book has been unlocked. |
325 | */ | 325 | */ |
326 | void addressBookUnlocked( AddressBook * ); | 326 | void addressBookUnlocked( AddressBook * ); |
327 | 327 | ||
328 | protected: | 328 | protected: |
329 | void deleteRemovedAddressees(); | 329 | void deleteRemovedAddressees(); |
330 | void setStandardResource( Resource * ); | 330 | void setStandardResource( Resource * ); |
331 | Resource *standardResource(); | 331 | Resource *standardResource(); |
332 | KRES::Manager<Resource> *resourceManager(); | 332 | KRES::Manager<Resource> *resourceManager(); |
333 | 333 | ||
334 | void init(const QString &config, const QString &family); | 334 | void init(const QString &config, const QString &family); |
335 | 335 | ||
336 | private: | 336 | private: |
337 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 | 337 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 |
338 | 338 | ||
339 | 339 | ||
340 | struct AddressBookData; | 340 | struct AddressBookData; |
341 | AddressBookData *d; | 341 | AddressBookData *d; |
342 | bool blockLSEchange; | 342 | bool blockLSEchange; |
343 | }; | 343 | }; |
344 | 344 | ||
345 | QDataStream &operator<<( QDataStream &, const AddressBook & ); | 345 | QDataStream &operator<<( QDataStream &, const AddressBook & ); |
346 | QDataStream &operator>>( QDataStream &, AddressBook & ); | 346 | QDataStream &operator>>( QDataStream &, AddressBook & ); |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | #endif | 350 | #endif |
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index d60cd6b..3b238f5 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -464,321 +464,321 @@ void Addressee::simplifyAddresses() | |||
464 | 464 | ||
465 | 465 | ||
466 | Address::List list; | 466 | Address::List list; |
467 | Address::List::Iterator it; | 467 | Address::List::Iterator it; |
468 | Address::List::Iterator it2; | 468 | Address::List::Iterator it2; |
469 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 469 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
470 | it2 = it; | 470 | it2 = it; |
471 | ++it2; | 471 | ++it2; |
472 | for( ; it2 != mData->addresses.end(); ++it2 ) { | 472 | for( ; it2 != mData->addresses.end(); ++it2 ) { |
473 | if ( (*it) == (*it2) ) { | 473 | if ( (*it) == (*it2) ) { |
474 | list.append( *it ); | 474 | list.append( *it ); |
475 | break; | 475 | break; |
476 | } | 476 | } |
477 | } | 477 | } |
478 | } | 478 | } |
479 | for( it = list.begin(); it != list.end(); ++it ) { | 479 | for( it = list.begin(); it != list.end(); ++it ) { |
480 | removeAddress( (*it) ); | 480 | removeAddress( (*it) ); |
481 | } | 481 | } |
482 | 482 | ||
483 | list.clear(); | 483 | list.clear(); |
484 | int max = 2; | 484 | int max = 2; |
485 | if ( mData->url.isValid() ) | 485 | if ( mData->url.isValid() ) |
486 | max = 1; | 486 | max = 1; |
487 | if ( mData->addresses.count() <= max ) return ; | 487 | if ( mData->addresses.count() <= max ) return ; |
488 | int count = 0; | 488 | int count = 0; |
489 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 489 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
490 | if ( count >= max ) | 490 | if ( count >= max ) |
491 | list.append( *it ); | 491 | list.append( *it ); |
492 | ++count; | 492 | ++count; |
493 | } | 493 | } |
494 | for( it = list.begin(); it != list.end(); ++it ) { | 494 | for( it = list.begin(); it != list.end(); ++it ) { |
495 | removeAddress( (*it) ); | 495 | removeAddress( (*it) ); |
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | // removes all emails but the first | 499 | // removes all emails but the first |
500 | // needed by phone sync | 500 | // needed by phone sync |
501 | void Addressee::simplifyEmails() | 501 | void Addressee::simplifyEmails() |
502 | { | 502 | { |
503 | if ( mData->emails.count() == 0 ) return ; | 503 | if ( mData->emails.count() == 0 ) return ; |
504 | QString email = mData->emails.first(); | 504 | QString email = mData->emails.first(); |
505 | detach(); | 505 | detach(); |
506 | mData->emails.clear(); | 506 | mData->emails.clear(); |
507 | mData->emails.append( email ); | 507 | mData->emails.append( email ); |
508 | } | 508 | } |
509 | 509 | ||
510 | void Addressee::simplifyPhoneNumbers() | 510 | void Addressee::simplifyPhoneNumbers() |
511 | { | 511 | { |
512 | int max = 4; | 512 | int max = 4; |
513 | int inList = mData->phoneNumbers.count(); | 513 | int inList = mData->phoneNumbers.count(); |
514 | KABC::PhoneNumber::List removeNumbers; | 514 | KABC::PhoneNumber::List removeNumbers; |
515 | KABC::PhoneNumber::List::Iterator phoneIter; | 515 | KABC::PhoneNumber::List::Iterator phoneIter; |
516 | if ( inList > max ) { | 516 | if ( inList > max ) { |
517 | // delete non-preferred numbers | 517 | // delete non-preferred numbers |
518 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 518 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
519 | ++phoneIter ) { | 519 | ++phoneIter ) { |
520 | if ( inList > max ) { | 520 | if ( inList > max ) { |
521 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { | 521 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { |
522 | removeNumbers.append( ( *phoneIter ) ); | 522 | removeNumbers.append( ( *phoneIter ) ); |
523 | --inList; | 523 | --inList; |
524 | } | 524 | } |
525 | } else | 525 | } else |
526 | break; | 526 | break; |
527 | } | 527 | } |
528 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 528 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
529 | ++phoneIter ) { | 529 | ++phoneIter ) { |
530 | removePhoneNumber(( *phoneIter )); | 530 | removePhoneNumber(( *phoneIter )); |
531 | } | 531 | } |
532 | // delete preferred numbers | 532 | // delete preferred numbers |
533 | if ( inList > max ) { | 533 | if ( inList > max ) { |
534 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 534 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
535 | ++phoneIter ) { | 535 | ++phoneIter ) { |
536 | if ( inList > max ) { | 536 | if ( inList > max ) { |
537 | removeNumbers.append( ( *phoneIter ) ); | 537 | removeNumbers.append( ( *phoneIter ) ); |
538 | --inList; | 538 | --inList; |
539 | } else | 539 | } else |
540 | break; | 540 | break; |
541 | } | 541 | } |
542 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 542 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
543 | ++phoneIter ) { | 543 | ++phoneIter ) { |
544 | removePhoneNumber(( *phoneIter )); | 544 | removePhoneNumber(( *phoneIter )); |
545 | } | 545 | } |
546 | } | 546 | } |
547 | } | 547 | } |
548 | // remove non-numeric characters | 548 | // remove non-numeric characters |
549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
550 | ++phoneIter ) { | 550 | ++phoneIter ) { |
551 | if ( ! ( *phoneIter ).simplifyNumber() ) | 551 | if ( ! ( *phoneIter ).simplifyNumber() ) |
552 | removeNumbers.append( ( *phoneIter ) ); | 552 | removeNumbers.append( ( *phoneIter ) ); |
553 | } | 553 | } |
554 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 554 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
555 | ++phoneIter ) { | 555 | ++phoneIter ) { |
556 | removePhoneNumber(( *phoneIter )); | 556 | removePhoneNumber(( *phoneIter )); |
557 | } | 557 | } |
558 | } | 558 | } |
559 | void Addressee::simplifyPhoneNumberTypes() | 559 | void Addressee::simplifyPhoneNumberTypes() |
560 | { | 560 | { |
561 | KABC::PhoneNumber::List::Iterator phoneIter; | 561 | KABC::PhoneNumber::List::Iterator phoneIter; |
562 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 562 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
563 | ++phoneIter ) | 563 | ++phoneIter ) |
564 | ( *phoneIter ).simplifyType(); | 564 | ( *phoneIter ).simplifyType(); |
565 | } | 565 | } |
566 | void Addressee::removeID(const QString &prof) | 566 | void Addressee::removeID(const QString &prof) |
567 | { | 567 | { |
568 | detach(); | 568 | detach(); |
569 | if ( prof.isEmpty() ) | 569 | if ( prof.isEmpty() ) |
570 | mData->mExternalId = ":"; | 570 | mData->mExternalId = ":"; |
571 | else | 571 | else |
572 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 572 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
573 | 573 | ||
574 | } | 574 | } |
575 | void Addressee::setID( const QString & prof , const QString & id ) | 575 | void Addressee::setID( const QString & prof , const QString & id ) |
576 | { | 576 | { |
577 | detach(); | 577 | detach(); |
578 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 578 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
579 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 579 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
580 | } | 580 | } |
581 | void Addressee::setTempSyncStat( int id ) | 581 | void Addressee::setTempSyncStat( int id ) |
582 | { | 582 | { |
583 | if ( mData->mTempSyncStat == id ) return; | 583 | if ( mData->mTempSyncStat == id ) return; |
584 | detach(); | 584 | detach(); |
585 | mData->mTempSyncStat = id; | 585 | mData->mTempSyncStat = id; |
586 | } | 586 | } |
587 | int Addressee::tempSyncStat() const | 587 | int Addressee::tempSyncStat() const |
588 | { | 588 | { |
589 | return mData->mTempSyncStat; | 589 | return mData->mTempSyncStat; |
590 | } | 590 | } |
591 | 591 | ||
592 | QString Addressee::getID( const QString & prof) | 592 | const QString Addressee::getID( const QString & prof) const |
593 | { | 593 | { |
594 | return KIdManager::getId ( mData->mExternalId, prof ); | 594 | return KIdManager::getId ( mData->mExternalId, prof ); |
595 | } | 595 | } |
596 | 596 | ||
597 | void Addressee::setCsum( const QString & prof , const QString & id ) | 597 | void Addressee::setCsum( const QString & prof , const QString & id ) |
598 | { | 598 | { |
599 | detach(); | 599 | detach(); |
600 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 600 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
601 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 601 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
602 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 602 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
603 | } | 603 | } |
604 | 604 | ||
605 | QString Addressee::getCsum( const QString & prof) | 605 | const QString Addressee::getCsum( const QString & prof) const |
606 | { | 606 | { |
607 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 607 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
608 | } | 608 | } |
609 | 609 | ||
610 | void Addressee::setIDStr( const QString & s ) | 610 | void Addressee::setIDStr( const QString & s ) |
611 | { | 611 | { |
612 | detach(); | 612 | detach(); |
613 | mData->mExternalId = s; | 613 | mData->mExternalId = s; |
614 | } | 614 | } |
615 | 615 | ||
616 | QString Addressee::IDStr() const | 616 | const QString Addressee::IDStr() const |
617 | { | 617 | { |
618 | return mData->mExternalId; | 618 | return mData->mExternalId; |
619 | } | 619 | } |
620 | 620 | ||
621 | void Addressee::setExternalUID( const QString &id ) | 621 | void Addressee::setExternalUID( const QString &id ) |
622 | { | 622 | { |
623 | if ( id == mData->externalUID ) return; | 623 | if ( id == mData->externalUID ) return; |
624 | detach(); | 624 | detach(); |
625 | mData->empty = false; | 625 | mData->empty = false; |
626 | mData->externalUID = id; | 626 | mData->externalUID = id; |
627 | } | 627 | } |
628 | 628 | ||
629 | QString Addressee::externalUID() const | 629 | const QString Addressee::externalUID() const |
630 | { | 630 | { |
631 | return mData->externalUID; | 631 | return mData->externalUID; |
632 | } | 632 | } |
633 | void Addressee::setOriginalExternalUID( const QString &id ) | 633 | void Addressee::setOriginalExternalUID( const QString &id ) |
634 | { | 634 | { |
635 | if ( id == mData->originalExternalUID ) return; | 635 | if ( id == mData->originalExternalUID ) return; |
636 | detach(); | 636 | detach(); |
637 | mData->empty = false; | 637 | mData->empty = false; |
638 | //qDebug("*******Set orig uid %s ", id.latin1()); | 638 | //qDebug("*******Set orig uid %s ", id.latin1()); |
639 | mData->originalExternalUID = id; | 639 | mData->originalExternalUID = id; |
640 | } | 640 | } |
641 | 641 | ||
642 | QString Addressee::originalExternalUID() const | 642 | QString Addressee::originalExternalUID() const |
643 | { | 643 | { |
644 | return mData->originalExternalUID; | 644 | return mData->originalExternalUID; |
645 | } | 645 | } |
646 | 646 | ||
647 | void Addressee::setUid( const QString &id ) | 647 | void Addressee::setUid( const QString &id ) |
648 | { | 648 | { |
649 | if ( id == mData->uid ) return; | 649 | if ( id == mData->uid ) return; |
650 | detach(); | 650 | detach(); |
651 | //qDebug("****setuid %s ", id.latin1()); | 651 | //qDebug("****setuid %s ", id.latin1()); |
652 | mData->empty = false; | 652 | mData->empty = false; |
653 | mData->uid = id; | 653 | mData->uid = id; |
654 | } | 654 | } |
655 | 655 | ||
656 | QString Addressee::uid() const | 656 | const QString Addressee::uid() const |
657 | { | 657 | { |
658 | if ( mData->uid.isEmpty() ) | 658 | if ( mData->uid.isEmpty() ) |
659 | mData->uid = KApplication::randomString( 10 ); | 659 | mData->uid = KApplication::randomString( 10 ); |
660 | 660 | ||
661 | return mData->uid; | 661 | return mData->uid; |
662 | } | 662 | } |
663 | 663 | ||
664 | QString Addressee::uidLabel() | 664 | QString Addressee::uidLabel() |
665 | { | 665 | { |
666 | return i18n("Unique Identifier"); | 666 | return i18n("Unique Identifier"); |
667 | } | 667 | } |
668 | 668 | ||
669 | void Addressee::setName( const QString &name ) | 669 | void Addressee::setName( const QString &name ) |
670 | { | 670 | { |
671 | if ( name == mData->name ) return; | 671 | if ( name == mData->name ) return; |
672 | detach(); | 672 | detach(); |
673 | mData->empty = false; | 673 | mData->empty = false; |
674 | mData->name = name; | 674 | mData->name = name; |
675 | } | 675 | } |
676 | 676 | ||
677 | QString Addressee::name() const | 677 | QString Addressee::name() const |
678 | { | 678 | { |
679 | return mData->name; | 679 | return mData->name; |
680 | } | 680 | } |
681 | 681 | ||
682 | QString Addressee::nameLabel() | 682 | QString Addressee::nameLabel() |
683 | { | 683 | { |
684 | return i18n("Name"); | 684 | return i18n("Name"); |
685 | } | 685 | } |
686 | 686 | ||
687 | 687 | ||
688 | void Addressee::setFormattedName( const QString &formattedName ) | 688 | void Addressee::setFormattedName( const QString &formattedName ) |
689 | { | 689 | { |
690 | if ( formattedName == mData->formattedName ) return; | 690 | if ( formattedName == mData->formattedName ) return; |
691 | detach(); | 691 | detach(); |
692 | mData->empty = false; | 692 | mData->empty = false; |
693 | mData->formattedName = formattedName; | 693 | mData->formattedName = formattedName; |
694 | } | 694 | } |
695 | 695 | ||
696 | QString Addressee::formattedName() const | 696 | QString Addressee::formattedName() const |
697 | { | 697 | { |
698 | return mData->formattedName; | 698 | return mData->formattedName; |
699 | } | 699 | } |
700 | 700 | ||
701 | QString Addressee::formattedNameLabel() | 701 | QString Addressee::formattedNameLabel() |
702 | { | 702 | { |
703 | return i18n("Formatted Name"); | 703 | return i18n("Formatted Name"); |
704 | } | 704 | } |
705 | 705 | ||
706 | 706 | ||
707 | void Addressee::setFamilyName( const QString &familyName ) | 707 | void Addressee::setFamilyName( const QString &familyName ) |
708 | { | 708 | { |
709 | if ( familyName == mData->familyName ) return; | 709 | if ( familyName == mData->familyName ) return; |
710 | detach(); | 710 | detach(); |
711 | mData->empty = false; | 711 | mData->empty = false; |
712 | mData->familyName = familyName; | 712 | mData->familyName = familyName; |
713 | } | 713 | } |
714 | 714 | ||
715 | QString Addressee::familyName() const | 715 | QString Addressee::familyName() const |
716 | { | 716 | { |
717 | return mData->familyName; | 717 | return mData->familyName; |
718 | } | 718 | } |
719 | 719 | ||
720 | QString Addressee::familyNameLabel() | 720 | QString Addressee::familyNameLabel() |
721 | { | 721 | { |
722 | return i18n("Family Name"); | 722 | return i18n("Family Name"); |
723 | } | 723 | } |
724 | 724 | ||
725 | 725 | ||
726 | void Addressee::setGivenName( const QString &givenName ) | 726 | void Addressee::setGivenName( const QString &givenName ) |
727 | { | 727 | { |
728 | if ( givenName == mData->givenName ) return; | 728 | if ( givenName == mData->givenName ) return; |
729 | detach(); | 729 | detach(); |
730 | mData->empty = false; | 730 | mData->empty = false; |
731 | mData->givenName = givenName; | 731 | mData->givenName = givenName; |
732 | } | 732 | } |
733 | 733 | ||
734 | QString Addressee::givenName() const | 734 | QString Addressee::givenName() const |
735 | { | 735 | { |
736 | return mData->givenName; | 736 | return mData->givenName; |
737 | } | 737 | } |
738 | 738 | ||
739 | QString Addressee::givenNameLabel() | 739 | QString Addressee::givenNameLabel() |
740 | { | 740 | { |
741 | return i18n("Given Name"); | 741 | return i18n("Given Name"); |
742 | } | 742 | } |
743 | 743 | ||
744 | 744 | ||
745 | void Addressee::setAdditionalName( const QString &additionalName ) | 745 | void Addressee::setAdditionalName( const QString &additionalName ) |
746 | { | 746 | { |
747 | if ( additionalName == mData->additionalName ) return; | 747 | if ( additionalName == mData->additionalName ) return; |
748 | detach(); | 748 | detach(); |
749 | mData->empty = false; | 749 | mData->empty = false; |
750 | mData->additionalName = additionalName; | 750 | mData->additionalName = additionalName; |
751 | } | 751 | } |
752 | 752 | ||
753 | QString Addressee::additionalName() const | 753 | QString Addressee::additionalName() const |
754 | { | 754 | { |
755 | return mData->additionalName; | 755 | return mData->additionalName; |
756 | } | 756 | } |
757 | 757 | ||
758 | QString Addressee::additionalNameLabel() | 758 | QString Addressee::additionalNameLabel() |
759 | { | 759 | { |
760 | return i18n("Additional Names"); | 760 | return i18n("Additional Names"); |
761 | } | 761 | } |
762 | 762 | ||
763 | 763 | ||
764 | void Addressee::setPrefix( const QString &prefix ) | 764 | void Addressee::setPrefix( const QString &prefix ) |
765 | { | 765 | { |
766 | if ( prefix == mData->prefix ) return; | 766 | if ( prefix == mData->prefix ) return; |
767 | detach(); | 767 | detach(); |
768 | mData->empty = false; | 768 | mData->empty = false; |
769 | mData->prefix = prefix; | 769 | mData->prefix = prefix; |
770 | } | 770 | } |
771 | 771 | ||
772 | QString Addressee::prefix() const | 772 | QString Addressee::prefix() const |
773 | { | 773 | { |
774 | return mData->prefix; | 774 | return mData->prefix; |
775 | } | 775 | } |
776 | 776 | ||
777 | QString Addressee::prefixLabel() | 777 | QString Addressee::prefixLabel() |
778 | { | 778 | { |
779 | return i18n("Honorific Prefixes"); | 779 | return i18n("Honorific Prefixes"); |
780 | } | 780 | } |
781 | 781 | ||
782 | 782 | ||
783 | void Addressee::setSuffix( const QString &suffix ) | 783 | void Addressee::setSuffix( const QString &suffix ) |
784 | { | 784 | { |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 08d2f56..8051fec 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -1,262 +1,262 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef KABC_ADDRESSEE_H | 29 | #ifndef KABC_ADDRESSEE_H |
30 | #define KABC_ADDRESSEE_H | 30 | #define KABC_ADDRESSEE_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | 36 | ||
37 | #include <ksharedptr.h> | 37 | #include <ksharedptr.h> |
38 | #include <kurl.h> | 38 | #include <kurl.h> |
39 | 39 | ||
40 | #include "address.h" | 40 | #include "address.h" |
41 | #include "agent.h" | 41 | #include "agent.h" |
42 | #include "geo.h" | 42 | #include "geo.h" |
43 | #include "key.h" | 43 | #include "key.h" |
44 | #include "phonenumber.h" | 44 | #include "phonenumber.h" |
45 | #include "picture.h" | 45 | #include "picture.h" |
46 | #include "secrecy.h" | 46 | #include "secrecy.h" |
47 | #include "sound.h" | 47 | #include "sound.h" |
48 | #include "timezone.h" | 48 | #include "timezone.h" |
49 | 49 | ||
50 | namespace KABC { | 50 | namespace KABC { |
51 | 51 | ||
52 | class Resource; | 52 | class Resource; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | @short address book entry | 55 | @short address book entry |
56 | 56 | ||
57 | This class represents an entry in the address book. | 57 | This class represents an entry in the address book. |
58 | 58 | ||
59 | The data of this class is implicitly shared. You can pass this class by value. | 59 | The data of this class is implicitly shared. You can pass this class by value. |
60 | 60 | ||
61 | If you need the name of a field for presenting it to the user you should use | 61 | If you need the name of a field for presenting it to the user you should use |
62 | the functions ending in Label(). They return a translated string which can be | 62 | the functions ending in Label(). They return a translated string which can be |
63 | used as label for the corresponding field. | 63 | used as label for the corresponding field. |
64 | 64 | ||
65 | About the name fields: | 65 | About the name fields: |
66 | 66 | ||
67 | givenName() is the first name and familyName() the last name. In some | 67 | givenName() is the first name and familyName() the last name. In some |
68 | countries the family name comes first, that's the reason for the | 68 | countries the family name comes first, that's the reason for the |
69 | naming. formattedName() is the full name with the correct formatting. | 69 | naming. formattedName() is the full name with the correct formatting. |
70 | It is used as an override, when the correct formatting can't be generated | 70 | It is used as an override, when the correct formatting can't be generated |
71 | from the other name fields automatically. | 71 | from the other name fields automatically. |
72 | 72 | ||
73 | realName() returns a fully formatted name(). It uses formattedName, if set, | 73 | realName() returns a fully formatted name(). It uses formattedName, if set, |
74 | otherwise it constucts the name from the name fields. As fallback, if | 74 | otherwise it constucts the name from the name fields. As fallback, if |
75 | nothing else is set it uses name(). | 75 | nothing else is set it uses name(). |
76 | 76 | ||
77 | name() is the NAME type of RFC2426. It can be used as internal name for the | 77 | name() is the NAME type of RFC2426. It can be used as internal name for the |
78 | data enty, but shouldn't be used for displaying the data to the user. | 78 | data enty, but shouldn't be used for displaying the data to the user. |
79 | */ | 79 | */ |
80 | class Addressee | 80 | class Addressee |
81 | { | 81 | { |
82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); | 82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); |
83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); | 83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); |
84 | 84 | ||
85 | public: | 85 | public: |
86 | typedef QValueList<Addressee> List; | 86 | typedef QValueList<Addressee> List; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Construct an empty address book entry. | 89 | Construct an empty address book entry. |
90 | */ | 90 | */ |
91 | Addressee(); | 91 | Addressee(); |
92 | ~Addressee(); | 92 | ~Addressee(); |
93 | 93 | ||
94 | Addressee( const Addressee & ); | 94 | Addressee( const Addressee & ); |
95 | Addressee &operator=( const Addressee & ); | 95 | Addressee &operator=( const Addressee & ); |
96 | 96 | ||
97 | bool operator==( const Addressee & ) const; | 97 | bool operator==( const Addressee & ) const; |
98 | bool operator!=( const Addressee & ) const; | 98 | bool operator!=( const Addressee & ) const; |
99 | // sync stuff | 99 | // sync stuff |
100 | void setTempSyncStat(int id); | 100 | void setTempSyncStat(int id); |
101 | int tempSyncStat() const; | 101 | int tempSyncStat() const; |
102 | void setIDStr( const QString & ); | 102 | void setIDStr( const QString & ); |
103 | QString IDStr() const; | 103 | const QString IDStr() const; |
104 | void setID( const QString &, const QString & ); | 104 | void setID( const QString &, const QString & ); |
105 | QString getID( const QString & ); | 105 | const QString getID( const QString & ) const; |
106 | void setCsum( const QString &, const QString & ); | 106 | void setCsum( const QString &, const QString & ); |
107 | QString getCsum( const QString & ); | 107 | const QString getCsum( const QString & ) const ; |
108 | void removeID(const QString &); | 108 | void removeID(const QString &); |
109 | void computeCsum(const QString &dev); | 109 | void computeCsum(const QString &dev); |
110 | ulong getCsum4List( const QStringList & attList); | 110 | ulong getCsum4List( const QStringList & attList); |
111 | /** | 111 | /** |
112 | Return, if the address book entry is empty. | 112 | Return, if the address book entry is empty. |
113 | */ | 113 | */ |
114 | bool isEmpty() const; | 114 | bool isEmpty() const; |
115 | void setExternalUID( const QString &id ); | 115 | void setExternalUID( const QString &id ); |
116 | QString externalUID() const; | 116 | const QString externalUID() const; |
117 | void setOriginalExternalUID( const QString &id ); | 117 | void setOriginalExternalUID( const QString &id ); |
118 | QString originalExternalUID() const; | 118 | QString originalExternalUID() const; |
119 | void mergeContact( const Addressee& ad, bool isSubSet ); | 119 | void mergeContact( const Addressee& ad, bool isSubSet ); |
120 | void simplifyEmails(); | 120 | void simplifyEmails(); |
121 | void simplifyAddresses(); | 121 | void simplifyAddresses(); |
122 | void simplifyPhoneNumbers(); | 122 | void simplifyPhoneNumbers(); |
123 | void simplifyPhoneNumberTypes(); | 123 | void simplifyPhoneNumberTypes(); |
124 | bool removeVoice(); | 124 | bool removeVoice(); |
125 | bool containsAdr(const Addressee& addr ); | 125 | bool containsAdr(const Addressee& addr ); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | Set unique identifier. | 128 | Set unique identifier. |
129 | */ | 129 | */ |
130 | void setUid( const QString &uid ); | 130 | void setUid( const QString &uid ); |
131 | /** | 131 | /** |
132 | Return unique identifier. | 132 | Return unique identifier. |
133 | */ | 133 | */ |
134 | QString uid() const; | 134 | const QString uid() const; |
135 | /** | 135 | /** |
136 | Return translated label for uid field. | 136 | Return translated label for uid field. |
137 | */ | 137 | */ |
138 | static QString uidLabel(); | 138 | static QString uidLabel(); |
139 | 139 | ||
140 | /** | 140 | /** |
141 | Set name. | 141 | Set name. |
142 | */ | 142 | */ |
143 | void setName( const QString &name ); | 143 | void setName( const QString &name ); |
144 | /** | 144 | /** |
145 | Return name. | 145 | Return name. |
146 | */ | 146 | */ |
147 | QString name() const; | 147 | QString name() const; |
148 | /** | 148 | /** |
149 | Return translated label for name field. | 149 | Return translated label for name field. |
150 | */ | 150 | */ |
151 | static QString nameLabel(); | 151 | static QString nameLabel(); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | Set formatted name. | 154 | Set formatted name. |
155 | */ | 155 | */ |
156 | void setFormattedName( const QString &formattedName ); | 156 | void setFormattedName( const QString &formattedName ); |
157 | /** | 157 | /** |
158 | Return formatted name. | 158 | Return formatted name. |
159 | */ | 159 | */ |
160 | QString formattedName() const; | 160 | QString formattedName() const; |
161 | /** | 161 | /** |
162 | Return translated label for formattedName field. | 162 | Return translated label for formattedName field. |
163 | */ | 163 | */ |
164 | static QString formattedNameLabel(); | 164 | static QString formattedNameLabel(); |
165 | 165 | ||
166 | /** | 166 | /** |
167 | Set family name. | 167 | Set family name. |
168 | */ | 168 | */ |
169 | void setFamilyName( const QString &familyName ); | 169 | void setFamilyName( const QString &familyName ); |
170 | /** | 170 | /** |
171 | Return family name. | 171 | Return family name. |
172 | */ | 172 | */ |
173 | QString familyName() const; | 173 | QString familyName() const; |
174 | /** | 174 | /** |
175 | Return translated label for familyName field. | 175 | Return translated label for familyName field. |
176 | */ | 176 | */ |
177 | static QString familyNameLabel(); | 177 | static QString familyNameLabel(); |
178 | 178 | ||
179 | /** | 179 | /** |
180 | Set given name. | 180 | Set given name. |
181 | */ | 181 | */ |
182 | void setGivenName( const QString &givenName ); | 182 | void setGivenName( const QString &givenName ); |
183 | /** | 183 | /** |
184 | Return given name. | 184 | Return given name. |
185 | */ | 185 | */ |
186 | QString givenName() const; | 186 | QString givenName() const; |
187 | /** | 187 | /** |
188 | Return translated label for givenName field. | 188 | Return translated label for givenName field. |
189 | */ | 189 | */ |
190 | static QString givenNameLabel(); | 190 | static QString givenNameLabel(); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | Set additional names. | 193 | Set additional names. |
194 | */ | 194 | */ |
195 | void setAdditionalName( const QString &additionalName ); | 195 | void setAdditionalName( const QString &additionalName ); |
196 | /** | 196 | /** |
197 | Return additional names. | 197 | Return additional names. |
198 | */ | 198 | */ |
199 | QString additionalName() const; | 199 | QString additionalName() const; |
200 | /** | 200 | /** |
201 | Return translated label for additionalName field. | 201 | Return translated label for additionalName field. |
202 | */ | 202 | */ |
203 | static QString additionalNameLabel(); | 203 | static QString additionalNameLabel(); |
204 | 204 | ||
205 | /** | 205 | /** |
206 | Set honorific prefixes. | 206 | Set honorific prefixes. |
207 | */ | 207 | */ |
208 | void setPrefix( const QString &prefix ); | 208 | void setPrefix( const QString &prefix ); |
209 | /** | 209 | /** |
210 | Return honorific prefixes. | 210 | Return honorific prefixes. |
211 | */ | 211 | */ |
212 | QString prefix() const; | 212 | QString prefix() const; |
213 | /** | 213 | /** |
214 | Return translated label for prefix field. | 214 | Return translated label for prefix field. |
215 | */ | 215 | */ |
216 | static QString prefixLabel(); | 216 | static QString prefixLabel(); |
217 | 217 | ||
218 | /** | 218 | /** |
219 | Set honorific suffixes. | 219 | Set honorific suffixes. |
220 | */ | 220 | */ |
221 | void setSuffix( const QString &suffix ); | 221 | void setSuffix( const QString &suffix ); |
222 | /** | 222 | /** |
223 | Return honorific suffixes. | 223 | Return honorific suffixes. |
224 | */ | 224 | */ |
225 | QString suffix() const; | 225 | QString suffix() const; |
226 | /** | 226 | /** |
227 | Return translated label for suffix field. | 227 | Return translated label for suffix field. |
228 | */ | 228 | */ |
229 | static QString suffixLabel(); | 229 | static QString suffixLabel(); |
230 | 230 | ||
231 | /** | 231 | /** |
232 | Set nick name. | 232 | Set nick name. |
233 | */ | 233 | */ |
234 | void setNickName( const QString &nickName ); | 234 | void setNickName( const QString &nickName ); |
235 | /** | 235 | /** |
236 | Return nick name. | 236 | Return nick name. |
237 | */ | 237 | */ |
238 | QString nickName() const; | 238 | QString nickName() const; |
239 | /** | 239 | /** |
240 | Return translated label for nickName field. | 240 | Return translated label for nickName field. |
241 | */ | 241 | */ |
242 | static QString nickNameLabel(); | 242 | static QString nickNameLabel(); |
243 | 243 | ||
244 | /** | 244 | /** |
245 | Set birthday. | 245 | Set birthday. |
246 | */ | 246 | */ |
247 | void setBirthday( const QDateTime &birthday ); | 247 | void setBirthday( const QDateTime &birthday ); |
248 | /** | 248 | /** |
249 | Return birthday. | 249 | Return birthday. |
250 | */ | 250 | */ |
251 | QDateTime birthday() const; | 251 | QDateTime birthday() const; |
252 | /** | 252 | /** |
253 | Return translated label for birthday field. | 253 | Return translated label for birthday field. |
254 | */ | 254 | */ |
255 | static QString birthdayLabel(); | 255 | static QString birthdayLabel(); |
256 | 256 | ||
257 | /** | 257 | /** |
258 | Return translated label for homeAddressStreet field. | 258 | Return translated label for homeAddressStreet field. |
259 | */ | 259 | */ |
260 | static QString homeAddressStreetLabel(); | 260 | static QString homeAddressStreetLabel(); |
261 | 261 | ||
262 | /** | 262 | /** |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d393660..42e147f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1249,258 +1249,258 @@ void KABCore::newContact() | |||
1249 | 1249 | ||
1250 | void KABCore::addEmail( QString aStr ) | 1250 | void KABCore::addEmail( QString aStr ) |
1251 | { | 1251 | { |
1252 | #ifndef KAB_EMBEDDED | 1252 | #ifndef KAB_EMBEDDED |
1253 | QString fullName, email; | 1253 | QString fullName, email; |
1254 | 1254 | ||
1255 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1255 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1256 | 1256 | ||
1257 | // Try to lookup the addressee matching the email address | 1257 | // Try to lookup the addressee matching the email address |
1258 | bool found = false; | 1258 | bool found = false; |
1259 | QStringList emailList; | 1259 | QStringList emailList; |
1260 | KABC::AddressBook::Iterator it; | 1260 | KABC::AddressBook::Iterator it; |
1261 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1261 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1262 | emailList = (*it).emails(); | 1262 | emailList = (*it).emails(); |
1263 | if ( emailList.contains( email ) > 0 ) { | 1263 | if ( emailList.contains( email ) > 0 ) { |
1264 | found = true; | 1264 | found = true; |
1265 | (*it).setNameFromString( fullName ); | 1265 | (*it).setNameFromString( fullName ); |
1266 | editContact( (*it).uid() ); | 1266 | editContact( (*it).uid() ); |
1267 | } | 1267 | } |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | if ( !found ) { | 1270 | if ( !found ) { |
1271 | KABC::Addressee addr; | 1271 | KABC::Addressee addr; |
1272 | addr.setNameFromString( fullName ); | 1272 | addr.setNameFromString( fullName ); |
1273 | addr.insertEmail( email, true ); | 1273 | addr.insertEmail( email, true ); |
1274 | 1274 | ||
1275 | mAddressBook->insertAddressee( addr ); | 1275 | mAddressBook->insertAddressee( addr ); |
1276 | mViewManager->refreshView( addr.uid() ); | 1276 | mViewManager->refreshView( addr.uid() ); |
1277 | editContact( addr.uid() ); | 1277 | editContact( addr.uid() ); |
1278 | } | 1278 | } |
1279 | #else //KAB_EMBEDDED | 1279 | #else //KAB_EMBEDDED |
1280 | qDebug("KABCore::addEmail finsih method"); | 1280 | qDebug("KABCore::addEmail finsih method"); |
1281 | #endif //KAB_EMBEDDED | 1281 | #endif //KAB_EMBEDDED |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1284 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1285 | { | 1285 | { |
1286 | mXXPortManager->importVCard( url, showPreview ); | 1286 | mXXPortManager->importVCard( url, showPreview ); |
1287 | } | 1287 | } |
1288 | void KABCore::importFromOL() | 1288 | void KABCore::importFromOL() |
1289 | { | 1289 | { |
1290 | #ifdef _WIN32_ | 1290 | #ifdef _WIN32_ |
1291 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1291 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1292 | idgl->exec(); | 1292 | idgl->exec(); |
1293 | KABC::Addressee::List list = idgl->getAddressList(); | 1293 | KABC::Addressee::List list = idgl->getAddressList(); |
1294 | if ( list.count() > 0 ) { | 1294 | if ( list.count() > 0 ) { |
1295 | KABC::Addressee::List listNew; | 1295 | KABC::Addressee::List listNew; |
1296 | KABC::Addressee::List listExisting; | 1296 | KABC::Addressee::List listExisting; |
1297 | KABC::Addressee::List::Iterator it; | 1297 | KABC::Addressee::List::Iterator it; |
1298 | KABC::AddressBook::Iterator iter; | 1298 | KABC::AddressBook::Iterator iter; |
1299 | for ( it = list.begin(); it != list.end(); ++it ) { | 1299 | for ( it = list.begin(); it != list.end(); ++it ) { |
1300 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1300 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1301 | listNew.append( (*it) ); | 1301 | listNew.append( (*it) ); |
1302 | else | 1302 | else |
1303 | listExisting.append( (*it) ); | 1303 | listExisting.append( (*it) ); |
1304 | } | 1304 | } |
1305 | if ( listExisting.count() > 0 ) | 1305 | if ( listExisting.count() > 0 ) |
1306 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1306 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1307 | if ( listNew.count() > 0 ) { | 1307 | if ( listNew.count() > 0 ) { |
1308 | pasteWithNewUid = false; | 1308 | pasteWithNewUid = false; |
1309 | pasteContacts( listNew ); | 1309 | pasteContacts( listNew ); |
1310 | pasteWithNewUid = true; | 1310 | pasteWithNewUid = true; |
1311 | } | 1311 | } |
1312 | } | 1312 | } |
1313 | delete idgl; | 1313 | delete idgl; |
1314 | #endif | 1314 | #endif |
1315 | } | 1315 | } |
1316 | 1316 | ||
1317 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1317 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1318 | { | 1318 | { |
1319 | mXXPortManager->importVCard( vCard, showPreview ); | 1319 | mXXPortManager->importVCard( vCard, showPreview ); |
1320 | } | 1320 | } |
1321 | 1321 | ||
1322 | //US added a second method without defaultparameter | 1322 | //US added a second method without defaultparameter |
1323 | void KABCore::editContact2() { | 1323 | void KABCore::editContact2() { |
1324 | editContact( QString::null ); | 1324 | editContact( QString::null ); |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | void KABCore::editContact( const QString &uid ) | 1327 | void KABCore::editContact( const QString &uid ) |
1328 | { | 1328 | { |
1329 | 1329 | ||
1330 | if ( mExtensionManager->isQuickEditVisible() ) | 1330 | if ( mExtensionManager->isQuickEditVisible() ) |
1331 | return; | 1331 | return; |
1332 | 1332 | ||
1333 | // First, locate the contact entry | 1333 | // First, locate the contact entry |
1334 | QString localUID = uid; | 1334 | QString localUID = uid; |
1335 | if ( localUID.isNull() ) { | 1335 | if ( localUID.isNull() ) { |
1336 | QStringList uidList = mViewManager->selectedUids(); | 1336 | QStringList uidList = mViewManager->selectedUids(); |
1337 | if ( uidList.count() > 0 ) | 1337 | if ( uidList.count() > 0 ) |
1338 | localUID = *( uidList.at( 0 ) ); | 1338 | localUID = *( uidList.at( 0 ) ); |
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1341 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1342 | if ( !addr.isEmpty() ) { | 1342 | if ( !addr.isEmpty() ) { |
1343 | mEditorDialog->setAddressee( addr ); | 1343 | mEditorDialog->setAddressee( addr ); |
1344 | KApplication::execDialog ( mEditorDialog ); | 1344 | KApplication::execDialog ( mEditorDialog ); |
1345 | } | 1345 | } |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | /** | 1348 | /** |
1349 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1349 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1350 | the method will try to find a selected addressee in the view. | 1350 | the method will try to find a selected addressee in the view. |
1351 | */ | 1351 | */ |
1352 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1352 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1353 | { | 1353 | { |
1354 | if ( mMultipleViewsAtOnce ) | 1354 | if ( mMultipleViewsAtOnce ) |
1355 | { | 1355 | { |
1356 | editContact( uid ); | 1356 | editContact( uid ); |
1357 | } | 1357 | } |
1358 | else | 1358 | else |
1359 | { | 1359 | { |
1360 | setDetailsVisible( true ); | 1360 | setDetailsVisible( true ); |
1361 | mActionDetails->setChecked(true); | 1361 | mActionDetails->setChecked(true); |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | void KABCore::save() | 1366 | void KABCore::save() |
1367 | { | 1367 | { |
1368 | if (syncManager->blockSave()) | 1368 | if (syncManager->blockSave()) |
1369 | return; | 1369 | return; |
1370 | if ( !mModified ) | 1370 | if ( !mModified ) |
1371 | return; | 1371 | return; |
1372 | 1372 | ||
1373 | syncManager->setBlockSave(true); | 1373 | syncManager->setBlockSave(true); |
1374 | QString text = i18n( "There was an error while attempting to save\n the " | 1374 | QString text = i18n( "There was an error while attempting to save\n the " |
1375 | "address book. Please check that some \nother application is " | 1375 | "address book. Please check that some \nother application is " |
1376 | "not using it. " ); | 1376 | "not using it. " ); |
1377 | message(i18n("Saving ... please wait! ")); | 1377 | message(i18n("Saving ... please wait! "), false); |
1378 | qApp->processEvents(); | 1378 | //qApp->processEvents(); |
1379 | #ifndef KAB_EMBEDDED | 1379 | #ifndef KAB_EMBEDDED |
1380 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1380 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1381 | if ( !b || !b->save() ) { | 1381 | if ( !b || !b->save() ) { |
1382 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1382 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1383 | } | 1383 | } |
1384 | #else //KAB_EMBEDDED | 1384 | #else //KAB_EMBEDDED |
1385 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1385 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1386 | if ( !b || !b->save() ) { | 1386 | if ( !b || !b->save() ) { |
1387 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1387 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1388 | } | 1388 | } |
1389 | #endif //KAB_EMBEDDED | 1389 | #endif //KAB_EMBEDDED |
1390 | 1390 | ||
1391 | message(i18n("Addressbook saved!")); | 1391 | message(i18n("Addressbook saved!")); |
1392 | setModified( false ); | 1392 | setModified( false ); |
1393 | syncManager->setBlockSave(false); | 1393 | syncManager->setBlockSave(false); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | 1396 | ||
1397 | void KABCore::undo() | 1397 | void KABCore::undo() |
1398 | { | 1398 | { |
1399 | UndoStack::instance()->undo(); | 1399 | UndoStack::instance()->undo(); |
1400 | 1400 | ||
1401 | // Refresh the view | 1401 | // Refresh the view |
1402 | mViewManager->refreshView(); | 1402 | mViewManager->refreshView(); |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | void KABCore::redo() | 1405 | void KABCore::redo() |
1406 | { | 1406 | { |
1407 | RedoStack::instance()->redo(); | 1407 | RedoStack::instance()->redo(); |
1408 | 1408 | ||
1409 | // Refresh the view | 1409 | // Refresh the view |
1410 | mViewManager->refreshView(); | 1410 | mViewManager->refreshView(); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1413 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1414 | { | 1414 | { |
1415 | if (mMultipleViewsAtOnce) | 1415 | if (mMultipleViewsAtOnce) |
1416 | { | 1416 | { |
1417 | if ( visible ) | 1417 | if ( visible ) |
1418 | mJumpButtonBar->show(); | 1418 | mJumpButtonBar->show(); |
1419 | else | 1419 | else |
1420 | mJumpButtonBar->hide(); | 1420 | mJumpButtonBar->hide(); |
1421 | } | 1421 | } |
1422 | else | 1422 | else |
1423 | { | 1423 | { |
1424 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1424 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1425 | if (mViewManager->isVisible()) | 1425 | if (mViewManager->isVisible()) |
1426 | { | 1426 | { |
1427 | if ( visible ) | 1427 | if ( visible ) |
1428 | mJumpButtonBar->show(); | 1428 | mJumpButtonBar->show(); |
1429 | else | 1429 | else |
1430 | mJumpButtonBar->hide(); | 1430 | mJumpButtonBar->hide(); |
1431 | } | 1431 | } |
1432 | else | 1432 | else |
1433 | { | 1433 | { |
1434 | mJumpButtonBar->hide(); | 1434 | mJumpButtonBar->hide(); |
1435 | } | 1435 | } |
1436 | } | 1436 | } |
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | 1439 | ||
1440 | void KABCore::setDetailsToState() | 1440 | void KABCore::setDetailsToState() |
1441 | { | 1441 | { |
1442 | setDetailsVisible( mActionDetails->isChecked() ); | 1442 | setDetailsVisible( mActionDetails->isChecked() ); |
1443 | } | 1443 | } |
1444 | void KABCore::setDetailsToggle() | 1444 | void KABCore::setDetailsToggle() |
1445 | { | 1445 | { |
1446 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1446 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1447 | setDetailsToState(); | 1447 | setDetailsToState(); |
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | 1450 | ||
1451 | 1451 | ||
1452 | void KABCore::setDetailsVisible( bool visible ) | 1452 | void KABCore::setDetailsVisible( bool visible ) |
1453 | { | 1453 | { |
1454 | if (visible && mDetails->isHidden()) | 1454 | if (visible && mDetails->isHidden()) |
1455 | { | 1455 | { |
1456 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1456 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1457 | if ( addrList.count() > 0 ) | 1457 | if ( addrList.count() > 0 ) |
1458 | mDetails->setAddressee( addrList[ 0 ] ); | 1458 | mDetails->setAddressee( addrList[ 0 ] ); |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1461 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1462 | // the listview and the detailview. We do that by changing the splitbar size. | 1462 | // the listview and the detailview. We do that by changing the splitbar size. |
1463 | if (mMultipleViewsAtOnce) | 1463 | if (mMultipleViewsAtOnce) |
1464 | { | 1464 | { |
1465 | if ( visible ) | 1465 | if ( visible ) |
1466 | mDetails->show(); | 1466 | mDetails->show(); |
1467 | else | 1467 | else |
1468 | mDetails->hide(); | 1468 | mDetails->hide(); |
1469 | } | 1469 | } |
1470 | else | 1470 | else |
1471 | { | 1471 | { |
1472 | if ( visible ) { | 1472 | if ( visible ) { |
1473 | mViewManager->hide(); | 1473 | mViewManager->hide(); |
1474 | mDetails->show(); | 1474 | mDetails->show(); |
1475 | mIncSearchWidget->setFocus(); | 1475 | mIncSearchWidget->setFocus(); |
1476 | } | 1476 | } |
1477 | else { | 1477 | else { |
1478 | mViewManager->show(); | 1478 | mViewManager->show(); |
1479 | mDetails->hide(); | 1479 | mDetails->hide(); |
1480 | mViewManager->setFocusAV(); | 1480 | mViewManager->setFocusAV(); |
1481 | } | 1481 | } |
1482 | setJumpButtonBarVisible( !visible ); | 1482 | setJumpButtonBarVisible( !visible ); |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | void KABCore::extensionChanged( int id ) | 1487 | void KABCore::extensionChanged( int id ) |
1488 | { | 1488 | { |
1489 | //change the details view only for non desktop systems | 1489 | //change the details view only for non desktop systems |
1490 | #ifndef DESKTOP_VERSION | 1490 | #ifndef DESKTOP_VERSION |
1491 | 1491 | ||
1492 | if (id == 0) | 1492 | if (id == 0) |
1493 | { | 1493 | { |
1494 | //the user disabled the extension. | 1494 | //the user disabled the extension. |
1495 | 1495 | ||
1496 | if (mMultipleViewsAtOnce) | 1496 | if (mMultipleViewsAtOnce) |
1497 | { // enable detailsview again | 1497 | { // enable detailsview again |
1498 | setDetailsVisible( true ); | 1498 | setDetailsVisible( true ); |
1499 | mActionDetails->setChecked( true ); | 1499 | mActionDetails->setChecked( true ); |
1500 | } | 1500 | } |
1501 | else | 1501 | else |
1502 | { //go back to the listview | 1502 | { //go back to the listview |
1503 | setDetailsVisible( false ); | 1503 | setDetailsVisible( false ); |
1504 | mActionDetails->setChecked( false ); | 1504 | mActionDetails->setChecked( false ); |
1505 | mActionDetails->setEnabled(true); | 1505 | mActionDetails->setEnabled(true); |
1506 | } | 1506 | } |
@@ -2172,351 +2172,361 @@ void KABCore::addActionsManually() | |||
2172 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2172 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2173 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2173 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2174 | #endif | 2174 | #endif |
2175 | fileMenu->insertSeparator(); | 2175 | fileMenu->insertSeparator(); |
2176 | mActionQuit->plug( fileMenu ); | 2176 | mActionQuit->plug( fileMenu ); |
2177 | #ifdef _WIN32_ | 2177 | #ifdef _WIN32_ |
2178 | mActionImportOL->plug( ImportMenu ); | 2178 | mActionImportOL->plug( ImportMenu ); |
2179 | #endif | 2179 | #endif |
2180 | // edit menu | 2180 | // edit menu |
2181 | mActionUndo->plug( editMenu ); | 2181 | mActionUndo->plug( editMenu ); |
2182 | mActionRedo->plug( editMenu ); | 2182 | mActionRedo->plug( editMenu ); |
2183 | editMenu->insertSeparator(); | 2183 | editMenu->insertSeparator(); |
2184 | mActionCut->plug( editMenu ); | 2184 | mActionCut->plug( editMenu ); |
2185 | mActionCopy->plug( editMenu ); | 2185 | mActionCopy->plug( editMenu ); |
2186 | mActionPaste->plug( editMenu ); | 2186 | mActionPaste->plug( editMenu ); |
2187 | mActionDelete->plug( editMenu ); | 2187 | mActionDelete->plug( editMenu ); |
2188 | editMenu->insertSeparator(); | 2188 | editMenu->insertSeparator(); |
2189 | mActionSelectAll->plug( editMenu ); | 2189 | mActionSelectAll->plug( editMenu ); |
2190 | 2190 | ||
2191 | mActionSetFormattedName->plug( changeMenu ); | 2191 | mActionSetFormattedName->plug( changeMenu ); |
2192 | mActionRemoveVoice->plug( changeMenu ); | 2192 | mActionRemoveVoice->plug( changeMenu ); |
2193 | // settings menu | 2193 | // settings menu |
2194 | //US special menuentry to configure the addressbook resources. On KDE | 2194 | //US special menuentry to configure the addressbook resources. On KDE |
2195 | // you do that through the control center !!! | 2195 | // you do that through the control center !!! |
2196 | mActionConfigResources->plug( settingsMenu ); | 2196 | mActionConfigResources->plug( settingsMenu ); |
2197 | settingsMenu->insertSeparator(); | 2197 | settingsMenu->insertSeparator(); |
2198 | 2198 | ||
2199 | mActionConfigKAddressbook->plug( settingsMenu ); | 2199 | mActionConfigKAddressbook->plug( settingsMenu ); |
2200 | 2200 | ||
2201 | if ( mIsPart ) { | 2201 | if ( mIsPart ) { |
2202 | //US not implemented yet | 2202 | //US not implemented yet |
2203 | //mActionConfigShortcuts->plug( settingsMenu ); | 2203 | //mActionConfigShortcuts->plug( settingsMenu ); |
2204 | //mActionConfigureToolbars->plug( settingsMenu ); | 2204 | //mActionConfigureToolbars->plug( settingsMenu ); |
2205 | 2205 | ||
2206 | } else { | 2206 | } else { |
2207 | //US not implemented yet | 2207 | //US not implemented yet |
2208 | //mActionKeyBindings->plug( settingsMenu ); | 2208 | //mActionKeyBindings->plug( settingsMenu ); |
2209 | } | 2209 | } |
2210 | 2210 | ||
2211 | settingsMenu->insertSeparator(); | 2211 | settingsMenu->insertSeparator(); |
2212 | 2212 | ||
2213 | mActionJumpBar->plug( settingsMenu ); | 2213 | mActionJumpBar->plug( settingsMenu ); |
2214 | mActionDetails->plug( settingsMenu ); | 2214 | mActionDetails->plug( settingsMenu ); |
2215 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2215 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2216 | mActionDetails->plug( tb ); | 2216 | mActionDetails->plug( tb ); |
2217 | settingsMenu->insertSeparator(); | 2217 | settingsMenu->insertSeparator(); |
2218 | #ifndef DESKTOP_VERSION | 2218 | #ifndef DESKTOP_VERSION |
2219 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2219 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2220 | #endif | 2220 | #endif |
2221 | settingsMenu->insertSeparator(); | 2221 | settingsMenu->insertSeparator(); |
2222 | 2222 | ||
2223 | mActionWhoAmI->plug( settingsMenu ); | 2223 | mActionWhoAmI->plug( settingsMenu ); |
2224 | mActionEditCategories->plug( settingsMenu ); | 2224 | mActionEditCategories->plug( settingsMenu ); |
2225 | mActionEditCategories->plug( changeMenu ); | 2225 | mActionEditCategories->plug( changeMenu ); |
2226 | mActionCategories->plug( changeMenu ); | 2226 | mActionCategories->plug( changeMenu ); |
2227 | mActionManageCategories->plug( changeMenu ); | 2227 | mActionManageCategories->plug( changeMenu ); |
2228 | 2228 | ||
2229 | mActionCategories->plug( settingsMenu ); | 2229 | mActionCategories->plug( settingsMenu ); |
2230 | mActionManageCategories->plug( settingsMenu ); | 2230 | mActionManageCategories->plug( settingsMenu ); |
2231 | 2231 | ||
2232 | 2232 | ||
2233 | mActionWN->plug( helpMenu ); | 2233 | mActionWN->plug( helpMenu ); |
2234 | mActionSyncHowto->plug( helpMenu ); | 2234 | mActionSyncHowto->plug( helpMenu ); |
2235 | mActionKdeSyncHowto->plug( helpMenu ); | 2235 | mActionKdeSyncHowto->plug( helpMenu ); |
2236 | mActionMultiSyncHowto->plug( helpMenu ); | 2236 | mActionMultiSyncHowto->plug( helpMenu ); |
2237 | mActionFaq->plug( helpMenu ); | 2237 | mActionFaq->plug( helpMenu ); |
2238 | mActionLicence->plug( helpMenu ); | 2238 | mActionLicence->plug( helpMenu ); |
2239 | mActionAboutKAddressbook->plug( helpMenu ); | 2239 | mActionAboutKAddressbook->plug( helpMenu ); |
2240 | 2240 | ||
2241 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2241 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2242 | 2242 | ||
2243 | mActionSave->plug( tb ); | 2243 | mActionSave->plug( tb ); |
2244 | mViewManager->getFilterAction()->plug ( tb); | 2244 | mViewManager->getFilterAction()->plug ( tb); |
2245 | //LR hide filteraction on started in 480x640 | 2245 | //LR hide filteraction on started in 480x640 |
2246 | if (QApplication::desktop()->width() == 480 ) { | 2246 | if (QApplication::desktop()->width() == 480 ) { |
2247 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2247 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2248 | } | 2248 | } |
2249 | mActionUndo->plug( tb ); | 2249 | mActionUndo->plug( tb ); |
2250 | mActionDelete->plug( tb ); | 2250 | mActionDelete->plug( tb ); |
2251 | mActionRedo->plug( tb ); | 2251 | mActionRedo->plug( tb ); |
2252 | } else { | 2252 | } else { |
2253 | mActionSave->plug( tb ); | 2253 | mActionSave->plug( tb ); |
2254 | tb->enableMoving(false); | 2254 | tb->enableMoving(false); |
2255 | } | 2255 | } |
2256 | //mActionQuit->plug ( tb ); | 2256 | //mActionQuit->plug ( tb ); |
2257 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2257 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2258 | 2258 | ||
2259 | //US link the searchwidget first to this. | 2259 | //US link the searchwidget first to this. |
2260 | // The real linkage to the toolbar happens later. | 2260 | // The real linkage to the toolbar happens later. |
2261 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2261 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2262 | //US tb->insertItem( mIncSearchWidget ); | 2262 | //US tb->insertItem( mIncSearchWidget ); |
2263 | /*US | 2263 | /*US |
2264 | mIncSearchWidget = new IncSearchWidget( tb ); | 2264 | mIncSearchWidget = new IncSearchWidget( tb ); |
2265 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2265 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2266 | SLOT( incrementalSearch( const QString& ) ) ); | 2266 | SLOT( incrementalSearch( const QString& ) ) ); |
2267 | 2267 | ||
2268 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2268 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2269 | 2269 | ||
2270 | //US topLayout->addWidget( mJumpButtonBar ); | 2270 | //US topLayout->addWidget( mJumpButtonBar ); |
2271 | this->layout()->add( mJumpButtonBar ); | 2271 | this->layout()->add( mJumpButtonBar ); |
2272 | */ | 2272 | */ |
2273 | 2273 | ||
2274 | #endif //KAB_EMBEDDED | 2274 | #endif //KAB_EMBEDDED |
2275 | 2275 | ||
2276 | mActionExport2phone->plug( ExportMenu ); | 2276 | mActionExport2phone->plug( ExportMenu ); |
2277 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2277 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2278 | syncManager->fillSyncMenu(); | 2278 | syncManager->fillSyncMenu(); |
2279 | 2279 | ||
2280 | } | 2280 | } |
2281 | void KABCore::showLicence() | 2281 | void KABCore::showLicence() |
2282 | { | 2282 | { |
2283 | KApplication::showLicence(); | 2283 | KApplication::showLicence(); |
2284 | } | 2284 | } |
2285 | 2285 | ||
2286 | void KABCore::manageCategories( ) | 2286 | void KABCore::manageCategories( ) |
2287 | { | 2287 | { |
2288 | KABCatPrefs* cp = new KABCatPrefs(); | 2288 | KABCatPrefs* cp = new KABCatPrefs(); |
2289 | cp->show(); | 2289 | cp->show(); |
2290 | int w =cp->sizeHint().width() ; | 2290 | int w =cp->sizeHint().width() ; |
2291 | int h = cp->sizeHint().height() ; | 2291 | int h = cp->sizeHint().height() ; |
2292 | int dw = QApplication::desktop()->width(); | 2292 | int dw = QApplication::desktop()->width(); |
2293 | int dh = QApplication::desktop()->height(); | 2293 | int dh = QApplication::desktop()->height(); |
2294 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2294 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2295 | if ( !cp->exec() ) { | 2295 | if ( !cp->exec() ) { |
2296 | delete cp; | 2296 | delete cp; |
2297 | return; | 2297 | return; |
2298 | } | 2298 | } |
2299 | int count = 0; | 2299 | int count = 0; |
2300 | int cc = 0; | ||
2300 | message( i18n("Please wait, processing categories...")); | 2301 | message( i18n("Please wait, processing categories...")); |
2301 | if ( cp->addCat() ) { | 2302 | if ( cp->addCat() ) { |
2302 | KABC::AddressBook::Iterator it; | 2303 | KABC::AddressBook::Iterator it; |
2303 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2304 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2304 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2305 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2306 | ++cc; | ||
2307 | if ( cc %10 == 0) | ||
2308 | message(i18n("Processing contact #%1").arg(cc)); | ||
2305 | QStringList catIncList = (*it).categories(); | 2309 | QStringList catIncList = (*it).categories(); |
2306 | int i; | 2310 | int i; |
2307 | for( i = 0; i< catIncList.count(); ++i ) { | 2311 | for( i = 0; i< catIncList.count(); ++i ) { |
2308 | if ( !catList.contains (catIncList[i])) { | 2312 | if ( !catList.contains (catIncList[i])) { |
2309 | catList.append( catIncList[i] ); | 2313 | catList.append( catIncList[i] ); |
2310 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2314 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2311 | ++count; | 2315 | ++count; |
2312 | } | 2316 | } |
2313 | } | 2317 | } |
2314 | } | 2318 | } |
2315 | catList.sort(); | 2319 | catList.sort(); |
2316 | KABPrefs::instance()->mCustomCategories = catList; | 2320 | KABPrefs::instance()->mCustomCategories = catList; |
2317 | KABPrefs::instance()->writeConfig(); | 2321 | KABPrefs::instance()->writeConfig(); |
2318 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2322 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2319 | } else { | 2323 | } else { |
2320 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2324 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2321 | QStringList catIncList; | 2325 | QStringList catIncList; |
2322 | QStringList newCatList; | 2326 | QStringList newCatList; |
2323 | KABC::AddressBook::Iterator it; | 2327 | KABC::AddressBook::Iterator it; |
2324 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2328 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2329 | ++cc; | ||
2330 | if ( cc %10 == 0) | ||
2331 | message(i18n("Processing contact #%1").arg(cc)); | ||
2325 | QStringList catIncList = (*it).categories(); | 2332 | QStringList catIncList = (*it).categories(); |
2326 | int i; | 2333 | int i; |
2327 | if ( catIncList.count() ) { | 2334 | if ( catIncList.count() ) { |
2328 | newCatList.clear(); | 2335 | newCatList.clear(); |
2329 | for( i = 0; i< catIncList.count(); ++i ) { | 2336 | for( i = 0; i< catIncList.count(); ++i ) { |
2330 | if ( catList.contains (catIncList[i])) { | 2337 | if ( catList.contains (catIncList[i])) { |
2331 | newCatList.append( catIncList[i] ); | 2338 | newCatList.append( catIncList[i] ); |
2332 | } | 2339 | } |
2333 | } | 2340 | } |
2334 | newCatList.sort(); | 2341 | newCatList.sort(); |
2335 | (*it).setCategories( newCatList ); | 2342 | (*it).setCategories( newCatList ); |
2336 | mAddressBook->insertAddressee( (*it) ); | 2343 | mAddressBook->insertAddressee( (*it) ); |
2337 | } | 2344 | } |
2338 | } | 2345 | } |
2339 | setModified( true ); | 2346 | setModified( true ); |
2340 | mViewManager->refreshView(); | 2347 | mViewManager->refreshView(); |
2341 | message( i18n("Removing categories done!")); | 2348 | message( i18n("Removing categories done!")); |
2342 | } | 2349 | } |
2343 | delete cp; | 2350 | delete cp; |
2344 | } | 2351 | } |
2345 | void KABCore::removeVoice() | 2352 | void KABCore::removeVoice() |
2346 | { | 2353 | { |
2347 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2354 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2348 | return; | 2355 | return; |
2349 | KABC::Addressee::List list; | 2356 | KABC::Addressee::List list; |
2350 | XXPortSelectDialog dlg( this, false, this ); | 2357 | XXPortSelectDialog dlg( this, false, this ); |
2351 | if ( dlg.exec() ) | 2358 | if ( dlg.exec() ) |
2352 | list = dlg.contacts(); | 2359 | list = dlg.contacts(); |
2353 | else | 2360 | else |
2354 | return; | 2361 | return; |
2355 | KABC::Addressee::List::Iterator it; | 2362 | KABC::Addressee::List::Iterator it; |
2356 | for ( it = list.begin(); it != list.end(); ++it ) { | 2363 | for ( it = list.begin(); it != list.end(); ++it ) { |
2357 | if ( (*it).removeVoice() ) | 2364 | if ( (*it).removeVoice() ) |
2358 | addrModified((*it), false ); | 2365 | addrModified((*it), false ); |
2359 | } | 2366 | } |
2360 | } | 2367 | } |
2361 | 2368 | ||
2362 | void KABCore::setFormattedName() | 2369 | void KABCore::setFormattedName() |
2363 | { | 2370 | { |
2364 | KABFormatPrefs setpref; | 2371 | KABFormatPrefs setpref; |
2365 | if ( !setpref.exec() ) { | 2372 | if ( !setpref.exec() ) { |
2366 | return; | 2373 | return; |
2367 | } | 2374 | } |
2368 | XXPortSelectDialog dlg( this, false, this ); | 2375 | XXPortSelectDialog dlg( this, false, this ); |
2369 | if ( !dlg.exec() ) | 2376 | if ( !dlg.exec() ) |
2370 | return; | 2377 | return; |
2371 | mAddressBook->setUntagged(); | 2378 | mAddressBook->setUntagged(); |
2372 | dlg.tagSelected(); | 2379 | dlg.tagSelected(); |
2373 | int count = 0; | 2380 | int count = 0; |
2374 | KABC::AddressBook::Iterator it; | 2381 | KABC::AddressBook::Iterator it; |
2375 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2382 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2376 | if ( (*it).tagged() ) { | 2383 | if ( (*it).tagged() ) { |
2377 | message(i18n("Changing contact #%1").arg( ++count ) ); | 2384 | ++count; |
2385 | if ( count %10 == 0 ) | ||
2386 | message(i18n("Changing contact #%1").arg( count ) ); | ||
2378 | qApp->processEvents(); | 2387 | qApp->processEvents(); |
2379 | QString fName; | 2388 | QString fName; |
2380 | if ( setpref.simple->isChecked() ) | 2389 | if ( setpref.simple->isChecked() ) |
2381 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2390 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2382 | else if ( setpref.full->isChecked() ) | 2391 | else if ( setpref.full->isChecked() ) |
2383 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2392 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2384 | else if ( setpref.reverse->isChecked() ) | 2393 | else if ( setpref.reverse->isChecked() ) |
2385 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2394 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2386 | else | 2395 | else |
2387 | fName = (*it).organization(); | 2396 | fName = (*it).organization(); |
2388 | if ( setpref.setCompany->isChecked() ) | 2397 | if ( setpref.setCompany->isChecked() ) |
2389 | if ( fName.isEmpty() || fName =="," ) | 2398 | if ( fName.isEmpty() || fName =="," ) |
2390 | fName = (*it).organization(); | 2399 | fName = (*it).organization(); |
2391 | (*it).setFormattedName( fName ); | 2400 | (*it).setFormattedName( fName ); |
2392 | } | 2401 | } |
2393 | } | 2402 | } |
2394 | message(i18n("Refreshing view...") ); | 2403 | message(i18n("Refreshing view...") ); |
2404 | qApp->processEvents(); | ||
2395 | mViewManager->refreshView( "" ); | 2405 | mViewManager->refreshView( "" ); |
2396 | Addressee add; | 2406 | Addressee add; |
2397 | mDetails->setAddressee( add ); | 2407 | mDetails->setAddressee( add ); |
2398 | message(i18n("Setting formatted name completed!") ); | 2408 | message(i18n("Setting formatted name completed!") ); |
2399 | } | 2409 | } |
2400 | 2410 | ||
2401 | void KABCore::clipboardDataChanged() | 2411 | void KABCore::clipboardDataChanged() |
2402 | { | 2412 | { |
2403 | 2413 | ||
2404 | if ( mReadWrite ) | 2414 | if ( mReadWrite ) |
2405 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2415 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2406 | 2416 | ||
2407 | } | 2417 | } |
2408 | 2418 | ||
2409 | void KABCore::updateActionMenu() | 2419 | void KABCore::updateActionMenu() |
2410 | { | 2420 | { |
2411 | UndoStack *undo = UndoStack::instance(); | 2421 | UndoStack *undo = UndoStack::instance(); |
2412 | RedoStack *redo = RedoStack::instance(); | 2422 | RedoStack *redo = RedoStack::instance(); |
2413 | 2423 | ||
2414 | if ( undo->isEmpty() ) | 2424 | if ( undo->isEmpty() ) |
2415 | mActionUndo->setText( i18n( "Undo" ) ); | 2425 | mActionUndo->setText( i18n( "Undo" ) ); |
2416 | else | 2426 | else |
2417 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2427 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2418 | 2428 | ||
2419 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2429 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2420 | 2430 | ||
2421 | if ( !redo->top() ) | 2431 | if ( !redo->top() ) |
2422 | mActionRedo->setText( i18n( "Redo" ) ); | 2432 | mActionRedo->setText( i18n( "Redo" ) ); |
2423 | else | 2433 | else |
2424 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2434 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2425 | 2435 | ||
2426 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2436 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2427 | } | 2437 | } |
2428 | 2438 | ||
2429 | void KABCore::configureKeyBindings() | 2439 | void KABCore::configureKeyBindings() |
2430 | { | 2440 | { |
2431 | #ifndef KAB_EMBEDDED | 2441 | #ifndef KAB_EMBEDDED |
2432 | KKeyDialog::configure( actionCollection(), true ); | 2442 | KKeyDialog::configure( actionCollection(), true ); |
2433 | #else //KAB_EMBEDDED | 2443 | #else //KAB_EMBEDDED |
2434 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2444 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2435 | #endif //KAB_EMBEDDED | 2445 | #endif //KAB_EMBEDDED |
2436 | } | 2446 | } |
2437 | 2447 | ||
2438 | #ifdef KAB_EMBEDDED | 2448 | #ifdef KAB_EMBEDDED |
2439 | void KABCore::configureResources() | 2449 | void KABCore::configureResources() |
2440 | { | 2450 | { |
2441 | KRES::KCMKResources dlg( this, "" , 0 ); | 2451 | KRES::KCMKResources dlg( this, "" , 0 ); |
2442 | 2452 | ||
2443 | if ( !dlg.exec() ) | 2453 | if ( !dlg.exec() ) |
2444 | return; | 2454 | return; |
2445 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2455 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2446 | } | 2456 | } |
2447 | #endif //KAB_EMBEDDED | 2457 | #endif //KAB_EMBEDDED |
2448 | 2458 | ||
2449 | 2459 | ||
2450 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2460 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2451 | * for the attendees list of an event. | 2461 | * for the attendees list of an event. |
2452 | */ | 2462 | */ |
2453 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2463 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2454 | { | 2464 | { |
2455 | QStringList nameList; | 2465 | QStringList nameList; |
2456 | QStringList emailList; | 2466 | QStringList emailList; |
2457 | QStringList uidList; | 2467 | QStringList uidList; |
2458 | 2468 | ||
2459 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2469 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2460 | uint i=0; | 2470 | uint i=0; |
2461 | for (i=0; i < list.count(); i++) | 2471 | for (i=0; i < list.count(); i++) |
2462 | { | 2472 | { |
2463 | nameList.append(list[i].realName()); | 2473 | nameList.append(list[i].realName()); |
2464 | emailList.append(list[i].preferredEmail()); | 2474 | emailList.append(list[i].preferredEmail()); |
2465 | uidList.append(list[i].uid()); | 2475 | uidList.append(list[i].uid()); |
2466 | } | 2476 | } |
2467 | 2477 | ||
2468 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2478 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2469 | 2479 | ||
2470 | } | 2480 | } |
2471 | 2481 | ||
2472 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2482 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2473 | * to put them into the calendar. | 2483 | * to put them into the calendar. |
2474 | */ | 2484 | */ |
2475 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2485 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2476 | { | 2486 | { |
2477 | // qDebug("KABCore::requestForBirthdayList"); | 2487 | // qDebug("KABCore::requestForBirthdayList"); |
2478 | QStringList birthdayList; | 2488 | QStringList birthdayList; |
2479 | QStringList anniversaryList; | 2489 | QStringList anniversaryList; |
2480 | QStringList realNameList; | 2490 | QStringList realNameList; |
2481 | QStringList preferredEmailList; | 2491 | QStringList preferredEmailList; |
2482 | QStringList assembledNameList; | 2492 | QStringList assembledNameList; |
2483 | QStringList uidList; | 2493 | QStringList uidList; |
2484 | 2494 | ||
2485 | KABC::AddressBook::Iterator it; | 2495 | KABC::AddressBook::Iterator it; |
2486 | 2496 | ||
2487 | int count = 0; | 2497 | int count = 0; |
2488 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2498 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2489 | ++count; | 2499 | ++count; |
2490 | } | 2500 | } |
2491 | QProgressBar bar(count,0 ); | 2501 | QProgressBar bar(count,0 ); |
2492 | int w = 300; | 2502 | int w = 300; |
2493 | if ( QApplication::desktop()->width() < 320 ) | 2503 | if ( QApplication::desktop()->width() < 320 ) |
2494 | w = 220; | 2504 | w = 220; |
2495 | int h = bar.sizeHint().height() ; | 2505 | int h = bar.sizeHint().height() ; |
2496 | int dw = QApplication::desktop()->width(); | 2506 | int dw = QApplication::desktop()->width(); |
2497 | int dh = QApplication::desktop()->height(); | 2507 | int dh = QApplication::desktop()->height(); |
2498 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2508 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2499 | bar.show(); | 2509 | bar.show(); |
2500 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2510 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2501 | qApp->processEvents(); | 2511 | qApp->processEvents(); |
2502 | 2512 | ||
2503 | QDate bday; | 2513 | QDate bday; |
2504 | QString anni; | 2514 | QString anni; |
2505 | QString formattedbday; | 2515 | QString formattedbday; |
2506 | 2516 | ||
2507 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2517 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2508 | { | 2518 | { |
2509 | if ( ! bar.isVisible() ) | 2519 | if ( ! bar.isVisible() ) |
2510 | return; | 2520 | return; |
2511 | bar.setProgress( count++ ); | 2521 | bar.setProgress( count++ ); |
2512 | qApp->processEvents(); | 2522 | qApp->processEvents(); |
2513 | bday = (*it).birthday().date(); | 2523 | bday = (*it).birthday().date(); |
2514 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2524 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2515 | 2525 | ||
2516 | if ( bday.isValid() || !anni.isEmpty()) | 2526 | if ( bday.isValid() || !anni.isEmpty()) |
2517 | { | 2527 | { |
2518 | if (bday.isValid()) | 2528 | if (bday.isValid()) |
2519 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2529 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2520 | else | 2530 | else |
2521 | formattedbday = "NOTVALID"; | 2531 | formattedbday = "NOTVALID"; |
2522 | if (anni.isEmpty()) | 2532 | if (anni.isEmpty()) |
@@ -3064,221 +3074,232 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
3064 | } | 3074 | } |
3065 | } | 3075 | } |
3066 | } | 3076 | } |
3067 | } else { | 3077 | } else { |
3068 | ++filteredOUT; | 3078 | ++filteredOUT; |
3069 | } | 3079 | } |
3070 | } | 3080 | } |
3071 | } | 3081 | } |
3072 | } | 3082 | } |
3073 | ++incCounter; | 3083 | ++incCounter; |
3074 | } | 3084 | } |
3075 | el.clear(); | 3085 | el.clear(); |
3076 | syncManager->hideProgressBar(); | 3086 | syncManager->hideProgressBar(); |
3077 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 3087 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
3078 | // get rid of micro seconds | 3088 | // get rid of micro seconds |
3079 | QTime t = mLastAddressbookSync.time(); | 3089 | QTime t = mLastAddressbookSync.time(); |
3080 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 3090 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
3081 | addresseeLSync.setRevision( mLastAddressbookSync ); | 3091 | addresseeLSync.setRevision( mLastAddressbookSync ); |
3082 | addresseeRSync.setRevision( mLastAddressbookSync ); | 3092 | addresseeRSync.setRevision( mLastAddressbookSync ); |
3083 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 3093 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
3084 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 3094 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
3085 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 3095 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
3086 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 3096 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
3087 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 3097 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
3088 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 3098 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
3089 | addresseeRSync.setNote( "" ) ; | 3099 | addresseeRSync.setNote( "" ) ; |
3090 | addresseeLSync.setNote( "" ); | 3100 | addresseeLSync.setNote( "" ); |
3091 | 3101 | ||
3092 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 3102 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
3093 | remote->insertAddressee( addresseeRSync, false ); | 3103 | remote->insertAddressee( addresseeRSync, false ); |
3094 | local->insertAddressee( addresseeLSync, false ); | 3104 | local->insertAddressee( addresseeLSync, false ); |
3095 | QString mes; | 3105 | QString mes; |
3096 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); | 3106 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); |
3097 | qDebug( mes ); | 3107 | qDebug( mes ); |
3098 | mes = i18n("Local addressbook changed!\n") +mes; | 3108 | mes = i18n("Local addressbook changed!\n") +mes; |
3099 | if ( syncManager->mShowSyncSummary ) { | 3109 | if ( syncManager->mShowSyncSummary ) { |
3100 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 3110 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
3101 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { | 3111 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { |
3102 | qDebug("cancelled "); | 3112 | qDebug("cancelled "); |
3103 | return false; | 3113 | return false; |
3104 | } | 3114 | } |
3105 | } | 3115 | } |
3106 | return syncOK; | 3116 | return syncOK; |
3107 | } | 3117 | } |
3108 | 3118 | ||
3109 | 3119 | ||
3110 | //this is a overwritten callbackmethods from the syncinterface | 3120 | //this is a overwritten callbackmethods from the syncinterface |
3111 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3121 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
3112 | { | 3122 | { |
3113 | 3123 | ||
3114 | //pending prepare addresseeview for output | 3124 | //pending prepare addresseeview for output |
3115 | //pending detect, if remote file has REV field. if not switch to external sync | 3125 | //pending detect, if remote file has REV field. if not switch to external sync |
3116 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3126 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3117 | if ( manager != syncManager ) | 3127 | if ( manager != syncManager ) |
3118 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); | 3128 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); |
3119 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3129 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3120 | 3130 | ||
3121 | AddressBook abLocal(filename,"syncContact"); | 3131 | AddressBook abLocal(filename,"syncContact"); |
3122 | bool syncOK = false; | 3132 | bool syncOK = false; |
3123 | if ( abLocal.load() ) { | 3133 | if ( abLocal.load() ) { |
3124 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); | 3134 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); |
3125 | bool external = false; | 3135 | bool external = false; |
3126 | bool isXML = false; | 3136 | bool isXML = false; |
3127 | if ( filename.right(4) == ".xml") { | 3137 | if ( filename.right(4) == ".xml") { |
3128 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3138 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3129 | isXML = true; | 3139 | isXML = true; |
3130 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3140 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3131 | } else { | 3141 | } else { |
3132 | external = !manager->mIsKapiFile; | 3142 | external = !manager->mIsKapiFile; |
3133 | if ( external ) { | 3143 | if ( external ) { |
3134 | qDebug("Setting vcf mode to external "); | 3144 | qDebug("Setting vcf mode to external "); |
3135 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3145 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3136 | AddressBook::Iterator it; | 3146 | AddressBook::Iterator it; |
3137 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3147 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3138 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3148 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3139 | (*it).computeCsum( mCurrentSyncDevice ); | 3149 | (*it).computeCsum( mCurrentSyncDevice ); |
3140 | } | 3150 | } |
3141 | } | 3151 | } |
3142 | } | 3152 | } |
3143 | //AddressBook::Iterator it; | 3153 | //AddressBook::Iterator it; |
3144 | //QStringList vcards; | 3154 | //QStringList vcards; |
3145 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3155 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3146 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3156 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3147 | //} | 3157 | //} |
3148 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3158 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3149 | if ( syncOK ) { | 3159 | if ( syncOK ) { |
3150 | if ( syncManager->mWriteBackFile ) | 3160 | if ( syncManager->mWriteBackFile ) |
3151 | { | 3161 | { |
3152 | if ( external ) | 3162 | if ( external ) |
3153 | abLocal.removeSyncAddressees( !isXML); | 3163 | abLocal.removeSyncAddressees( !isXML); |
3154 | qDebug("Saving remote AB "); | 3164 | qDebug("Saving remote AB "); |
3155 | if ( ! abLocal.saveAB()) | 3165 | if ( ! abLocal.saveAB()) |
3156 | qDebug("Error writing back AB to file "); | 3166 | qDebug("Error writing back AB to file "); |
3157 | if ( external ) { | 3167 | if ( external ) { |
3158 | // afterwrite processing | 3168 | // afterwrite processing |
3159 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 3169 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
3160 | } | 3170 | } |
3161 | } | 3171 | } |
3162 | } | 3172 | } |
3163 | setModified(); | 3173 | setModified(); |
3164 | 3174 | ||
3165 | } | 3175 | } |
3166 | abLocal.removeResources(); | 3176 | abLocal.removeResources(); |
3167 | if ( syncOK ) | 3177 | if ( syncOK ) |
3168 | mViewManager->refreshView(); | 3178 | mViewManager->refreshView(); |
3169 | return syncOK; | 3179 | return syncOK; |
3170 | 3180 | ||
3171 | } | 3181 | } |
3172 | void KABCore::removeSyncInfo( QString syncProfile) | 3182 | void KABCore::removeSyncInfo( QString syncProfile) |
3173 | { | 3183 | { |
3174 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 3184 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
3175 | mAddressBook->removeSyncInfo( syncProfile ); | 3185 | mAddressBook->removeSyncInfo( syncProfile ); |
3176 | setModified(); | 3186 | setModified(); |
3177 | } | 3187 | } |
3178 | 3188 | ||
3179 | 3189 | ||
3180 | //this is a overwritten callbackmethods from the syncinterface | 3190 | //this is a overwritten callbackmethods from the syncinterface |
3181 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 3191 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
3182 | { | 3192 | { |
3183 | if ( resource == "phone" ) | 3193 | if ( resource == "phone" ) |
3184 | return syncPhone(); | 3194 | return syncPhone(); |
3185 | disableBR( true ); | 3195 | disableBR( true ); |
3186 | if ( manager != syncManager ) | 3196 | if ( manager != syncManager ) |
3187 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); | 3197 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); |
3188 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3198 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3189 | 3199 | ||
3190 | AddressBook abLocal( resource,"syncContact"); | 3200 | AddressBook abLocal( resource,"syncContact"); |
3191 | bool syncOK = false; | 3201 | bool syncOK = false; |
3202 | message(i18n("Loading DTM address data..."), false); | ||
3192 | if ( abLocal.load() ) { | 3203 | if ( abLocal.load() ) { |
3193 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3204 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3194 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3205 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3206 | message(i18n("Sync preprocessing..."),false); | ||
3195 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 3207 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
3208 | message(i18n("Synchronizing..."),false); | ||
3196 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3209 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3197 | if ( syncOK ) { | 3210 | if ( syncOK ) { |
3198 | if ( syncManager->mWriteBackFile ) { | 3211 | if ( syncManager->mWriteBackFile ) { |
3199 | abLocal.removeSyncAddressees( false ); | 3212 | abLocal.removeSyncAddressees( false ); |
3213 | message(i18n("Saving DTM address data..."),false); | ||
3200 | abLocal.saveAB(); | 3214 | abLocal.saveAB(); |
3215 | message(i18n("Sync postprocessing..."),false); | ||
3201 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3216 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3202 | } | 3217 | } |
3203 | } else | 3218 | } else |
3204 | message( i18n("Sync cancelled or failed.") ); | 3219 | message( i18n("Sync cancelled or failed.") ); |
3205 | setModified(); | 3220 | setModified(); |
3206 | } | 3221 | } |
3207 | abLocal.removeResources(); | 3222 | abLocal.removeResources(); |
3208 | if ( syncOK ) | 3223 | if ( syncOK ) { |
3209 | mViewManager->refreshView(); | 3224 | mViewManager->refreshView(); |
3225 | message(i18n("DTM syncing finished.")); | ||
3226 | } | ||
3210 | disableBR( false ); | 3227 | disableBR( false ); |
3211 | return syncOK; | 3228 | return syncOK; |
3212 | 3229 | ||
3213 | } | 3230 | } |
3214 | void KABCore::message( QString m ) | 3231 | void KABCore::message( QString m, bool startTimer) |
3215 | { | 3232 | { |
3216 | topLevelWidget()->setCaption( m ); | 3233 | topLevelWidget()->setCaption( m ); |
3217 | mMessageTimer->start( 20000, true ); | 3234 | qApp->processEvents(); |
3235 | if ( startTimer ) | ||
3236 | mMessageTimer->start( 15000, true ); | ||
3237 | else | ||
3238 | mMessageTimer->stop(); | ||
3218 | } | 3239 | } |
3219 | bool KABCore::syncPhone() | 3240 | bool KABCore::syncPhone() |
3220 | { | 3241 | { |
3221 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3242 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3222 | QString fileName = getPhoneFile(); | 3243 | QString fileName = getPhoneFile(); |
3223 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 3244 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
3224 | message(i18n("Phone access failed!")); | 3245 | message(i18n("Phone access failed!")); |
3225 | return false; | 3246 | return false; |
3226 | } | 3247 | } |
3227 | AddressBook abLocal( fileName,"syncContact"); | 3248 | AddressBook abLocal( fileName,"syncContact"); |
3228 | bool syncOK = false; | 3249 | bool syncOK = false; |
3229 | { | 3250 | { |
3230 | abLocal.importFromFile( fileName ); | 3251 | abLocal.importFromFile( fileName ); |
3231 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3252 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3232 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3253 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3233 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3254 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3234 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3255 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3235 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3256 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3236 | if ( syncOK ) { | 3257 | if ( syncOK ) { |
3237 | if ( syncManager->mWriteBackFile ) { | 3258 | if ( syncManager->mWriteBackFile ) { |
3238 | abLocal.removeSyncAddressees( true ); | 3259 | abLocal.removeSyncAddressees( true ); |
3239 | abLocal.saveABphone( fileName ); | 3260 | abLocal.saveABphone( fileName ); |
3240 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3261 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3241 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3262 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3242 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3263 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3243 | } | 3264 | } |
3244 | } | 3265 | } |
3245 | setModified(); | 3266 | setModified(); |
3246 | } | 3267 | } |
3247 | abLocal.removeResources(); | 3268 | abLocal.removeResources(); |
3248 | if ( syncOK ) | 3269 | if ( syncOK ) |
3249 | mViewManager->refreshView(); | 3270 | mViewManager->refreshView(); |
3250 | return syncOK; | 3271 | return syncOK; |
3251 | } | 3272 | } |
3252 | void KABCore::getFile( bool success ) | 3273 | void KABCore::getFile( bool success ) |
3253 | { | 3274 | { |
3254 | if ( ! success ) { | 3275 | if ( ! success ) { |
3255 | message( i18n("Error receiving file. Nothing changed!") ); | 3276 | message( i18n("Error receiving file. Nothing changed!") ); |
3256 | return; | 3277 | return; |
3257 | } | 3278 | } |
3258 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3279 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3259 | if ( count ) | 3280 | if ( count ) |
3260 | setModified( true ); | 3281 | setModified( true ); |
3261 | message( i18n("Pi-Sync successful!") ); | 3282 | message( i18n("Pi-Sync successful!") ); |
3262 | mViewManager->refreshView(); | 3283 | mViewManager->refreshView(); |
3263 | } | 3284 | } |
3264 | void KABCore::syncFileRequest() | 3285 | void KABCore::syncFileRequest() |
3265 | { | 3286 | { |
3266 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3287 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3267 | syncManager->slotSyncMenu( 999 ); | 3288 | syncManager->slotSyncMenu( 999 ); |
3268 | } | 3289 | } |
3269 | mAddressBook->export2File( sentSyncFile() ); | 3290 | mAddressBook->export2File( sentSyncFile() ); |
3270 | } | 3291 | } |
3271 | QString KABCore::sentSyncFile() | 3292 | QString KABCore::sentSyncFile() |
3272 | { | 3293 | { |
3273 | #ifdef DESKTOP_VERSION | 3294 | #ifdef DESKTOP_VERSION |
3274 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3295 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3275 | #else | 3296 | #else |
3276 | return QString( "/tmp/copysyncab.vcf" ); | 3297 | return QString( "/tmp/copysyncab.vcf" ); |
3277 | #endif | 3298 | #endif |
3278 | } | 3299 | } |
3279 | 3300 | ||
3280 | void KABCore::setCaptionBack() | 3301 | void KABCore::setCaptionBack() |
3281 | { | 3302 | { |
3282 | mMessageTimer->stop(); | 3303 | mMessageTimer->stop(); |
3283 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 3304 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
3284 | } | 3305 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index ecfe6e9..786549a 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -375,145 +375,145 @@ class KABCore : public QWidget, public KSyncInterface | |||
375 | void configureKeyBindings(); | 375 | void configureKeyBindings(); |
376 | void removeVoice(); | 376 | void removeVoice(); |
377 | void setFormattedName(); | 377 | void setFormattedName(); |
378 | #ifdef KAB_EMBEDDED | 378 | #ifdef KAB_EMBEDDED |
379 | void configureResources(); | 379 | void configureResources(); |
380 | #endif //KAB_EMBEDDED | 380 | #endif //KAB_EMBEDDED |
381 | 381 | ||
382 | void slotEditorDestroyed( const QString &uid ); | 382 | void slotEditorDestroyed( const QString &uid ); |
383 | void configurationChanged(); | 383 | void configurationChanged(); |
384 | void addressBookChanged(); | 384 | void addressBookChanged(); |
385 | 385 | ||
386 | private: | 386 | private: |
387 | void resizeEvent(QResizeEvent* e ); | 387 | void resizeEvent(QResizeEvent* e ); |
388 | bool mBRdisabled; | 388 | bool mBRdisabled; |
389 | #ifndef DESKTOP_VERSION | 389 | #ifndef DESKTOP_VERSION |
390 | QCopChannel* infrared; | 390 | QCopChannel* infrared; |
391 | #endif | 391 | #endif |
392 | QTimer *mMessageTimer; | 392 | QTimer *mMessageTimer; |
393 | void initGUI(); | 393 | void initGUI(); |
394 | void initActions(); | 394 | void initActions(); |
395 | QString getPhoneFile(); | 395 | QString getPhoneFile(); |
396 | 396 | ||
397 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 397 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
398 | const char *name = 0 ); | 398 | const char *name = 0 ); |
399 | 399 | ||
400 | KXMLGUIClient *mGUIClient; | 400 | KXMLGUIClient *mGUIClient; |
401 | 401 | ||
402 | KABC::AddressBook *mAddressBook; | 402 | KABC::AddressBook *mAddressBook; |
403 | 403 | ||
404 | ViewManager *mViewManager; | 404 | ViewManager *mViewManager; |
405 | // QSplitter *mDetailsSplitter; | 405 | // QSplitter *mDetailsSplitter; |
406 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 406 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
407 | ViewContainer *mDetails; | 407 | ViewContainer *mDetails; |
408 | KDGanttMinimizeSplitter* mMiniSplitter; | 408 | KDGanttMinimizeSplitter* mMiniSplitter; |
409 | XXPortManager *mXXPortManager; | 409 | XXPortManager *mXXPortManager; |
410 | JumpButtonBar *mJumpButtonBar; | 410 | JumpButtonBar *mJumpButtonBar; |
411 | IncSearchWidget *mIncSearchWidget; | 411 | IncSearchWidget *mIncSearchWidget; |
412 | ExtensionManager *mExtensionManager; | 412 | ExtensionManager *mExtensionManager; |
413 | 413 | ||
414 | KCMultiDialog *mConfigureDialog; | 414 | KCMultiDialog *mConfigureDialog; |
415 | 415 | ||
416 | #ifndef KAB_EMBEDDED | 416 | #ifndef KAB_EMBEDDED |
417 | LDAPSearchDialog *mLdapSearchDialog; | 417 | LDAPSearchDialog *mLdapSearchDialog; |
418 | #endif //KAB_EMBEDDED | 418 | #endif //KAB_EMBEDDED |
419 | // QDict<AddresseeEditorDialog> mEditorDict; | 419 | // QDict<AddresseeEditorDialog> mEditorDict; |
420 | AddresseeEditorDialog *mEditorDialog; | 420 | AddresseeEditorDialog *mEditorDialog; |
421 | bool mReadWrite; | 421 | bool mReadWrite; |
422 | bool mModified; | 422 | bool mModified; |
423 | bool mIsPart; | 423 | bool mIsPart; |
424 | bool mMultipleViewsAtOnce; | 424 | bool mMultipleViewsAtOnce; |
425 | 425 | ||
426 | 426 | ||
427 | //US file menu | 427 | //US file menu |
428 | KAction *mActionMail; | 428 | KAction *mActionMail; |
429 | KAction *mActionBeam; | 429 | KAction *mActionBeam; |
430 | KToggleAction *mActionBR; | 430 | KToggleAction *mActionBR; |
431 | KAction *mActionExport2phone; | 431 | KAction *mActionExport2phone; |
432 | KAction* mActionPrint; | 432 | KAction* mActionPrint; |
433 | KAction* mActionPrintDetails; | 433 | KAction* mActionPrintDetails; |
434 | KAction* mActionNewContact; | 434 | KAction* mActionNewContact; |
435 | KAction *mActionSave; | 435 | KAction *mActionSave; |
436 | KAction *mActionEditAddressee; | 436 | KAction *mActionEditAddressee; |
437 | KAction *mActionMailVCard; | 437 | KAction *mActionMailVCard; |
438 | KAction *mActionBeamVCard; | 438 | KAction *mActionBeamVCard; |
439 | 439 | ||
440 | KAction *mActionQuit; | 440 | KAction *mActionQuit; |
441 | 441 | ||
442 | //US edit menu | 442 | //US edit menu |
443 | KAction *mActionCopy; | 443 | KAction *mActionCopy; |
444 | KAction *mActionCut; | 444 | KAction *mActionCut; |
445 | KAction *mActionPaste; | 445 | KAction *mActionPaste; |
446 | KAction *mActionSelectAll; | 446 | KAction *mActionSelectAll; |
447 | KAction *mActionUndo; | 447 | KAction *mActionUndo; |
448 | KAction *mActionRedo; | 448 | KAction *mActionRedo; |
449 | KAction *mActionDelete; | 449 | KAction *mActionDelete; |
450 | 450 | ||
451 | //US settings menu | 451 | //US settings menu |
452 | KAction *mActionConfigResources; | 452 | KAction *mActionConfigResources; |
453 | KAction *mActionConfigKAddressbook; | 453 | KAction *mActionConfigKAddressbook; |
454 | KAction *mActionConfigShortcuts; | 454 | KAction *mActionConfigShortcuts; |
455 | KAction *mActionConfigureToolbars; | 455 | KAction *mActionConfigureToolbars; |
456 | KAction *mActionKeyBindings; | 456 | KAction *mActionKeyBindings; |
457 | KToggleAction *mActionJumpBar; | 457 | KToggleAction *mActionJumpBar; |
458 | KToggleAction *mActionDetails; | 458 | KToggleAction *mActionDetails; |
459 | KAction *mActionWhoAmI; | 459 | KAction *mActionWhoAmI; |
460 | KAction *mActionCategories; | 460 | KAction *mActionCategories; |
461 | KAction *mActionEditCategories; | 461 | KAction *mActionEditCategories; |
462 | KAction *mActionManageCategories; | 462 | KAction *mActionManageCategories; |
463 | KAction *mActionAboutKAddressbook; | 463 | KAction *mActionAboutKAddressbook; |
464 | KAction *mActionLicence; | 464 | KAction *mActionLicence; |
465 | KAction *mActionFaq; | 465 | KAction *mActionFaq; |
466 | KAction *mActionWN; | 466 | KAction *mActionWN; |
467 | KAction *mActionSyncHowto; | 467 | KAction *mActionSyncHowto; |
468 | KAction *mActionKdeSyncHowto; | 468 | KAction *mActionKdeSyncHowto; |
469 | KAction *mActionMultiSyncHowto; | 469 | KAction *mActionMultiSyncHowto; |
470 | 470 | ||
471 | KAction *mActionDeleteView; | 471 | KAction *mActionDeleteView; |
472 | 472 | ||
473 | QPopupMenu *viewMenu; | 473 | QPopupMenu *viewMenu; |
474 | QPopupMenu *filterMenu; | 474 | QPopupMenu *filterMenu; |
475 | QPopupMenu *settingsMenu; | 475 | QPopupMenu *settingsMenu; |
476 | QPopupMenu *changeMenu; | 476 | QPopupMenu *changeMenu; |
477 | QPopupMenu *beamMenu; | 477 | QPopupMenu *beamMenu; |
478 | //US QAction *mActionSave; | 478 | //US QAction *mActionSave; |
479 | QPopupMenu *ImportMenu; | 479 | QPopupMenu *ImportMenu; |
480 | QPopupMenu *ExportMenu; | 480 | QPopupMenu *ExportMenu; |
481 | //LR additional methods | 481 | //LR additional methods |
482 | KAction *mActionRemoveVoice; | 482 | KAction *mActionRemoveVoice; |
483 | KAction *mActionSetFormattedName; | 483 | KAction *mActionSetFormattedName; |
484 | KAction * mActionImportOL; | 484 | KAction * mActionImportOL; |
485 | 485 | ||
486 | #ifndef KAB_EMBEDDED | 486 | #ifndef KAB_EMBEDDED |
487 | KAddressBookService *mAddressBookService; | 487 | KAddressBookService *mAddressBookService; |
488 | #endif //KAB_EMBEDDED | 488 | #endif //KAB_EMBEDDED |
489 | 489 | ||
490 | class KABCorePrivate; | 490 | class KABCorePrivate; |
491 | KABCorePrivate *d; | 491 | KABCorePrivate *d; |
492 | //US bool mBlockSaveFlag; | 492 | //US bool mBlockSaveFlag; |
493 | 493 | ||
494 | #ifdef KAB_EMBEDDED | 494 | #ifdef KAB_EMBEDDED |
495 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 495 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
496 | #endif //KAB_EMBEDDED | 496 | #endif //KAB_EMBEDDED |
497 | 497 | ||
498 | //this are the overwritten callbackmethods from the syncinterface | 498 | //this are the overwritten callbackmethods from the syncinterface |
499 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 499 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
500 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 500 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
501 | virtual void removeSyncInfo( QString syncProfile); | 501 | virtual void removeSyncInfo( QString syncProfile); |
502 | bool syncPhone(); | 502 | bool syncPhone(); |
503 | void message( QString m ); | 503 | void message( QString m , bool startTimer = true); |
504 | 504 | ||
505 | // LR ******************************* | 505 | // LR ******************************* |
506 | // sync stuff! | 506 | // sync stuff! |
507 | QString sentSyncFile(); | 507 | QString sentSyncFile(); |
508 | QPopupMenu *syncMenu; | 508 | QPopupMenu *syncMenu; |
509 | KSyncManager* syncManager; | 509 | KSyncManager* syncManager; |
510 | int mGlobalSyncMode; | 510 | int mGlobalSyncMode; |
511 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 511 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
512 | KABC::Addressee getLastSyncAddressee(); | 512 | KABC::Addressee getLastSyncAddressee(); |
513 | QDateTime mLastAddressbookSync; | 513 | QDateTime mLastAddressbookSync; |
514 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 514 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
515 | // ********************* | 515 | // ********************* |
516 | 516 | ||
517 | }; | 517 | }; |
518 | 518 | ||
519 | #endif | 519 | #endif |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 6c1f444..f488a07 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -869,266 +869,267 @@ QString KSyncManager::getPassword( ) | |||
869 | int res = dia.exec(); | 869 | int res = dia.exec(); |
870 | if ( res ) | 870 | if ( res ) |
871 | retfile = lab.text(); | 871 | retfile = lab.text(); |
872 | dia.hide(); | 872 | dia.hide(); |
873 | qApp->processEvents(); | 873 | qApp->processEvents(); |
874 | return retfile; | 874 | return retfile; |
875 | 875 | ||
876 | } | 876 | } |
877 | 877 | ||
878 | 878 | ||
879 | void KSyncManager::confSync() | 879 | void KSyncManager::confSync() |
880 | { | 880 | { |
881 | static KSyncPrefsDialog* sp = 0; | 881 | static KSyncPrefsDialog* sp = 0; |
882 | if ( ! sp ) { | 882 | if ( ! sp ) { |
883 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 883 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
884 | } | 884 | } |
885 | sp->usrReadConfig(); | 885 | sp->usrReadConfig(); |
886 | #ifndef DESKTOP_VERSION | 886 | #ifndef DESKTOP_VERSION |
887 | sp->showMaximized(); | 887 | sp->showMaximized(); |
888 | #else | 888 | #else |
889 | sp->show(); | 889 | sp->show(); |
890 | #endif | 890 | #endif |
891 | sp->exec(); | 891 | sp->exec(); |
892 | QStringList oldSyncProfileNames = mSyncProfileNames; | 892 | QStringList oldSyncProfileNames = mSyncProfileNames; |
893 | mSyncProfileNames = sp->getSyncProfileNames(); | 893 | mSyncProfileNames = sp->getSyncProfileNames(); |
894 | mLocalMachineName = sp->getLocalMachineName (); | 894 | mLocalMachineName = sp->getLocalMachineName (); |
895 | int ii; | 895 | int ii; |
896 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { | 896 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { |
897 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) | 897 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) |
898 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); | 898 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); |
899 | } | 899 | } |
900 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 900 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
901 | } | 901 | } |
902 | void KSyncManager::syncKDE() | 902 | void KSyncManager::syncKDE() |
903 | { | 903 | { |
904 | mSyncWithDesktop = true; | 904 | mSyncWithDesktop = true; |
905 | emit save(); | 905 | emit save(); |
906 | switch(mTargetApp) | 906 | switch(mTargetApp) |
907 | { | 907 | { |
908 | case (KAPI): | 908 | case (KAPI): |
909 | { | 909 | { |
910 | #ifdef DESKTOP_VERSION | 910 | #ifdef DESKTOP_VERSION |
911 | QString command = qApp->applicationDirPath () + "/kdeabdump"; | 911 | QString command = qApp->applicationDirPath () + "/kdeabdump"; |
912 | #else | 912 | #else |
913 | QString command = "kdeabdump"; | 913 | QString command = "kdeabdump"; |
914 | #endif | 914 | #endif |
915 | if ( ! QFile::exists ( command ) ) | 915 | if ( ! QFile::exists ( command ) ) |
916 | command = "kdeabdump"; | 916 | command = "kdeabdump"; |
917 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; | 917 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; |
918 | system ( command.latin1()); | 918 | system ( command.latin1()); |
919 | if ( syncWithFile( fileName,true ) ) { | 919 | if ( syncWithFile( fileName,true ) ) { |
920 | if ( mWriteBackFile ) { | 920 | if ( mWriteBackFile ) { |
921 | command += " --read"; | 921 | command += " --read"; |
922 | system ( command.latin1()); | 922 | system ( command.latin1()); |
923 | } | 923 | } |
924 | } | 924 | } |
925 | 925 | ||
926 | } | 926 | } |
927 | break; | 927 | break; |
928 | case (KOPI): | 928 | case (KOPI): |
929 | { | 929 | { |
930 | #ifdef DESKTOP_VERSION | 930 | #ifdef DESKTOP_VERSION |
931 | QString command = qApp->applicationDirPath () + "/kdecaldump"; | 931 | QString command = qApp->applicationDirPath () + "/kdecaldump"; |
932 | #else | 932 | #else |
933 | QString command = "kdecaldump"; | 933 | QString command = "kdecaldump"; |
934 | #endif | 934 | #endif |
935 | if ( ! QFile::exists ( command ) ) | 935 | if ( ! QFile::exists ( command ) ) |
936 | command = "kdecaldump"; | 936 | command = "kdecaldump"; |
937 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | 937 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; |
938 | system ( command.latin1()); | 938 | system ( command.latin1()); |
939 | if ( syncWithFile( fileName,true ) ) { | 939 | if ( syncWithFile( fileName,true ) ) { |
940 | if ( mWriteBackFile ) { | 940 | if ( mWriteBackFile ) { |
941 | command += " --read"; | 941 | command += " --read"; |
942 | system ( command.latin1()); | 942 | system ( command.latin1()); |
943 | } | 943 | } |
944 | } | 944 | } |
945 | 945 | ||
946 | } | 946 | } |
947 | break; | 947 | break; |
948 | case (PWMPI): | 948 | case (PWMPI): |
949 | 949 | ||
950 | break; | 950 | break; |
951 | default: | 951 | default: |
952 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 952 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
953 | break; | 953 | break; |
954 | 954 | ||
955 | } | 955 | } |
956 | } | 956 | } |
957 | 957 | ||
958 | void KSyncManager::syncSharp() | 958 | void KSyncManager::syncSharp() |
959 | { | 959 | { |
960 | 960 | ||
961 | if ( ! syncExternalApplication("sharp") ) | 961 | if ( ! syncExternalApplication("sharp") ) |
962 | qDebug("ERROR sync sharp "); | 962 | qDebug("ERROR sync sharp "); |
963 | } | 963 | } |
964 | 964 | ||
965 | bool KSyncManager::syncExternalApplication(QString resource) | 965 | bool KSyncManager::syncExternalApplication(QString resource) |
966 | { | 966 | { |
967 | 967 | ||
968 | emit save(); | 968 | emit save(); |
969 | 969 | ||
970 | if ( mAskForPreferences ) | 970 | if ( mAskForPreferences ) |
971 | if ( !edit_sync_options()) { | 971 | if ( !edit_sync_options()) { |
972 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 972 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
973 | return false; | 973 | return false; |
974 | } | 974 | } |
975 | 975 | ||
976 | qDebug("Sync extern %s", resource.latin1()); | 976 | qDebug("Sync extern %s", resource.latin1()); |
977 | 977 | ||
978 | bool syncOK = mImplementation->syncExternal(this, resource); | 978 | bool syncOK = mImplementation->syncExternal(this, resource); |
979 | 979 | ||
980 | return syncOK; | 980 | return syncOK; |
981 | 981 | ||
982 | } | 982 | } |
983 | 983 | ||
984 | void KSyncManager::syncPhone() | 984 | void KSyncManager::syncPhone() |
985 | { | 985 | { |
986 | 986 | ||
987 | syncExternalApplication("phone"); | 987 | syncExternalApplication("phone"); |
988 | 988 | ||
989 | } | 989 | } |
990 | 990 | ||
991 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 991 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
992 | { | 992 | { |
993 | if (!bar->isVisible()) | 993 | if (!bar->isVisible()) |
994 | { | 994 | { |
995 | bar->setCaption (caption); | 995 | bar->setCaption (caption); |
996 | bar->setTotalSteps ( total ) ; | 996 | bar->setTotalSteps ( total ) ; |
997 | |||
998 | bar->show(); | 997 | bar->show(); |
999 | } | 998 | } |
1000 | 999 | bar->raise(); | |
1001 | bar->setProgress( percentage ); | 1000 | bar->setProgress( percentage ); |
1001 | qApp->processEvents(); | ||
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | void KSyncManager::hideProgressBar() | 1004 | void KSyncManager::hideProgressBar() |
1005 | { | 1005 | { |
1006 | bar->hide(); | 1006 | bar->hide(); |
1007 | qApp->processEvents(); | ||
1007 | } | 1008 | } |
1008 | 1009 | ||
1009 | bool KSyncManager::isProgressBarCanceled() | 1010 | bool KSyncManager::isProgressBarCanceled() |
1010 | { | 1011 | { |
1011 | return !bar->isVisible(); | 1012 | return !bar->isVisible(); |
1012 | } | 1013 | } |
1013 | 1014 | ||
1014 | QString KSyncManager::syncFileName() | 1015 | QString KSyncManager::syncFileName() |
1015 | { | 1016 | { |
1016 | 1017 | ||
1017 | QString fn = "tempfile"; | 1018 | QString fn = "tempfile"; |
1018 | switch(mTargetApp) | 1019 | switch(mTargetApp) |
1019 | { | 1020 | { |
1020 | case (KAPI): | 1021 | case (KAPI): |
1021 | fn = "tempsyncab.vcf"; | 1022 | fn = "tempsyncab.vcf"; |
1022 | break; | 1023 | break; |
1023 | case (KOPI): | 1024 | case (KOPI): |
1024 | fn = "tempsynccal.ics"; | 1025 | fn = "tempsynccal.ics"; |
1025 | break; | 1026 | break; |
1026 | case (PWMPI): | 1027 | case (PWMPI): |
1027 | fn = "tempsyncpw.pwm"; | 1028 | fn = "tempsyncpw.pwm"; |
1028 | break; | 1029 | break; |
1029 | default: | 1030 | default: |
1030 | break; | 1031 | break; |
1031 | } | 1032 | } |
1032 | #ifdef _WIN32_ | 1033 | #ifdef _WIN32_ |
1033 | return locateLocal( "tmp", fn ); | 1034 | return locateLocal( "tmp", fn ); |
1034 | #else | 1035 | #else |
1035 | return (QString( "/tmp/" )+ fn ); | 1036 | return (QString( "/tmp/" )+ fn ); |
1036 | #endif | 1037 | #endif |
1037 | } | 1038 | } |
1038 | 1039 | ||
1039 | void KSyncManager::syncPi() | 1040 | void KSyncManager::syncPi() |
1040 | { | 1041 | { |
1041 | mIsKapiFile = true; | 1042 | mIsKapiFile = true; |
1042 | mPisyncFinished = false; | 1043 | mPisyncFinished = false; |
1043 | qApp->processEvents(); | 1044 | qApp->processEvents(); |
1044 | if ( mAskForPreferences ) | 1045 | if ( mAskForPreferences ) |
1045 | if ( !edit_pisync_options()) { | 1046 | if ( !edit_pisync_options()) { |
1046 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1047 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1047 | return; | 1048 | return; |
1048 | } | 1049 | } |
1049 | bool ok; | 1050 | bool ok; |
1050 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 1051 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
1051 | if ( ! ok ) { | 1052 | if ( ! ok ) { |
1052 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1053 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1053 | return; | 1054 | return; |
1054 | } | 1055 | } |
1055 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); | 1056 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); |
1056 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1057 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1057 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); | 1058 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); |
1058 | commandSocket->readFile( syncFileName() ); | 1059 | commandSocket->readFile( syncFileName() ); |
1059 | } | 1060 | } |
1060 | 1061 | ||
1061 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 1062 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
1062 | { | 1063 | { |
1063 | //enum { success, errorW, errorR, quiet }; | 1064 | //enum { success, errorW, errorR, quiet }; |
1064 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { | 1065 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { |
1065 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1066 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1066 | delete s; | 1067 | delete s; |
1067 | if ( state == KCommandSocket::errorR ) { | 1068 | if ( state == KCommandSocket::errorR ) { |
1068 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 1069 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
1069 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1070 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1070 | commandSocket->sendStop(); | 1071 | commandSocket->sendStop(); |
1071 | } | 1072 | } |
1072 | mPisyncFinished = true; | 1073 | mPisyncFinished = true; |
1073 | return; | 1074 | return; |
1074 | 1075 | ||
1075 | } else if ( state == KCommandSocket::errorW ) { | 1076 | } else if ( state == KCommandSocket::errorW ) { |
1076 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 1077 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
1077 | mPisyncFinished = true; | 1078 | mPisyncFinished = true; |
1078 | 1079 | ||
1079 | } else if ( state == KCommandSocket::successR ) { | 1080 | } else if ( state == KCommandSocket::successR ) { |
1080 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 1081 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
1081 | 1082 | ||
1082 | } else if ( state == KCommandSocket::successW ) { | 1083 | } else if ( state == KCommandSocket::successW ) { |
1083 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 1084 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
1084 | mPisyncFinished = true; | 1085 | mPisyncFinished = true; |
1085 | } | 1086 | } |
1086 | 1087 | ||
1087 | delete s; | 1088 | delete s; |
1088 | } | 1089 | } |
1089 | 1090 | ||
1090 | void KSyncManager::readFileFromSocket() | 1091 | void KSyncManager::readFileFromSocket() |
1091 | { | 1092 | { |
1092 | QString fileName = syncFileName(); | 1093 | QString fileName = syncFileName(); |
1093 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 1094 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
1094 | if ( ! syncWithFile( fileName , true ) ) { | 1095 | if ( ! syncWithFile( fileName , true ) ) { |
1095 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 1096 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
1096 | mPisyncFinished = true; | 1097 | mPisyncFinished = true; |
1097 | return; | 1098 | return; |
1098 | } | 1099 | } |
1099 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 1100 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
1100 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1101 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1101 | if ( mWriteBackFile ) | 1102 | if ( mWriteBackFile ) |
1102 | commandSocket->writeFile( fileName ); | 1103 | commandSocket->writeFile( fileName ); |
1103 | else { | 1104 | else { |
1104 | commandSocket->sendStop(); | 1105 | commandSocket->sendStop(); |
1105 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 1106 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
1106 | mPisyncFinished = true; | 1107 | mPisyncFinished = true; |
1107 | } | 1108 | } |
1108 | } | 1109 | } |
1109 | 1110 | ||
1110 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 1111 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
1111 | { | 1112 | { |
1112 | mPassWord = pw; | 1113 | mPassWord = pw; |
1113 | mSocket = 0; | 1114 | mSocket = 0; |
1114 | mSyncActionDialog = 0; | 1115 | mSyncActionDialog = 0; |
1115 | blockRC = false; | 1116 | blockRC = false; |
1116 | }; | 1117 | }; |
1117 | 1118 | ||
1118 | void KServerSocket::newConnection ( int socket ) | 1119 | void KServerSocket::newConnection ( int socket ) |
1119 | { | 1120 | { |
1120 | // qDebug("KServerSocket:New connection %d ", socket); | 1121 | // qDebug("KServerSocket:New connection %d ", socket); |
1121 | if ( mSocket ) { | 1122 | if ( mSocket ) { |
1122 | qDebug("KServerSocket::newConnection Socket deleted! "); | 1123 | qDebug("KServerSocket::newConnection Socket deleted! "); |
1123 | delete mSocket; | 1124 | delete mSocket; |
1124 | mSocket = 0; | 1125 | mSocket = 0; |
1125 | } | 1126 | } |
1126 | mSocket = new QSocket( this ); | 1127 | mSocket = new QSocket( this ); |
1127 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1128 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1128 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1129 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
1129 | mSocket->setSocket( socket ); | 1130 | mSocket->setSocket( socket ); |
1130 | } | 1131 | } |
1131 | 1132 | ||
1132 | void KServerSocket::discardClient() | 1133 | void KServerSocket::discardClient() |
1133 | { | 1134 | { |
1134 | //qDebug(" KServerSocket::discardClient()"); | 1135 | //qDebug(" KServerSocket::discardClient()"); |
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 2101bbb..3db58ec 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -60,257 +60,257 @@ | |||
60 | #include <kmessagebox.h> | 60 | #include <kmessagebox.h> |
61 | 61 | ||
62 | //#include <kurlrequester.h> | 62 | //#include <kurlrequester.h> |
63 | #include <klineedit.h> | 63 | #include <klineedit.h> |
64 | #include "ksyncprofile.h" | 64 | #include "ksyncprofile.h" |
65 | 65 | ||
66 | 66 | ||
67 | //#include "koprefs.h" | 67 | //#include "koprefs.h" |
68 | 68 | ||
69 | #include "ksyncprefsdialog.h" | 69 | #include "ksyncprefsdialog.h" |
70 | //#include "koglobals.h" | 70 | //#include "koglobals.h" |
71 | 71 | ||
72 | 72 | ||
73 | KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : | 73 | KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : |
74 | KDialog(parent,name,true) | 74 | KDialog(parent,name,true) |
75 | { | 75 | { |
76 | 76 | ||
77 | setCaption( i18n("Synchronization Preferences")); | 77 | setCaption( i18n("Synchronization Preferences")); |
78 | 78 | ||
79 | mSyncProfiles.setAutoDelete( true ); | 79 | mSyncProfiles.setAutoDelete( true ); |
80 | setupSyncAlgTab(); | 80 | setupSyncAlgTab(); |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | KSyncPrefsDialog::~KSyncPrefsDialog() | 84 | KSyncPrefsDialog::~KSyncPrefsDialog() |
85 | { | 85 | { |
86 | } | 86 | } |
87 | 87 | ||
88 | void KSyncPrefsDialog::setupSyncAlgTab() | 88 | void KSyncPrefsDialog::setupSyncAlgTab() |
89 | { | 89 | { |
90 | QLabel * lab; | 90 | QLabel * lab; |
91 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); | 91 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); |
92 | QVBox * mainbox = new QVBox( this ); | 92 | QVBox * mainbox = new QVBox( this ); |
93 | QScrollView* sv = new QScrollView( mainbox ); | 93 | QScrollView* sv = new QScrollView( mainbox ); |
94 | QHBoxLayout * lay = new QHBoxLayout( this ); | 94 | QHBoxLayout * lay = new QHBoxLayout( this ); |
95 | lay->addWidget( mainbox ); | 95 | lay->addWidget( mainbox ); |
96 | QHBox * b_box = new QHBox( mainbox ); | 96 | QHBox * b_box = new QHBox( mainbox ); |
97 | 97 | ||
98 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); | 98 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); |
99 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); | 99 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); |
100 | button = new QPushButton( i18n("Cancel"), b_box ); | 100 | button = new QPushButton( i18n("Cancel"), b_box ); |
101 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); | 101 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); |
102 | //QBoxLayout * sl = new QVBoxLayout(this ); | 102 | //QBoxLayout * sl = new QVBoxLayout(this ); |
103 | //sl->addWidget ( sv ); | 103 | //sl->addWidget ( sv ); |
104 | sv->setResizePolicy ( QScrollView::AutoOneFit ); | 104 | sv->setResizePolicy ( QScrollView::AutoOneFit ); |
105 | QFrame *topFrame = new QFrame ( sv ); | 105 | QFrame *topFrame = new QFrame ( sv ); |
106 | sv->addChild( topFrame ); | 106 | sv->addChild( topFrame ); |
107 | mSetupSyncAlgTab = topFrame; | 107 | mSetupSyncAlgTab = topFrame; |
108 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 108 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
109 | topLayout->setSpacing(spacingHint()); | 109 | topLayout->setSpacing(spacingHint()); |
110 | topLayout->setMargin(marginHint()); | 110 | topLayout->setMargin(marginHint()); |
111 | 111 | ||
112 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); | 112 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); |
113 | int iii = 0; | 113 | int iii = 0; |
114 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 114 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
115 | //++iii; | 115 | //++iii; |
116 | 116 | ||
117 | mMyMachineName = new QLineEdit(topFrame); | 117 | mMyMachineName = new QLineEdit(topFrame); |
118 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); | 118 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); |
119 | topLayout->addWidget(lab ,iii,0); | 119 | topLayout->addWidget(lab ,iii,0); |
120 | topLayout->addWidget(mMyMachineName,iii,1); | 120 | topLayout->addWidget(mMyMachineName,iii,1); |
121 | ++iii; | 121 | ++iii; |
122 | 122 | ||
123 | QHBox* buttonbox = new QHBox( topFrame); | 123 | QHBox* buttonbox = new QHBox( topFrame); |
124 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); | 124 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); |
125 | ++iii; | 125 | ++iii; |
126 | button = new QPushButton( i18n("New profile"), buttonbox ); | 126 | button = new QPushButton( i18n("New profile"), buttonbox ); |
127 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); | 127 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); |
128 | 128 | ||
129 | button = new QPushButton( i18n("Clone profile"), buttonbox ); | 129 | button = new QPushButton( i18n("Clone profile"), buttonbox ); |
130 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); | 130 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); |
131 | 131 | ||
132 | button = new QPushButton( i18n("Delete profile"), buttonbox ); | 132 | button = new QPushButton( i18n("Delete profile"), buttonbox ); |
133 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); | 133 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); |
134 | 134 | ||
135 | mProfileBox = new QComboBox(topFrame); | 135 | mProfileBox = new QComboBox(topFrame); |
136 | mProfileBox->setEditable ( true ); | 136 | mProfileBox->setEditable ( true ); |
137 | mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); | 137 | mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); |
138 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); | 138 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); |
139 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); | 139 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); |
140 | 140 | ||
141 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); | 141 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); |
142 | topLayout->addWidget(lab ,iii,0); | 142 | topLayout->addWidget(lab ,iii,0); |
143 | topLayout->addWidget(mProfileBox, iii,1); | 143 | topLayout->addWidget(mProfileBox, iii,1); |
144 | ++iii; | 144 | ++iii; |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
148 | QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame); | 148 | QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame); |
149 | new QLabel( i18n("Include in multiple "), iims ); | 149 | new QLabel( i18n("Include in multiple "), iims ); |
150 | mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); | 150 | mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); |
151 | mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); | 151 | mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); |
152 | mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); | 152 | mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); |
153 | new QLabel( i18n(" sync"), iims ); | 153 | new QLabel( i18n(" sync"), iims ); |
154 | topLayout->addMultiCellWidget(iims, iii,iii,0,1); | 154 | topLayout->addMultiCellWidget(iims, iii,iii,0,1); |
155 | ++iii; | 155 | ++iii; |
156 | QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); | 156 | QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); |
157 | topLayout->addMultiCellWidget(gb0, iii,iii,0,1); | 157 | topLayout->addMultiCellWidget(gb0, iii,iii,0,1); |
158 | ++iii; | 158 | ++iii; |
159 | QButtonGroup* gr; | 159 | QButtonGroup* gr; |
160 | { | 160 | { |
161 | QVGroupBox* topFrame = gb0; | 161 | QVGroupBox* topFrame = gb0; |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); | 165 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); |
166 | //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); | 166 | //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); |
167 | //++iii; | 167 | //++iii; |
168 | gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); | 168 | gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); |
169 | //topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 169 | //topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
170 | //++iii; | 170 | //++iii; |
171 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); | 171 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); |
172 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); | 172 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); |
173 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); | 173 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); |
174 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); | 174 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); |
175 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); | 175 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); |
176 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); | 176 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); |
177 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); | 177 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); |
178 | 178 | ||
179 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); | 179 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); |
180 | //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); | 180 | //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); |
181 | //++iii; | 181 | //++iii; |
182 | 182 | ||
183 | QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); | 183 | QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); |
184 | QVBox * fibo2 = new QVBox ( gb5 ); | 184 | QVBox * fibo2 = new QVBox ( gb5 ); |
185 | new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); | 185 | new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); |
186 | mFilterInCal = new QComboBox( fibo2 ); | 186 | mFilterInCal = new QComboBox( fibo2 ); |
187 | fibo2 = new QVBox ( gb5 ); | 187 | fibo2 = new QVBox ( gb5 ); |
188 | new QLabel ( i18n("Incoming adressbook filter:"), fibo2 ); | 188 | new QLabel ( i18n("Incoming addressbook filter:"), fibo2 ); |
189 | mFilterInAB = new QComboBox( fibo2 ); | 189 | mFilterInAB = new QComboBox( fibo2 ); |
190 | 190 | ||
191 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); | 191 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); |
192 | // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | 192 | // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); |
193 | // ++iii; | 193 | // ++iii; |
194 | 194 | ||
195 | QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); | 195 | QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); |
196 | //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); | 196 | //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); |
197 | //++iii; | 197 | //++iii; |
198 | { | 198 | { |
199 | QVGroupBox*topFrame = gb2; | 199 | QVGroupBox*topFrame = gb2; |
200 | mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); | 200 | mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); |
201 | QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); | 201 | QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); |
202 | QVBox * fibo = new QVBox ( gb4 ); | 202 | QVBox * fibo = new QVBox ( gb4 ); |
203 | new QLabel ( i18n("Outgoing calendar filter:"), fibo ); | 203 | new QLabel ( i18n("Outgoing calendar filter:"), fibo ); |
204 | mFilterOutCal = new QComboBox( fibo ); | 204 | mFilterOutCal = new QComboBox( fibo ); |
205 | fibo = new QVBox ( gb4 ); | 205 | fibo = new QVBox ( gb4 ); |
206 | new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); | 206 | new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); |
207 | mFilterOutAB = new QComboBox( fibo ); | 207 | mFilterOutAB = new QComboBox( fibo ); |
208 | //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); | 208 | //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); |
209 | //++iii; | 209 | //++iii; |
210 | mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); | 210 | mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); |
211 | //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); | 211 | //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); |
212 | //++iii; | 212 | //++iii; |
213 | QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); | 213 | QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); |
214 | connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); | 214 | connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); |
215 | new QLabel( i18n("From ") , gb3 ); | 215 | new QLabel( i18n("From ") , gb3 ); |
216 | mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); | 216 | mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); |
217 | new QLabel( i18n(" weeks in the past to ") , gb3 ); | 217 | new QLabel( i18n(" weeks in the past to ") , gb3 ); |
218 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); | 218 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); |
219 | new QLabel( i18n(" weeks in the future ") , gb3 ); | 219 | new QLabel( i18n(" weeks in the future ") , gb3 ); |
220 | //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); | 220 | //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); |
221 | //++iii; | 221 | //++iii; |
222 | gb3->setEnabled( false ); | 222 | gb3->setEnabled( false ); |
223 | connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); | 223 | connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); |
224 | } | 224 | } |
225 | connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); | 225 | connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); |
226 | 226 | ||
227 | } | 227 | } |
228 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | 228 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); |
229 | gr = proGr; | 229 | gr = proGr; |
230 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 230 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
231 | ++iii; | 231 | ++iii; |
232 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 232 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
233 | mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); | 233 | mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); |
234 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 234 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
235 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 235 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
236 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 236 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
237 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); | 237 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); |
238 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 238 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
239 | 239 | ||
240 | QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); | 240 | QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); |
241 | topLayout->addMultiCellWidget(gb1, iii,iii,0,1); | 241 | topLayout->addMultiCellWidget(gb1, iii,iii,0,1); |
242 | ++iii; | 242 | ++iii; |
243 | 243 | ||
244 | // ****************************************** | 244 | // ****************************************** |
245 | // Profile kind specific settings | 245 | // Profile kind specific settings |
246 | { | 246 | { |
247 | // *** phone ******************************* | 247 | // *** phone ******************************* |
248 | QVGroupBox* topFrame = gb1; | 248 | QVGroupBox* topFrame = gb1; |
249 | phoneWidget = new QVBox( topFrame); | 249 | phoneWidget = new QVBox( topFrame); |
250 | //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); | 250 | //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); |
251 | //++iii; | 251 | //++iii; |
252 | mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); | 252 | mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); |
253 | QHBox* temphb = new QHBox( phoneWidget ); | 253 | QHBox* temphb = new QHBox( phoneWidget ); |
254 | new QLabel( i18n("I/O device: "), temphb ); | 254 | new QLabel( i18n("I/O device: "), temphb ); |
255 | mPhoneDevice = new QLineEdit( temphb); | 255 | mPhoneDevice = new QLineEdit( temphb); |
256 | button = new QPushButton( i18n("Help..."), temphb ); | 256 | button = new QPushButton( i18n("Help..."), temphb ); |
257 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); | 257 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); |
258 | 258 | ||
259 | 259 | ||
260 | temphb = new QHBox( phoneWidget ); | 260 | temphb = new QHBox( phoneWidget ); |
261 | new QLabel( i18n("Connection: "), temphb ); | 261 | new QLabel( i18n("Connection: "), temphb ); |
262 | mPhoneConnection = new QLineEdit( temphb); | 262 | mPhoneConnection = new QLineEdit( temphb); |
263 | button = new QPushButton( i18n("Help..."), temphb ); | 263 | button = new QPushButton( i18n("Help..."), temphb ); |
264 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); | 264 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); |
265 | 265 | ||
266 | 266 | ||
267 | temphb = new QHBox( phoneWidget ); | 267 | temphb = new QHBox( phoneWidget ); |
268 | new QLabel( i18n("Model(opt.): "), temphb ); | 268 | new QLabel( i18n("Model(opt.): "), temphb ); |
269 | mPhoneModel = new QLineEdit( temphb); | 269 | mPhoneModel = new QLineEdit( temphb); |
270 | button = new QPushButton( i18n("Help..."), temphb ); | 270 | button = new QPushButton( i18n("Help..."), temphb ); |
271 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); | 271 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); |
272 | 272 | ||
273 | // *** local******************************* | 273 | // *** local******************************* |
274 | localFileWidget = new QVBox( topFrame); | 274 | localFileWidget = new QVBox( topFrame); |
275 | //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); | 275 | //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); |
276 | //++iii; | 276 | //++iii; |
277 | temphb = new QHBox( localFileWidget ); | 277 | temphb = new QHBox( localFileWidget ); |
278 | 278 | ||
279 | lab = new QLabel( i18n("Local file Cal:"), temphb ); | 279 | lab = new QLabel( i18n("Local file Cal:"), temphb ); |
280 | lab = new QLabel( i18n("Local file ABook:"), temphb ); | 280 | lab = new QLabel( i18n("Local file ABook:"), temphb ); |
281 | lab = new QLabel( i18n("Local file PWMgr:"), temphb ); | 281 | lab = new QLabel( i18n("Local file PWMgr:"), temphb ); |
282 | temphb = new QHBox( localFileWidget ); | 282 | temphb = new QHBox( localFileWidget ); |
283 | button = new QPushButton( i18n("Choose..."), temphb ); | 283 | button = new QPushButton( i18n("Choose..."), temphb ); |
284 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); | 284 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); |
285 | button = new QPushButton( i18n("Choose..."), temphb ); | 285 | button = new QPushButton( i18n("Choose..."), temphb ); |
286 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); | 286 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); |
287 | button = new QPushButton( i18n("Choose..."), temphb ); | 287 | button = new QPushButton( i18n("Choose..."), temphb ); |
288 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); | 288 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); |
289 | temphb = new QHBox( localFileWidget ); | 289 | temphb = new QHBox( localFileWidget ); |
290 | 290 | ||
291 | mRemoteFile = new QLineEdit( temphb); | 291 | mRemoteFile = new QLineEdit( temphb); |
292 | mRemoteFileAB = new QLineEdit( temphb); | 292 | mRemoteFileAB = new QLineEdit( temphb); |
293 | mRemoteFilePWM = new QLineEdit( temphb); | 293 | mRemoteFilePWM = new QLineEdit( temphb); |
294 | mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget ); | 294 | mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget ); |
295 | 295 | ||
296 | 296 | ||
297 | // *** remote******************************* | 297 | // *** remote******************************* |
298 | remoteFileWidget = new QVBox( topFrame); | 298 | remoteFileWidget = new QVBox( topFrame); |
299 | //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); | 299 | //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); |
300 | //++iii; | 300 | //++iii; |
301 | temphb = new QHBox( remoteFileWidget ); | 301 | temphb = new QHBox( remoteFileWidget ); |
302 | new QLabel( i18n("Calendar:"), temphb); | 302 | new QLabel( i18n("Calendar:"), temphb); |
303 | new QLabel( i18n("AddressBook:"), temphb); | 303 | new QLabel( i18n("AddressBook:"), temphb); |
304 | new QLabel( i18n("PWManager:"), temphb); | 304 | new QLabel( i18n("PWManager:"), temphb); |
305 | 305 | ||
306 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); | 306 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); |
307 | temphb = new QHBox( remoteFileWidget ); | 307 | temphb = new QHBox( remoteFileWidget ); |
308 | mRemotePrecommand = new QLineEdit(temphb); | 308 | mRemotePrecommand = new QLineEdit(temphb); |
309 | mRemotePrecommandAB = new QLineEdit(temphb); | 309 | mRemotePrecommandAB = new QLineEdit(temphb); |
310 | mRemotePrecommandPWM = new QLineEdit(temphb); | 310 | mRemotePrecommandPWM = new QLineEdit(temphb); |
311 | 311 | ||
312 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); | 312 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); |
313 | temphb = new QHBox( remoteFileWidget ); | 313 | temphb = new QHBox( remoteFileWidget ); |
314 | mLocalTempFile = new QLineEdit(temphb); | 314 | mLocalTempFile = new QLineEdit(temphb); |
315 | mLocalTempFileAB = new QLineEdit(temphb); | 315 | mLocalTempFileAB = new QLineEdit(temphb); |
316 | mLocalTempFilePWM = new QLineEdit(temphb); | 316 | mLocalTempFilePWM = new QLineEdit(temphb); |
diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp index e687e5d..d712771 100644 --- a/microkde/kidmanager.cpp +++ b/microkde/kidmanager.cpp | |||
@@ -1,136 +1,136 @@ | |||
1 | #include "kidmanager.h" | 1 | #include "kidmanager.h" |
2 | 2 | ||
3 | KIdManager::KIdManager() | 3 | KIdManager::KIdManager() |
4 | { | 4 | { |
5 | 5 | ||
6 | } | 6 | } |
7 | // :profilename;12;id_withLen12;123456: | 7 | // :profilename;12;id_withLen12;123456: |
8 | // 123456 is the csum | 8 | // 123456 is the csum |
9 | QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) | 9 | const QString KIdManager::setId (const QString& idString,const QString& prof,const QString& idvalue ) |
10 | { | 10 | { |
11 | int startProf; | 11 | int startProf; |
12 | int startIDnum; | 12 | int startIDnum; |
13 | int startIDnumlen; | 13 | int startIDnumlen; |
14 | int startID; | 14 | int startID; |
15 | int lenID; | 15 | int lenID; |
16 | int startCsum; | 16 | int startCsum; |
17 | int lenCsum; | 17 | int lenCsum; |
18 | int endall; | 18 | int endall; |
19 | QString newIDString; | 19 | QString newIDString; |
20 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { | 20 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { |
21 | newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum ); | 21 | newIDString = idString.left(startIDnum ) + QString::number( idvalue.length() ) +";"+idvalue+ ";"+idString.mid( startCsum ); |
22 | } else { | 22 | } else { |
23 | newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:"; | 23 | newIDString = idString + prof+";"+ QString::number( idvalue.length() ) +";"+idvalue +";0:"; |
24 | } | 24 | } |
25 | //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() ); | 25 | //qDebug("setID:profile:%s*retval:%s*idvalue:%s* ", prof.latin1(), newIDString.latin1() ,idvalue.latin1() ); |
26 | return newIDString; | 26 | return newIDString; |
27 | } | 27 | } |
28 | QString KIdManager::getId (const QString& idString,const QString& prof ) | 28 | const QString KIdManager::getId (const QString& idString,const QString& prof ) |
29 | { | 29 | { |
30 | int startProf; | 30 | int startProf; |
31 | int startIDnum; | 31 | int startIDnum; |
32 | int startIDnumlen; | 32 | int startIDnumlen; |
33 | int startID; | 33 | int startID; |
34 | int lenID; | 34 | int lenID; |
35 | int startCsum; | 35 | int startCsum; |
36 | int lenCsum; | 36 | int lenCsum; |
37 | int endall; | 37 | int endall; |
38 | QString idval = ""; | 38 | QString idval = ""; |
39 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) | 39 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) |
40 | idval = idString.mid( startID, lenID ); | 40 | idval = idString.mid( startID, lenID ); |
41 | 41 | ||
42 | //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); | 42 | //qDebug("getID:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); |
43 | return idval; | 43 | return idval; |
44 | 44 | ||
45 | } | 45 | } |
46 | 46 | ||
47 | QString KIdManager::removeId (const QString& idString,const QString& prof ) | 47 | const QString KIdManager::removeId (const QString& idString,const QString& prof ) |
48 | { | 48 | { |
49 | int startProf; | 49 | int startProf; |
50 | int startIDnum; | 50 | int startIDnum; |
51 | int startIDnumlen; | 51 | int startIDnumlen; |
52 | int startID; | 52 | int startID; |
53 | int lenID; | 53 | int lenID; |
54 | int startCsum; | 54 | int startCsum; |
55 | int lenCsum; | 55 | int lenCsum; |
56 | int endall; | 56 | int endall; |
57 | QString newIDString; | 57 | QString newIDString; |
58 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { | 58 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { |
59 | newIDString = idString.left(startProf) + idString.mid( endall+1 ); | 59 | newIDString = idString.left(startProf) + idString.mid( endall+1 ); |
60 | } else { | 60 | } else { |
61 | newIDString = idString; | 61 | newIDString = idString; |
62 | } | 62 | } |
63 | //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); | 63 | //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); |
64 | return newIDString; | 64 | return newIDString; |
65 | } | 65 | } |
66 | 66 | ||
67 | QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) | 67 | const QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) |
68 | { | 68 | { |
69 | int startProf; | 69 | int startProf; |
70 | int startIDnum; | 70 | int startIDnum; |
71 | int startIDnumlen; | 71 | int startIDnumlen; |
72 | int startID; | 72 | int startID; |
73 | int lenID; | 73 | int lenID; |
74 | int startCsum; | 74 | int startCsum; |
75 | int lenCsum; | 75 | int lenCsum; |
76 | int endall; | 76 | int endall; |
77 | QString newIDString; | 77 | QString newIDString; |
78 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { | 78 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { |
79 | newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1); | 79 | newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1); |
80 | } else { | 80 | } else { |
81 | newIDString = idString + prof + ";3;_u_;"+ idCsum + ":"; | 81 | newIDString = idString + prof + ";3;_u_;"+ idCsum + ":"; |
82 | } | 82 | } |
83 | //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); | 83 | //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); |
84 | return newIDString; | 84 | return newIDString; |
85 | } | 85 | } |
86 | QString KIdManager::getCsum (const QString& idString,const QString& prof ) | 86 | const QString KIdManager::getCsum (const QString& idString,const QString& prof ) |
87 | { | 87 | { |
88 | int startProf; | 88 | int startProf; |
89 | int startIDnum; | 89 | int startIDnum; |
90 | int startIDnumlen; | 90 | int startIDnumlen; |
91 | int startID; | 91 | int startID; |
92 | int lenID; | 92 | int lenID; |
93 | int startCsum; | 93 | int startCsum; |
94 | int lenCsum; | 94 | int lenCsum; |
95 | int endall; | 95 | int endall; |
96 | QString idval = ""; | 96 | QString idval = ""; |
97 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) | 97 | if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) |
98 | idval = idString.mid( startCsum, lenCsum ); | 98 | idval = idString.mid( startCsum, lenCsum ); |
99 | 99 | ||
100 | //qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); | 100 | //qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); |
101 | return idval; | 101 | return idval; |
102 | } | 102 | } |
103 | // :profilename;12;id_withLen12;123456: | 103 | // :profilename;12;id_withLen12;123456: |
104 | bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) | 104 | bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) |
105 | { | 105 | { |
106 | startProf = idString.find( ":"+prof+";" ); | 106 | startProf = idString.find( ":"+prof+";" ); |
107 | if ( startProf >= 0 ) { | 107 | if ( startProf >= 0 ) { |
108 | startIDnum = prof.length()+2+startProf; | 108 | startIDnum = prof.length()+2+startProf; |
109 | startID = idString.find( ";", startIDnum ) +1; | 109 | startID = idString.find( ";", startIDnum ) +1; |
110 | startIDnumlen = startID - startIDnum - 1; | 110 | startIDnumlen = startID - startIDnum - 1; |
111 | if ( startIDnum > 0 ) { | 111 | if ( startIDnum > 0 ) { |
112 | bool ok; | 112 | bool ok; |
113 | lenID = idString.mid ( startIDnum,startIDnumlen).toInt( &ok ); | 113 | lenID = idString.mid ( startIDnum,startIDnumlen).toInt( &ok ); |
114 | if (ok) { | 114 | if (ok) { |
115 | startCsum = startID+lenID+1; | 115 | startCsum = startID+lenID+1; |
116 | endall = idString.find( ":", startCsum )-1; | 116 | endall = idString.find( ":", startCsum )-1; |
117 | if ( endall < 0 ) { | 117 | if ( endall < 0 ) { |
118 | qDebug("Error getNumbers: andall not found "); | 118 | qDebug("Error getNumbers: andall not found "); |
119 | return false; | 119 | return false; |
120 | } | 120 | } |
121 | lenCsum = endall-startCsum+1; | 121 | lenCsum = endall-startCsum+1; |
122 | } | 122 | } |
123 | else { | 123 | else { |
124 | qDebug("Error getNumbers:length is no number:*%s* ", idString.mid ( startIDnum,startIDnumlen).latin1()); | 124 | qDebug("Error getNumbers:length is no number:*%s* ", idString.mid ( startIDnum,startIDnumlen).latin1()); |
125 | return false; | 125 | return false; |
126 | } | 126 | } |
127 | } else { | 127 | } else { |
128 | qDebug("Error in KIdManager::getNumbers.startIDnum <= 0"); | 128 | qDebug("Error in KIdManager::getNumbers.startIDnum <= 0"); |
129 | return false; | 129 | return false; |
130 | } | 130 | } |
131 | } else { | 131 | } else { |
132 | //qDebug("getnumbers: profile not found *%s* ",prof.latin1() ); | 132 | //qDebug("getnumbers: profile not found *%s* ",prof.latin1() ); |
133 | return false; | 133 | return false; |
134 | } | 134 | } |
135 | return true; | 135 | return true; |
136 | } | 136 | } |
diff --git a/microkde/kidmanager.h b/microkde/kidmanager.h index 00580a0..9786c9f 100644 --- a/microkde/kidmanager.h +++ b/microkde/kidmanager.h | |||
@@ -1,24 +1,24 @@ | |||
1 | #ifndef MINIKDE_KIDMANAGER_H | 1 | #ifndef MINIKDE_KIDMANAGER_H |
2 | #define MINIKDE_KIDMANAGER_H | 2 | #define MINIKDE_KIDMANAGER_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | 5 | ||
6 | #include <qobject.h> | 6 | #include <qobject.h> |
7 | class KIdManager : public QObject | 7 | class KIdManager : public QObject |
8 | { | 8 | { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | public: | 10 | public: |
11 | KIdManager( ); | 11 | KIdManager( ); |
12 | static QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; | 12 | static const QString setId (const QString& idString,const QString& id,const QString& idvalue ) ; |
13 | static QString getId (const QString& idString,const QString& id ) ; | 13 | static const QString getId (const QString& idString,const QString& id ) ; |
14 | static QString removeId (const QString& idString,const QString& id ) ; | 14 | static const QString removeId (const QString& idString,const QString& id ) ; |
15 | static QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; | 15 | static const QString setCsum (const QString& idString,const QString& id,const QString& idvalue ) ; |
16 | static QString getCsum (const QString& idString,const QString& id ) ; | 16 | static const QString getCsum (const QString& idString,const QString& id ) ; |
17 | static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ; | 17 | static bool getNumbers (const QString& idString,const QString& id, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) ; |
18 | private: | 18 | private: |
19 | 19 | ||
20 | private slots: | 20 | private slots: |
21 | }; | 21 | }; |
22 | 22 | ||
23 | 23 | ||
24 | #endif | 24 | #endif |