author | zautrix <zautrix> | 2004-10-30 01:46:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-30 01:46:35 (UTC) |
commit | 6c755a7a8a1e9d9a747267eadf914a6030c9b711 (patch) (unidiff) | |
tree | 14b1b8ed39f50683f095ca5fb7656abd3326854e | |
parent | c477fa8ba7eacfaba3d154a72153acc7bc46abdc (diff) | |
download | kdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.zip kdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.tar.gz kdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.tar.bz2 |
better cat management in kapi
-rw-r--r-- | kaddressbook/kabcore.cpp | 107 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 |
2 files changed, 106 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 83027ac..9505a23 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -86,124 +86,162 @@ $Id$ | |||
86 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
88 | //US | 88 | //US |
89 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | 99 | ||
100 | 100 | ||
101 | //#include <qlabel.h> | 101 | //#include <qlabel.h> |
102 | 102 | ||
103 | 103 | ||
104 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 105 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 106 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 107 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 108 | #else |
109 | 109 | ||
110 | #include <qmenubar.h> | 110 | #include <qmenubar.h> |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | #endif // KAB_EMBEDDED | 113 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 114 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 115 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 116 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 117 | #include "externalapphandler.h" |
118 | 118 | ||
119 | 119 | ||
120 | #include <kresources/selectdialog.h> | 120 | #include <kresources/selectdialog.h> |
121 | #include <kmessagebox.h> | 121 | #include <kmessagebox.h> |
122 | 122 | ||
123 | #include <picture.h> | 123 | #include <picture.h> |
124 | #include <resource.h> | 124 | #include <resource.h> |
125 | 125 | ||
126 | //US#include <qsplitter.h> | 126 | //US#include <qsplitter.h> |
127 | #include <qmap.h> | 127 | #include <qmap.h> |
128 | #include <qdir.h> | 128 | #include <qdir.h> |
129 | #include <qfile.h> | 129 | #include <qfile.h> |
130 | #include <qvbox.h> | 130 | #include <qvbox.h> |
131 | #include <qlayout.h> | 131 | #include <qlayout.h> |
132 | #include <qclipboard.h> | 132 | #include <qclipboard.h> |
133 | #include <qtextstream.h> | 133 | #include <qtextstream.h> |
134 | #include <qradiobutton.h> | ||
135 | #include <qbuttongroup.h> | ||
134 | 136 | ||
135 | #include <libkdepim/categoryselectdialog.h> | 137 | #include <libkdepim/categoryselectdialog.h> |
138 | #include <libkdepim/categoryeditdialog.h> | ||
136 | #include <kabc/vcardconverter.h> | 139 | #include <kabc/vcardconverter.h> |
137 | 140 | ||
138 | 141 | ||
139 | #include "addresseeutil.h" | 142 | #include "addresseeutil.h" |
140 | #include "undocmds.h" | 143 | #include "undocmds.h" |
141 | #include "addresseeeditordialog.h" | 144 | #include "addresseeeditordialog.h" |
142 | #include "viewmanager.h" | 145 | #include "viewmanager.h" |
143 | #include "details/detailsviewcontainer.h" | 146 | #include "details/detailsviewcontainer.h" |
144 | #include "kabprefs.h" | 147 | #include "kabprefs.h" |
145 | #include "xxportmanager.h" | 148 | #include "xxportmanager.h" |
146 | #include "incsearchwidget.h" | 149 | #include "incsearchwidget.h" |
147 | #include "jumpbuttonbar.h" | 150 | #include "jumpbuttonbar.h" |
148 | #include "extensionmanager.h" | 151 | #include "extensionmanager.h" |
149 | #include "addresseeconfig.h" | 152 | #include "addresseeconfig.h" |
150 | #include <kcmultidialog.h> | 153 | #include <kcmultidialog.h> |
151 | 154 | ||
152 | #ifdef _WIN32_ | 155 | #ifdef _WIN32_ |
153 | 156 | ||
154 | #include "kaimportoldialog.h" | 157 | #include "kaimportoldialog.h" |
155 | #else | 158 | #else |
156 | #include <unistd.h> | 159 | #include <unistd.h> |
157 | #endif | 160 | #endif |
158 | // sync includes | 161 | // sync includes |
159 | #include <libkdepim/ksyncprofile.h> | 162 | #include <libkdepim/ksyncprofile.h> |
160 | #include <libkdepim/ksyncprefsdialog.h> | 163 | #include <libkdepim/ksyncprefsdialog.h> |
161 | 164 | ||
165 | |||
166 | class KABCatPrefs : public QDialog | ||
167 | { | ||
168 | public: | ||
169 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | ||
170 | QDialog( parent, name, true ) | ||
171 | { | ||
172 | setCaption( i18n("Manage new Categories") ); | ||
173 | QVBoxLayout* lay = new QVBoxLayout( this ); | ||
174 | lay->setSpacing( 3 ); | ||
175 | lay->setMargin( 3 ); | ||
176 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | ||
177 | lay->addWidget( lab ); | ||
178 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | ||
179 | lay->addWidget( format ); | ||
180 | format->setExclusive ( true ) ; | ||
181 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | ||
182 | new QRadioButton(i18n("Remove from addressees"), format ); | ||
183 | addCatBut->setChecked( true ); | ||
184 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | ||
185 | lay->addWidget( ok ); | ||
186 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | ||
187 | lay->addWidget( cancel ); | ||
188 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
189 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
190 | resize( 200, 200 ); | ||
191 | } | ||
192 | |||
193 | bool addCat() { return addCatBut->isChecked(); } | ||
194 | private: | ||
195 | QRadioButton* addCatBut; | ||
196 | }; | ||
197 | |||
198 | |||
199 | |||
162 | class KAex2phonePrefs : public QDialog | 200 | class KAex2phonePrefs : public QDialog |
163 | { | 201 | { |
164 | public: | 202 | public: |
165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 203 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
166 | QDialog( parent, name, true ) | 204 | QDialog( parent, name, true ) |
167 | { | 205 | { |
168 | setCaption( i18n("Export to phone options") ); | 206 | setCaption( i18n("Export to phone options") ); |
169 | QVBoxLayout* lay = new QVBoxLayout( this ); | 207 | QVBoxLayout* lay = new QVBoxLayout( this ); |
170 | lay->setSpacing( 3 ); | 208 | lay->setSpacing( 3 ); |
171 | lay->setMargin( 3 ); | 209 | lay->setMargin( 3 ); |
172 | QLabel *lab; | 210 | QLabel *lab; |
173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 211 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
174 | lab->setAlignment (AlignHCenter ); | 212 | lab->setAlignment (AlignHCenter ); |
175 | QHBox* temphb; | 213 | QHBox* temphb; |
176 | temphb = new QHBox( this ); | 214 | temphb = new QHBox( this ); |
177 | new QLabel( i18n("I/O device: "), temphb ); | 215 | new QLabel( i18n("I/O device: "), temphb ); |
178 | mPhoneDevice = new QLineEdit( temphb); | 216 | mPhoneDevice = new QLineEdit( temphb); |
179 | lay->addWidget( temphb ); | 217 | lay->addWidget( temphb ); |
180 | temphb = new QHBox( this ); | 218 | temphb = new QHBox( this ); |
181 | new QLabel( i18n("Connection: "), temphb ); | 219 | new QLabel( i18n("Connection: "), temphb ); |
182 | mPhoneConnection = new QLineEdit( temphb); | 220 | mPhoneConnection = new QLineEdit( temphb); |
183 | lay->addWidget( temphb ); | 221 | lay->addWidget( temphb ); |
184 | temphb = new QHBox( this ); | 222 | temphb = new QHBox( this ); |
185 | new QLabel( i18n("Model(opt.): "), temphb ); | 223 | new QLabel( i18n("Model(opt.): "), temphb ); |
186 | mPhoneModel = new QLineEdit( temphb); | 224 | mPhoneModel = new QLineEdit( temphb); |
187 | lay->addWidget( temphb ); | 225 | lay->addWidget( temphb ); |
188 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 226 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
189 | // lay->addWidget( mWriteToSim ); | 227 | // lay->addWidget( mWriteToSim ); |
190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 228 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
191 | lab->setAlignment (AlignHCenter ); | 229 | lab->setAlignment (AlignHCenter ); |
192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 230 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
193 | lay->addWidget( ok ); | 231 | lay->addWidget( ok ); |
194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 232 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
195 | lay->addWidget( cancel ); | 233 | lay->addWidget( cancel ); |
196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 234 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 235 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
198 | resize( 220, 240 ); | 236 | resize( 220, 240 ); |
199 | 237 | ||
200 | } | 238 | } |
201 | 239 | ||
202 | public: | 240 | public: |
203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 241 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
204 | QCheckBox* mWriteToSim; | 242 | QCheckBox* mWriteToSim; |
205 | }; | 243 | }; |
206 | 244 | ||
207 | 245 | ||
208 | bool pasteWithNewUid = true; | 246 | bool pasteWithNewUid = true; |
209 | 247 | ||
@@ -911,129 +949,132 @@ void KABCore::cutContacts() | |||
911 | QStringList uidList = mViewManager->selectedUids(); | 949 | QStringList uidList = mViewManager->selectedUids(); |
912 | 950 | ||
913 | //US if ( uidList.size() > 0 ) { | 951 | //US if ( uidList.size() > 0 ) { |
914 | if ( uidList.count() > 0 ) { | 952 | if ( uidList.count() > 0 ) { |
915 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 953 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
916 | UndoStack::instance()->push( command ); | 954 | UndoStack::instance()->push( command ); |
917 | RedoStack::instance()->clear(); | 955 | RedoStack::instance()->clear(); |
918 | 956 | ||
919 | setModified( true ); | 957 | setModified( true ); |
920 | } | 958 | } |
921 | } | 959 | } |
922 | 960 | ||
923 | void KABCore::pasteContacts() | 961 | void KABCore::pasteContacts() |
924 | { | 962 | { |
925 | QClipboard *cb = QApplication::clipboard(); | 963 | QClipboard *cb = QApplication::clipboard(); |
926 | 964 | ||
927 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 965 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
928 | 966 | ||
929 | pasteContacts( list ); | 967 | pasteContacts( list ); |
930 | } | 968 | } |
931 | 969 | ||
932 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 970 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
933 | { | 971 | { |
934 | KABC::Resource *resource = requestResource( this ); | 972 | KABC::Resource *resource = requestResource( this ); |
935 | KABC::Addressee::List::Iterator it; | 973 | KABC::Addressee::List::Iterator it; |
936 | for ( it = list.begin(); it != list.end(); ++it ) | 974 | for ( it = list.begin(); it != list.end(); ++it ) |
937 | (*it).setResource( resource ); | 975 | (*it).setResource( resource ); |
938 | 976 | ||
939 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 977 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
940 | UndoStack::instance()->push( command ); | 978 | UndoStack::instance()->push( command ); |
941 | RedoStack::instance()->clear(); | 979 | RedoStack::instance()->clear(); |
942 | 980 | ||
943 | setModified( true ); | 981 | setModified( true ); |
944 | } | 982 | } |
945 | 983 | ||
946 | void KABCore::setWhoAmI() | 984 | void KABCore::setWhoAmI() |
947 | { | 985 | { |
948 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 986 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
949 | 987 | ||
950 | if ( addrList.count() > 1 ) { | 988 | if ( addrList.count() > 1 ) { |
951 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 989 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
952 | return; | 990 | return; |
953 | } | 991 | } |
954 | 992 | ||
955 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 993 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
956 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 994 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
957 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 995 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
958 | } | 996 | } |
959 | 997 | void KABCore::editCategories() | |
998 | { | ||
999 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | ||
1000 | dlg.exec(); | ||
1001 | } | ||
960 | void KABCore::setCategories() | 1002 | void KABCore::setCategories() |
961 | { | 1003 | { |
962 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1004 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
963 | if ( !dlg.exec() ) { | 1005 | if ( !dlg.exec() ) { |
964 | message( i18n("Setting categories cancelled") ); | 1006 | message( i18n("Setting categories cancelled") ); |
965 | return; | 1007 | return; |
966 | } | 1008 | } |
967 | bool merge = false; | 1009 | bool merge = false; |
968 | QString msg = i18n( "Merge with existing categories?" ); | 1010 | QString msg = i18n( "Merge with existing categories?" ); |
969 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1011 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
970 | merge = true; | 1012 | merge = true; |
971 | 1013 | ||
972 | message( i18n("Setting categories ... please wait!") ); | 1014 | message( i18n("Setting categories ... please wait!") ); |
973 | QStringList categories = dlg.selectedCategories(); | 1015 | QStringList categories = dlg.selectedCategories(); |
974 | 1016 | ||
975 | QStringList uids = mViewManager->selectedUids(); | 1017 | QStringList uids = mViewManager->selectedUids(); |
976 | QStringList::Iterator it; | 1018 | QStringList::Iterator it; |
977 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1019 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
978 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1020 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
979 | if ( !addr.isEmpty() ) { | 1021 | if ( !addr.isEmpty() ) { |
980 | if ( !merge ) | 1022 | if ( !merge ) |
981 | addr.setCategories( categories ); | 1023 | addr.setCategories( categories ); |
982 | else { | 1024 | else { |
983 | QStringList addrCategories = addr.categories(); | 1025 | QStringList addrCategories = addr.categories(); |
984 | QStringList::Iterator catIt; | 1026 | QStringList::Iterator catIt; |
985 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1027 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
986 | if ( !addrCategories.contains( *catIt ) ) | 1028 | if ( !addrCategories.contains( *catIt ) ) |
987 | addrCategories.append( *catIt ); | 1029 | addrCategories.append( *catIt ); |
988 | } | 1030 | } |
989 | addr.setCategories( addrCategories ); | 1031 | addr.setCategories( addrCategories ); |
990 | } | 1032 | } |
991 | |||
992 | mAddressBook->insertAddressee( addr ); | 1033 | mAddressBook->insertAddressee( addr ); |
993 | } | 1034 | } |
994 | } | 1035 | } |
995 | 1036 | ||
996 | if ( uids.count() > 0 ) | 1037 | if ( uids.count() > 0 ) |
997 | setModified( true ); | 1038 | setModified( true ); |
998 | message( i18n("Setting categories completed!") ); | 1039 | message( i18n("Setting categories completed!") ); |
999 | } | 1040 | } |
1000 | 1041 | ||
1001 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1042 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1002 | { | 1043 | { |
1003 | mIncSearchWidget->setFields( fields ); | 1044 | mIncSearchWidget->setFields( fields ); |
1004 | } | 1045 | } |
1005 | 1046 | ||
1006 | void KABCore::incrementalSearch( const QString& text ) | 1047 | void KABCore::incrementalSearch( const QString& text ) |
1007 | { | 1048 | { |
1008 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1049 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1009 | } | 1050 | } |
1010 | 1051 | ||
1011 | void KABCore::setModified() | 1052 | void KABCore::setModified() |
1012 | { | 1053 | { |
1013 | setModified( true ); | 1054 | setModified( true ); |
1014 | } | 1055 | } |
1015 | 1056 | ||
1016 | void KABCore::setModifiedWOrefresh() | 1057 | void KABCore::setModifiedWOrefresh() |
1017 | { | 1058 | { |
1018 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1059 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1019 | mModified = true; | 1060 | mModified = true; |
1020 | mActionSave->setEnabled( mModified ); | 1061 | mActionSave->setEnabled( mModified ); |
1021 | #ifdef DESKTOP_VERSION | 1062 | #ifdef DESKTOP_VERSION |
1022 | mDetails->refreshView(); | 1063 | mDetails->refreshView(); |
1023 | #endif | 1064 | #endif |
1024 | 1065 | ||
1025 | } | 1066 | } |
1026 | void KABCore::setModified( bool modified ) | 1067 | void KABCore::setModified( bool modified ) |
1027 | { | 1068 | { |
1028 | mModified = modified; | 1069 | mModified = modified; |
1029 | mActionSave->setEnabled( mModified ); | 1070 | mActionSave->setEnabled( mModified ); |
1030 | 1071 | ||
1031 | if ( modified ) | 1072 | if ( modified ) |
1032 | mJumpButtonBar->recreateButtons(); | 1073 | mJumpButtonBar->recreateButtons(); |
1033 | 1074 | ||
1034 | mViewManager->refreshView(); | 1075 | mViewManager->refreshView(); |
1035 | mDetails->refreshView(); | 1076 | mDetails->refreshView(); |
1036 | 1077 | ||
1037 | } | 1078 | } |
1038 | 1079 | ||
1039 | bool KABCore::modified() const | 1080 | bool KABCore::modified() const |
@@ -1837,96 +1878,99 @@ void KABCore::initActions() | |||
1837 | // "kaddressbook_configure_shortcuts" ); | 1878 | // "kaddressbook_configure_shortcuts" ); |
1838 | #ifdef KAB_EMBEDDED | 1879 | #ifdef KAB_EMBEDDED |
1839 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1880 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1840 | mActionConfigureToolbars->setEnabled( false ); | 1881 | mActionConfigureToolbars->setEnabled( false ); |
1841 | #endif //KAB_EMBEDDED | 1882 | #endif //KAB_EMBEDDED |
1842 | 1883 | ||
1843 | } else { | 1884 | } else { |
1844 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1885 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1845 | 1886 | ||
1846 | //US not implemented yet | 1887 | //US not implemented yet |
1847 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1888 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1848 | } | 1889 | } |
1849 | 1890 | ||
1850 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1891 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1851 | actionCollection(), "options_show_jump_bar" ); | 1892 | actionCollection(), "options_show_jump_bar" ); |
1852 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1893 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1853 | 1894 | ||
1854 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1895 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1855 | actionCollection(), "options_show_details" ); | 1896 | actionCollection(), "options_show_details" ); |
1856 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1897 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1857 | 1898 | ||
1858 | 1899 | ||
1859 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 1900 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
1860 | SLOT( toggleBeamReceive() ), actionCollection(), | 1901 | SLOT( toggleBeamReceive() ), actionCollection(), |
1861 | "kaddressbook_beam_rec" ); | 1902 | "kaddressbook_beam_rec" ); |
1862 | 1903 | ||
1863 | 1904 | ||
1864 | // misc | 1905 | // misc |
1865 | // only enable LDAP lookup if we can handle the protocol | 1906 | // only enable LDAP lookup if we can handle the protocol |
1866 | #ifndef KAB_EMBEDDED | 1907 | #ifndef KAB_EMBEDDED |
1867 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1908 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1868 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1909 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1869 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1910 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1870 | "ldap_lookup" ); | 1911 | "ldap_lookup" ); |
1871 | } | 1912 | } |
1872 | #else //KAB_EMBEDDED | 1913 | #else //KAB_EMBEDDED |
1873 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1914 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1874 | #endif //KAB_EMBEDDED | 1915 | #endif //KAB_EMBEDDED |
1875 | 1916 | ||
1876 | 1917 | ||
1877 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1918 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1878 | SLOT( setWhoAmI() ), actionCollection(), | 1919 | SLOT( setWhoAmI() ), actionCollection(), |
1879 | "set_personal" ); | 1920 | "set_personal" ); |
1880 | 1921 | ||
1881 | 1922 | ||
1882 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1923 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1883 | SLOT( setCategories() ), actionCollection(), | 1924 | SLOT( setCategories() ), actionCollection(), |
1884 | "edit_set_categories" ); | 1925 | "edit_set_categories" ); |
1926 | mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, | ||
1927 | SLOT( editCategories() ), actionCollection(), | ||
1928 | "edit__categories" ); | ||
1885 | 1929 | ||
1886 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1930 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1887 | SLOT( removeVoice() ), actionCollection(), | 1931 | SLOT( removeVoice() ), actionCollection(), |
1888 | "remove_voice" ); | 1932 | "remove_voice" ); |
1889 | 1933 | ||
1890 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 1934 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
1891 | SLOT( manageCategories() ), actionCollection(), | 1935 | SLOT( manageCategories() ), actionCollection(), |
1892 | "remove_voice" ); | 1936 | "remove_voice" ); |
1893 | 1937 | ||
1894 | 1938 | ||
1895 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1939 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1896 | SLOT( importFromOL() ), actionCollection(), | 1940 | SLOT( importFromOL() ), actionCollection(), |
1897 | "import_OL" ); | 1941 | "import_OL" ); |
1898 | #ifdef KAB_EMBEDDED | 1942 | #ifdef KAB_EMBEDDED |
1899 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1943 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1900 | this, SLOT( showLicence() ), actionCollection(), | 1944 | this, SLOT( showLicence() ), actionCollection(), |
1901 | "licence_about_data" ); | 1945 | "licence_about_data" ); |
1902 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1946 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1903 | this, SLOT( faq() ), actionCollection(), | 1947 | this, SLOT( faq() ), actionCollection(), |
1904 | "faq_about_data" ); | 1948 | "faq_about_data" ); |
1905 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 1949 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
1906 | this, SLOT( whatsnew() ), actionCollection(), | 1950 | this, SLOT( whatsnew() ), actionCollection(), |
1907 | "wn" ); | 1951 | "wn" ); |
1908 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 1952 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
1909 | this, SLOT( synchowto() ), actionCollection(), | 1953 | this, SLOT( synchowto() ), actionCollection(), |
1910 | "sync" ); | 1954 | "sync" ); |
1911 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 1955 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
1912 | this, SLOT( kdesynchowto() ), actionCollection(), | 1956 | this, SLOT( kdesynchowto() ), actionCollection(), |
1913 | "kdesync" ); | 1957 | "kdesync" ); |
1914 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 1958 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
1915 | this, SLOT( multisynchowto() ), actionCollection(), | 1959 | this, SLOT( multisynchowto() ), actionCollection(), |
1916 | "multisync" ); | 1960 | "multisync" ); |
1917 | 1961 | ||
1918 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1962 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1919 | this, SLOT( createAboutData() ), actionCollection(), | 1963 | this, SLOT( createAboutData() ), actionCollection(), |
1920 | "kaddressbook_about_data" ); | 1964 | "kaddressbook_about_data" ); |
1921 | #endif //KAB_EMBEDDED | 1965 | #endif //KAB_EMBEDDED |
1922 | 1966 | ||
1923 | clipboardDataChanged(); | 1967 | clipboardDataChanged(); |
1924 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1968 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1925 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1969 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1926 | } | 1970 | } |
1927 | 1971 | ||
1928 | //US we need this function, to plug all actions into the correct menues. | 1972 | //US we need this function, to plug all actions into the correct menues. |
1929 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1973 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1930 | void KABCore::addActionsManually() | 1974 | void KABCore::addActionsManually() |
1931 | { | 1975 | { |
1932 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1976 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
@@ -2005,154 +2049,211 @@ void KABCore::addActionsManually() | |||
2005 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 2049 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
2006 | #endif | 2050 | #endif |
2007 | fileMenu->insertSeparator(); | 2051 | fileMenu->insertSeparator(); |
2008 | mActionQuit->plug( fileMenu ); | 2052 | mActionQuit->plug( fileMenu ); |
2009 | #ifdef _WIN32_ | 2053 | #ifdef _WIN32_ |
2010 | mActionImportOL->plug( ImportMenu ); | 2054 | mActionImportOL->plug( ImportMenu ); |
2011 | #endif | 2055 | #endif |
2012 | // edit menu | 2056 | // edit menu |
2013 | mActionUndo->plug( editMenu ); | 2057 | mActionUndo->plug( editMenu ); |
2014 | mActionRedo->plug( editMenu ); | 2058 | mActionRedo->plug( editMenu ); |
2015 | editMenu->insertSeparator(); | 2059 | editMenu->insertSeparator(); |
2016 | mActionCut->plug( editMenu ); | 2060 | mActionCut->plug( editMenu ); |
2017 | mActionCopy->plug( editMenu ); | 2061 | mActionCopy->plug( editMenu ); |
2018 | mActionPaste->plug( editMenu ); | 2062 | mActionPaste->plug( editMenu ); |
2019 | mActionDelete->plug( editMenu ); | 2063 | mActionDelete->plug( editMenu ); |
2020 | editMenu->insertSeparator(); | 2064 | editMenu->insertSeparator(); |
2021 | mActionSelectAll->plug( editMenu ); | 2065 | mActionSelectAll->plug( editMenu ); |
2022 | 2066 | ||
2023 | mActionRemoveVoice->plug( changeMenu ); | 2067 | mActionRemoveVoice->plug( changeMenu ); |
2024 | // settings menu | 2068 | // settings menu |
2025 | //US special menuentry to configure the addressbook resources. On KDE | 2069 | //US special menuentry to configure the addressbook resources. On KDE |
2026 | // you do that through the control center !!! | 2070 | // you do that through the control center !!! |
2027 | mActionConfigResources->plug( settingsMenu ); | 2071 | mActionConfigResources->plug( settingsMenu ); |
2028 | settingsMenu->insertSeparator(); | 2072 | settingsMenu->insertSeparator(); |
2029 | 2073 | ||
2030 | mActionConfigKAddressbook->plug( settingsMenu ); | 2074 | mActionConfigKAddressbook->plug( settingsMenu ); |
2031 | 2075 | ||
2032 | if ( mIsPart ) { | 2076 | if ( mIsPart ) { |
2033 | //US not implemented yet | 2077 | //US not implemented yet |
2034 | //mActionConfigShortcuts->plug( settingsMenu ); | 2078 | //mActionConfigShortcuts->plug( settingsMenu ); |
2035 | //mActionConfigureToolbars->plug( settingsMenu ); | 2079 | //mActionConfigureToolbars->plug( settingsMenu ); |
2036 | 2080 | ||
2037 | } else { | 2081 | } else { |
2038 | //US not implemented yet | 2082 | //US not implemented yet |
2039 | //mActionKeyBindings->plug( settingsMenu ); | 2083 | //mActionKeyBindings->plug( settingsMenu ); |
2040 | } | 2084 | } |
2041 | 2085 | ||
2042 | settingsMenu->insertSeparator(); | 2086 | settingsMenu->insertSeparator(); |
2043 | 2087 | ||
2044 | mActionJumpBar->plug( settingsMenu ); | 2088 | mActionJumpBar->plug( settingsMenu ); |
2045 | mActionDetails->plug( settingsMenu ); | 2089 | mActionDetails->plug( settingsMenu ); |
2046 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2090 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2047 | mActionDetails->plug( tb ); | 2091 | mActionDetails->plug( tb ); |
2048 | settingsMenu->insertSeparator(); | 2092 | settingsMenu->insertSeparator(); |
2049 | mActionBR->plug(settingsMenu ); | 2093 | mActionBR->plug(settingsMenu ); |
2050 | settingsMenu->insertSeparator(); | 2094 | settingsMenu->insertSeparator(); |
2051 | 2095 | ||
2052 | mActionWhoAmI->plug( settingsMenu ); | 2096 | mActionWhoAmI->plug( settingsMenu ); |
2097 | mActionEditCategories->plug( settingsMenu ); | ||
2053 | mActionCategories->plug( settingsMenu ); | 2098 | mActionCategories->plug( settingsMenu ); |
2054 | mActionManageCategories->plug( settingsMenu ); | 2099 | mActionManageCategories->plug( settingsMenu ); |
2055 | 2100 | ||
2056 | 2101 | ||
2057 | mActionWN->plug( helpMenu ); | 2102 | mActionWN->plug( helpMenu ); |
2058 | mActionSyncHowto->plug( helpMenu ); | 2103 | mActionSyncHowto->plug( helpMenu ); |
2059 | mActionKdeSyncHowto->plug( helpMenu ); | 2104 | mActionKdeSyncHowto->plug( helpMenu ); |
2060 | mActionMultiSyncHowto->plug( helpMenu ); | 2105 | mActionMultiSyncHowto->plug( helpMenu ); |
2061 | mActionFaq->plug( helpMenu ); | 2106 | mActionFaq->plug( helpMenu ); |
2062 | mActionLicence->plug( helpMenu ); | 2107 | mActionLicence->plug( helpMenu ); |
2063 | mActionAboutKAddressbook->plug( helpMenu ); | 2108 | mActionAboutKAddressbook->plug( helpMenu ); |
2064 | 2109 | ||
2065 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2110 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2066 | 2111 | ||
2067 | mActionSave->plug( tb ); | 2112 | mActionSave->plug( tb ); |
2068 | mViewManager->getFilterAction()->plug ( tb); | 2113 | mViewManager->getFilterAction()->plug ( tb); |
2069 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2114 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2070 | mActionUndo->plug( tb ); | 2115 | mActionUndo->plug( tb ); |
2071 | mActionDelete->plug( tb ); | 2116 | mActionDelete->plug( tb ); |
2072 | mActionRedo->plug( tb ); | 2117 | mActionRedo->plug( tb ); |
2073 | } | 2118 | } |
2074 | } else { | 2119 | } else { |
2075 | mActionSave->plug( tb ); | 2120 | mActionSave->plug( tb ); |
2076 | tb->enableMoving(false); | 2121 | tb->enableMoving(false); |
2077 | } | 2122 | } |
2078 | //mActionQuit->plug ( tb ); | 2123 | //mActionQuit->plug ( tb ); |
2079 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2124 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2080 | 2125 | ||
2081 | //US link the searchwidget first to this. | 2126 | //US link the searchwidget first to this. |
2082 | // The real linkage to the toolbar happens later. | 2127 | // The real linkage to the toolbar happens later. |
2083 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2128 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2084 | //US tb->insertItem( mIncSearchWidget ); | 2129 | //US tb->insertItem( mIncSearchWidget ); |
2085 | /*US | 2130 | /*US |
2086 | mIncSearchWidget = new IncSearchWidget( tb ); | 2131 | mIncSearchWidget = new IncSearchWidget( tb ); |
2087 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2132 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2088 | SLOT( incrementalSearch( const QString& ) ) ); | 2133 | SLOT( incrementalSearch( const QString& ) ) ); |
2089 | 2134 | ||
2090 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2135 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2091 | 2136 | ||
2092 | //US topLayout->addWidget( mJumpButtonBar ); | 2137 | //US topLayout->addWidget( mJumpButtonBar ); |
2093 | this->layout()->add( mJumpButtonBar ); | 2138 | this->layout()->add( mJumpButtonBar ); |
2094 | */ | 2139 | */ |
2095 | 2140 | ||
2096 | #endif //KAB_EMBEDDED | 2141 | #endif //KAB_EMBEDDED |
2097 | 2142 | ||
2098 | mActionExport2phone->plug( ExportMenu ); | 2143 | mActionExport2phone->plug( ExportMenu ); |
2099 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2144 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2100 | syncManager->fillSyncMenu(); | 2145 | syncManager->fillSyncMenu(); |
2101 | 2146 | ||
2102 | } | 2147 | } |
2103 | void KABCore::showLicence() | 2148 | void KABCore::showLicence() |
2104 | { | 2149 | { |
2105 | KApplication::showLicence(); | 2150 | KApplication::showLicence(); |
2106 | } | 2151 | } |
2107 | 2152 | ||
2108 | void KABCore::manageCategories( ) | 2153 | void KABCore::manageCategories( ) |
2109 | { | 2154 | { |
2110 | 2155 | KABCatPrefs* cp = new KABCatPrefs(); | |
2156 | cp->show(); | ||
2157 | int w =cp->sizeHint().width() ; | ||
2158 | int h = cp->sizeHint().height() ; | ||
2159 | int dw = QApplication::desktop()->width(); | ||
2160 | int dh = QApplication::desktop()->height(); | ||
2161 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | ||
2162 | if ( !cp->exec() ) { | ||
2163 | delete cp; | ||
2164 | return; | ||
2165 | } | ||
2166 | int count = 0; | ||
2167 | message( i18n("Please wait, processing categories...")); | ||
2168 | if ( cp->addCat() ) { | ||
2169 | KABC::AddressBook::Iterator it; | ||
2170 | QStringList catList = KABPrefs::instance()->mCustomCategories; | ||
2171 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | ||
2172 | QStringList catIncList = (*it).categories(); | ||
2173 | int i; | ||
2174 | for( i = 0; i< catIncList.count(); ++i ) { | ||
2175 | if ( !catList.contains (catIncList[i])) { | ||
2176 | catList.append( catIncList[i] ); | ||
2177 | //qDebug("add cat %s ", catIncList[i].latin1()); | ||
2178 | ++count; | ||
2179 | } | ||
2180 | } | ||
2181 | } | ||
2182 | catList.sort(); | ||
2183 | KABPrefs::instance()->mCustomCategories = catList; | ||
2184 | KABPrefs::instance()->writeConfig(); | ||
2185 | message(QString::number( count )+ i18n(" categories added to list! ")); | ||
2186 | } else { | ||
2187 | QStringList catList = KABPrefs::instance()->mCustomCategories; | ||
2188 | QStringList catIncList; | ||
2189 | QStringList newCatList; | ||
2190 | KABC::AddressBook::Iterator it; | ||
2191 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | ||
2192 | QStringList catIncList = (*it).categories(); | ||
2193 | int i; | ||
2194 | if ( catIncList.count() ) { | ||
2195 | newCatList.clear(); | ||
2196 | for( i = 0; i< catIncList.count(); ++i ) { | ||
2197 | if ( catList.contains (catIncList[i])) { | ||
2198 | newCatList.append( catIncList[i] ); | ||
2199 | } | ||
2200 | } | ||
2201 | newCatList.sort(); | ||
2202 | (*it).setCategories( newCatList ); | ||
2203 | mAddressBook->insertAddressee( (*it) ); | ||
2204 | } | ||
2205 | } | ||
2206 | setModified( true ); | ||
2207 | mViewManager->refreshView(); | ||
2208 | mDetails->refreshView(); | ||
2209 | message( i18n("Removing categories done!")); | ||
2210 | } | ||
2211 | delete cp; | ||
2111 | } | 2212 | } |
2112 | void KABCore::removeVoice() | 2213 | void KABCore::removeVoice() |
2113 | { | 2214 | { |
2114 | 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 ) | 2215 | 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 ) |
2115 | return; | 2216 | return; |
2116 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2217 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2117 | KABC::Addressee::List::Iterator it; | 2218 | KABC::Addressee::List::Iterator it; |
2118 | for ( it = list.begin(); it != list.end(); ++it ) { | 2219 | for ( it = list.begin(); it != list.end(); ++it ) { |
2119 | 2220 | ||
2120 | if ( (*it).removeVoice() ) | 2221 | if ( (*it).removeVoice() ) |
2121 | contactModified((*it) ); | 2222 | contactModified((*it) ); |
2122 | } | 2223 | } |
2123 | } | 2224 | } |
2124 | 2225 | ||
2125 | 2226 | ||
2126 | 2227 | ||
2127 | void KABCore::clipboardDataChanged() | 2228 | void KABCore::clipboardDataChanged() |
2128 | { | 2229 | { |
2129 | 2230 | ||
2130 | if ( mReadWrite ) | 2231 | if ( mReadWrite ) |
2131 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2232 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2132 | 2233 | ||
2133 | } | 2234 | } |
2134 | 2235 | ||
2135 | void KABCore::updateActionMenu() | 2236 | void KABCore::updateActionMenu() |
2136 | { | 2237 | { |
2137 | UndoStack *undo = UndoStack::instance(); | 2238 | UndoStack *undo = UndoStack::instance(); |
2138 | RedoStack *redo = RedoStack::instance(); | 2239 | RedoStack *redo = RedoStack::instance(); |
2139 | 2240 | ||
2140 | if ( undo->isEmpty() ) | 2241 | if ( undo->isEmpty() ) |
2141 | mActionUndo->setText( i18n( "Undo" ) ); | 2242 | mActionUndo->setText( i18n( "Undo" ) ); |
2142 | else | 2243 | else |
2143 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2244 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2144 | 2245 | ||
2145 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2246 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2146 | 2247 | ||
2147 | if ( !redo->top() ) | 2248 | if ( !redo->top() ) |
2148 | mActionRedo->setText( i18n( "Redo" ) ); | 2249 | mActionRedo->setText( i18n( "Redo" ) ); |
2149 | else | 2250 | else |
2150 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2251 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2151 | 2252 | ||
2152 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2253 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2153 | } | 2254 | } |
2154 | 2255 | ||
2155 | void KABCore::configureKeyBindings() | 2256 | void KABCore::configureKeyBindings() |
2156 | { | 2257 | { |
2157 | #ifndef KAB_EMBEDDED | 2258 | #ifndef KAB_EMBEDDED |
2158 | KKeyDialog::configure( actionCollection(), true ); | 2259 | KKeyDialog::configure( actionCollection(), true ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index bf5398b..d2ee45d 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -199,96 +199,97 @@ class KABCore : public QWidget, public KSyncInterface | |||
199 | void selectAllContacts(); | 199 | void selectAllContacts(); |
200 | 200 | ||
201 | /** | 201 | /** |
202 | Deletes all selected contacts from the address book. | 202 | Deletes all selected contacts from the address book. |
203 | */ | 203 | */ |
204 | void deleteContacts(); | 204 | void deleteContacts(); |
205 | 205 | ||
206 | /** | 206 | /** |
207 | Deletes given contacts from the address book. | 207 | Deletes given contacts from the address book. |
208 | 208 | ||
209 | @param uids The uids of the contacts, which shall be deleted. | 209 | @param uids The uids of the contacts, which shall be deleted. |
210 | */ | 210 | */ |
211 | void deleteContacts( const QStringList &uids ); | 211 | void deleteContacts( const QStringList &uids ); |
212 | 212 | ||
213 | /** | 213 | /** |
214 | Copys the selected contacts into clipboard for later pasting. | 214 | Copys the selected contacts into clipboard for later pasting. |
215 | */ | 215 | */ |
216 | void copyContacts(); | 216 | void copyContacts(); |
217 | 217 | ||
218 | /** | 218 | /** |
219 | Cuts the selected contacts and stores them for later pasting. | 219 | Cuts the selected contacts and stores them for later pasting. |
220 | */ | 220 | */ |
221 | void cutContacts(); | 221 | void cutContacts(); |
222 | 222 | ||
223 | /** | 223 | /** |
224 | Paste contacts from clipboard into the address book. | 224 | Paste contacts from clipboard into the address book. |
225 | */ | 225 | */ |
226 | void pasteContacts(); | 226 | void pasteContacts(); |
227 | 227 | ||
228 | /** | 228 | /** |
229 | Paste given contacts into the address book. | 229 | Paste given contacts into the address book. |
230 | 230 | ||
231 | @param list The list of addressee, which shall be pasted. | 231 | @param list The list of addressee, which shall be pasted. |
232 | */ | 232 | */ |
233 | void pasteContacts( KABC::Addressee::List &list ); | 233 | void pasteContacts( KABC::Addressee::List &list ); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | Sets the whoAmI contact, that is used by many other programs to | 236 | Sets the whoAmI contact, that is used by many other programs to |
237 | get personal information about the current user. | 237 | get personal information about the current user. |
238 | */ | 238 | */ |
239 | void setWhoAmI(); | 239 | void setWhoAmI(); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | Displays the category dialog and applies the result to all | 242 | Displays the category dialog and applies the result to all |
243 | selected contacts. | 243 | selected contacts. |
244 | */ | 244 | */ |
245 | void setCategories(); | 245 | void setCategories(); |
246 | void manageCategories(); | 246 | void manageCategories(); |
247 | void editCategories(); | ||
247 | 248 | ||
248 | /** | 249 | /** |
249 | Sets the field list of the Incremental Search Widget. | 250 | Sets the field list of the Incremental Search Widget. |
250 | */ | 251 | */ |
251 | void setSearchFields( const KABC::Field::List &fields ); | 252 | void setSearchFields( const KABC::Field::List &fields ); |
252 | 253 | ||
253 | /** | 254 | /** |
254 | Search with the current search field for a contact, that matches | 255 | Search with the current search field for a contact, that matches |
255 | the given text, and selects it in the view. | 256 | the given text, and selects it in the view. |
256 | */ | 257 | */ |
257 | void incrementalSearch( const QString& text ); | 258 | void incrementalSearch( const QString& text ); |
258 | 259 | ||
259 | /** | 260 | /** |
260 | Marks the address book as modified. | 261 | Marks the address book as modified. |
261 | */ | 262 | */ |
262 | void setModified(); | 263 | void setModified(); |
263 | /** | 264 | /** |
264 | Marks the address book as modified without refreshing the view. | 265 | Marks the address book as modified without refreshing the view. |
265 | */ | 266 | */ |
266 | void setModifiedWOrefresh(); | 267 | void setModifiedWOrefresh(); |
267 | 268 | ||
268 | /** | 269 | /** |
269 | Marks the address book as modified concerning the argument. | 270 | Marks the address book as modified concerning the argument. |
270 | */ | 271 | */ |
271 | void setModified( bool modified ); | 272 | void setModified( bool modified ); |
272 | 273 | ||
273 | /** | 274 | /** |
274 | Returns whether the address book is modified. | 275 | Returns whether the address book is modified. |
275 | */ | 276 | */ |
276 | bool modified() const; | 277 | bool modified() const; |
277 | 278 | ||
278 | /** | 279 | /** |
279 | Called whenever an contact is modified in the contact editor | 280 | Called whenever an contact is modified in the contact editor |
280 | dialog or the quick edit. | 281 | dialog or the quick edit. |
281 | */ | 282 | */ |
282 | void contactModified( const KABC::Addressee &addr ); | 283 | void contactModified( const KABC::Addressee &addr ); |
283 | 284 | ||
284 | /** | 285 | /** |
285 | DCOP METHODS. | 286 | DCOP METHODS. |
286 | */ | 287 | */ |
287 | void addEmail( QString addr ); | 288 | void addEmail( QString addr ); |
288 | void importVCard( const KURL& url, bool showPreview ); | 289 | void importVCard( const KURL& url, bool showPreview ); |
289 | void importVCard( const QString& vCard, bool showPreview ); | 290 | void importVCard( const QString& vCard, bool showPreview ); |
290 | void newContact(); | 291 | void newContact(); |
291 | QString getNameByPhone( const QString& phone ); | 292 | QString getNameByPhone( const QString& phone ); |
292 | /** | 293 | /** |
293 | END DCOP METHODS | 294 | END DCOP METHODS |
294 | */ | 295 | */ |
@@ -407,96 +408,97 @@ class KABCore : public QWidget, public KSyncInterface | |||
407 | ExtensionManager *mExtensionManager; | 408 | ExtensionManager *mExtensionManager; |
408 | 409 | ||
409 | KCMultiDialog *mConfigureDialog; | 410 | KCMultiDialog *mConfigureDialog; |
410 | 411 | ||
411 | #ifndef KAB_EMBEDDED | 412 | #ifndef KAB_EMBEDDED |
412 | LDAPSearchDialog *mLdapSearchDialog; | 413 | LDAPSearchDialog *mLdapSearchDialog; |
413 | #endif //KAB_EMBEDDED | 414 | #endif //KAB_EMBEDDED |
414 | // QDict<AddresseeEditorDialog> mEditorDict; | 415 | // QDict<AddresseeEditorDialog> mEditorDict; |
415 | AddresseeEditorDialog *mEditorDialog; | 416 | AddresseeEditorDialog *mEditorDialog; |
416 | bool mReadWrite; | 417 | bool mReadWrite; |
417 | bool mModified; | 418 | bool mModified; |
418 | bool mIsPart; | 419 | bool mIsPart; |
419 | bool mMultipleViewsAtOnce; | 420 | bool mMultipleViewsAtOnce; |
420 | 421 | ||
421 | 422 | ||
422 | //US file menu | 423 | //US file menu |
423 | KAction *mActionMail; | 424 | KAction *mActionMail; |
424 | KAction *mActionBeam; | 425 | KAction *mActionBeam; |
425 | KToggleAction *mActionBR; | 426 | KToggleAction *mActionBR; |
426 | KAction *mActionExport2phone; | 427 | KAction *mActionExport2phone; |
427 | KAction* mActionPrint; | 428 | KAction* mActionPrint; |
428 | KAction* mActionNewContact; | 429 | KAction* mActionNewContact; |
429 | KAction *mActionSave; | 430 | KAction *mActionSave; |
430 | KAction *mActionEditAddressee; | 431 | KAction *mActionEditAddressee; |
431 | KAction *mActionMailVCard; | 432 | KAction *mActionMailVCard; |
432 | KAction *mActionBeamVCard; | 433 | KAction *mActionBeamVCard; |
433 | 434 | ||
434 | KAction *mActionQuit; | 435 | KAction *mActionQuit; |
435 | 436 | ||
436 | //US edit menu | 437 | //US edit menu |
437 | KAction *mActionCopy; | 438 | KAction *mActionCopy; |
438 | KAction *mActionCut; | 439 | KAction *mActionCut; |
439 | KAction *mActionPaste; | 440 | KAction *mActionPaste; |
440 | KAction *mActionSelectAll; | 441 | KAction *mActionSelectAll; |
441 | KAction *mActionUndo; | 442 | KAction *mActionUndo; |
442 | KAction *mActionRedo; | 443 | KAction *mActionRedo; |
443 | KAction *mActionDelete; | 444 | KAction *mActionDelete; |
444 | 445 | ||
445 | //US settings menu | 446 | //US settings menu |
446 | KAction *mActionConfigResources; | 447 | KAction *mActionConfigResources; |
447 | KAction *mActionConfigKAddressbook; | 448 | KAction *mActionConfigKAddressbook; |
448 | KAction *mActionConfigShortcuts; | 449 | KAction *mActionConfigShortcuts; |
449 | KAction *mActionConfigureToolbars; | 450 | KAction *mActionConfigureToolbars; |
450 | KAction *mActionKeyBindings; | 451 | KAction *mActionKeyBindings; |
451 | KToggleAction *mActionJumpBar; | 452 | KToggleAction *mActionJumpBar; |
452 | KToggleAction *mActionDetails; | 453 | KToggleAction *mActionDetails; |
453 | KAction *mActionWhoAmI; | 454 | KAction *mActionWhoAmI; |
454 | KAction *mActionCategories; | 455 | KAction *mActionCategories; |
456 | KAction *mActionEditCategories; | ||
455 | KAction *mActionManageCategories; | 457 | KAction *mActionManageCategories; |
456 | KAction *mActionAboutKAddressbook; | 458 | KAction *mActionAboutKAddressbook; |
457 | KAction *mActionLicence; | 459 | KAction *mActionLicence; |
458 | KAction *mActionFaq; | 460 | KAction *mActionFaq; |
459 | KAction *mActionWN; | 461 | KAction *mActionWN; |
460 | KAction *mActionSyncHowto; | 462 | KAction *mActionSyncHowto; |
461 | KAction *mActionKdeSyncHowto; | 463 | KAction *mActionKdeSyncHowto; |
462 | KAction *mActionMultiSyncHowto; | 464 | KAction *mActionMultiSyncHowto; |
463 | 465 | ||
464 | KAction *mActionDeleteView; | 466 | KAction *mActionDeleteView; |
465 | 467 | ||
466 | QPopupMenu *viewMenu; | 468 | QPopupMenu *viewMenu; |
467 | QPopupMenu *filterMenu; | 469 | QPopupMenu *filterMenu; |
468 | QPopupMenu *settingsMenu; | 470 | QPopupMenu *settingsMenu; |
469 | QPopupMenu *changeMenu; | 471 | QPopupMenu *changeMenu; |
470 | //US QAction *mActionSave; | 472 | //US QAction *mActionSave; |
471 | QPopupMenu *ImportMenu; | 473 | QPopupMenu *ImportMenu; |
472 | QPopupMenu *ExportMenu; | 474 | QPopupMenu *ExportMenu; |
473 | //LR additional methods | 475 | //LR additional methods |
474 | KAction *mActionRemoveVoice; | 476 | KAction *mActionRemoveVoice; |
475 | KAction * mActionImportOL; | 477 | KAction * mActionImportOL; |
476 | 478 | ||
477 | #ifndef KAB_EMBEDDED | 479 | #ifndef KAB_EMBEDDED |
478 | KAddressBookService *mAddressBookService; | 480 | KAddressBookService *mAddressBookService; |
479 | #endif //KAB_EMBEDDED | 481 | #endif //KAB_EMBEDDED |
480 | 482 | ||
481 | class KABCorePrivate; | 483 | class KABCorePrivate; |
482 | KABCorePrivate *d; | 484 | KABCorePrivate *d; |
483 | //US bool mBlockSaveFlag; | 485 | //US bool mBlockSaveFlag; |
484 | 486 | ||
485 | #ifdef KAB_EMBEDDED | 487 | #ifdef KAB_EMBEDDED |
486 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 488 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
487 | #endif //KAB_EMBEDDED | 489 | #endif //KAB_EMBEDDED |
488 | 490 | ||
489 | //this are the overwritten callbackmethods from the syncinterface | 491 | //this are the overwritten callbackmethods from the syncinterface |
490 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 492 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
491 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 493 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
492 | virtual void removeSyncInfo( QString syncProfile); | 494 | virtual void removeSyncInfo( QString syncProfile); |
493 | bool syncPhone(); | 495 | bool syncPhone(); |
494 | void message( QString m ); | 496 | void message( QString m ); |
495 | 497 | ||
496 | // LR ******************************* | 498 | // LR ******************************* |
497 | // sync stuff! | 499 | // sync stuff! |
498 | QString sentSyncFile(); | 500 | QString sentSyncFile(); |
499 | QPopupMenu *syncMenu; | 501 | QPopupMenu *syncMenu; |
500 | KSyncManager* syncManager; | 502 | KSyncManager* syncManager; |
501 | int mGlobalSyncMode; | 503 | int mGlobalSyncMode; |
502 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 504 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |