summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-30 01:46:35 (UTC)
committer zautrix <zautrix>2004-10-30 01:46:35 (UTC)
commit6c755a7a8a1e9d9a747267eadf914a6030c9b711 (patch) (unidiff)
tree14b1b8ed39f50683f095ca5fb7656abd3326854e
parentc477fa8ba7eacfaba3d154a72153acc7bc46abdc (diff)
downloadkdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.zip
kdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.tar.gz
kdepimpi-6c755a7a8a1e9d9a747267eadf914a6030c9b711.tar.bz2
better cat management in kapi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp107
-rw-r--r--kaddressbook/kabcore.h2
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
@@ -38,220 +38,258 @@ $Id$
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qcheckbox.h> 40#include <qcheckbox.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qprogressbar.h> 42#include <qprogressbar.h>
43#include <libkdepim/phoneaccess.h> 43#include <libkdepim/phoneaccess.h>
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46#include <qclipboard.h> 46#include <qclipboard.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qfile.h> 48#include <qfile.h>
49#include <qapplicaton.h> 49#include <qapplicaton.h>
50#include <qprogressbar.h> 50#include <qprogressbar.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qregexp.h> 52#include <qregexp.h>
53#include <qvbox.h> 53#include <qvbox.h>
54#include <kabc/addresseelist.h> 54#include <kabc/addresseelist.h>
55#include <kabc/errorhandler.h> 55#include <kabc/errorhandler.h>
56#include <kabc/resource.h> 56#include <kabc/resource.h>
57#include <kabc/vcardconverter.h> 57#include <kabc/vcardconverter.h>
58#include <kapplication.h> 58#include <kapplication.h>
59#include <kactionclasses.h> 59#include <kactionclasses.h>
60#include <kcmultidialog.h> 60#include <kcmultidialog.h>
61#include <kdebug.h> 61#include <kdebug.h>
62#include <kdeversion.h> 62#include <kdeversion.h>
63#include <kkeydialog.h> 63#include <kkeydialog.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kprinter.h> 65#include <kprinter.h>
66#include <kprotocolinfo.h> 66#include <kprotocolinfo.h>
67#include <kresources/selectdialog.h> 67#include <kresources/selectdialog.h>
68#include <kstandarddirs.h> 68#include <kstandarddirs.h>
69#include <ktempfile.h> 69#include <ktempfile.h>
70#include <kxmlguiclient.h> 70#include <kxmlguiclient.h>
71#include <kaboutdata.h> 71#include <kaboutdata.h>
72#include <libkdepim/categoryselectdialog.h> 72#include <libkdepim/categoryselectdialog.h>
73 73
74#include "addresseeutil.h" 74#include "addresseeutil.h"
75#include "addresseeeditordialog.h" 75#include "addresseeeditordialog.h"
76#include "extensionmanager.h" 76#include "extensionmanager.h"
77#include "kstdaction.h" 77#include "kstdaction.h"
78#include "kaddressbookservice.h" 78#include "kaddressbookservice.h"
79#include "ldapsearchdialog.h" 79#include "ldapsearchdialog.h"
80#include "printing/printingwizard.h" 80#include "printing/printingwizard.h"
81#else // KAB_EMBEDDED 81#else // KAB_EMBEDDED
82 82
83#include <kapplication.h> 83#include <kapplication.h>
84#include "KDGanttMinimizeSplitter.h" 84#include "KDGanttMinimizeSplitter.h"
85#include "kaddressbookmain.h" 85#include "kaddressbookmain.h"
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
166class 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(); }
194private:
195 QRadioButton* addCatBut;
196};
197
198
199
162class KAex2phonePrefs : public QDialog 200class 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
202public: 240public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 241 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 242 QCheckBox* mWriteToSim;
205}; 243};
206 244
207 245
208bool pasteWithNewUid = true; 246bool pasteWithNewUid = true;
209 247
210#ifdef KAB_EMBEDDED 248#ifdef KAB_EMBEDDED
211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 249KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 250 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 251 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 252 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
215#else //KAB_EMBEDDED 253#else //KAB_EMBEDDED
216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 254KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 255 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 256 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
219 mReadWrite( readWrite ), mModified( false ) 257 mReadWrite( readWrite ), mModified( false )
220#endif //KAB_EMBEDDED 258#endif //KAB_EMBEDDED
221{ 259{
222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 260 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
223 // syncManager->setBlockSave(false); 261 // syncManager->setBlockSave(false);
224 mExtensionBarSplitter = 0; 262 mExtensionBarSplitter = 0;
225 mIsPart = !parent->inherits( "KAddressBookMain" ); 263 mIsPart = !parent->inherits( "KAddressBookMain" );
226 mAddressBook = KABC::StdAddressBook::self(); 264 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 265 KABC::StdAddressBook::setAutomaticSave( false );
228 266
229#ifndef KAB_EMBEDDED 267#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 268 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 269#endif //KAB_EMBEDDED
232 270
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 271 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 272 SLOT( addressBookChanged() ) );
235 273
236#if 0 274#if 0
237 // LP moved to addressbook init method 275 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 276 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 277 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 278 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 279 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 280 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 281 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 282 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 283 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 284 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 285 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 286 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 287 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 288 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 289 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 290 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 291 "X-Anniversary", "KADDRESSBOOK" );
254 292
255 //US added this field to become compatible with Opie/qtopia addressbook 293 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 294 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 295 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
@@ -863,225 +901,228 @@ void KABCore::beamDone( Ir *ir )
863 901
864void KABCore::browse( const QString& url ) 902void KABCore::browse( const QString& url )
865{ 903{
866#ifndef KAB_EMBEDDED 904#ifndef KAB_EMBEDDED
867 kapp->invokeBrowser( url ); 905 kapp->invokeBrowser( url );
868#else //KAB_EMBEDDED 906#else //KAB_EMBEDDED
869 qDebug("KABCore::browse must be fixed"); 907 qDebug("KABCore::browse must be fixed");
870#endif //KAB_EMBEDDED 908#endif //KAB_EMBEDDED
871} 909}
872 910
873void KABCore::selectAllContacts() 911void KABCore::selectAllContacts()
874{ 912{
875 mViewManager->setSelected( QString::null, true ); 913 mViewManager->setSelected( QString::null, true );
876} 914}
877 915
878void KABCore::deleteContacts() 916void KABCore::deleteContacts()
879{ 917{
880 QStringList uidList = mViewManager->selectedUids(); 918 QStringList uidList = mViewManager->selectedUids();
881 deleteContacts( uidList ); 919 deleteContacts( uidList );
882} 920}
883 921
884void KABCore::deleteContacts( const QStringList &uids ) 922void KABCore::deleteContacts( const QStringList &uids )
885{ 923{
886 if ( uids.count() > 0 ) { 924 if ( uids.count() > 0 ) {
887 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 925 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
888 UndoStack::instance()->push( command ); 926 UndoStack::instance()->push( command );
889 RedoStack::instance()->clear(); 927 RedoStack::instance()->clear();
890 928
891 // now if we deleted anything, refresh 929 // now if we deleted anything, refresh
892 setContactSelected( QString::null ); 930 setContactSelected( QString::null );
893 setModified( true ); 931 setModified( true );
894 } 932 }
895} 933}
896 934
897void KABCore::copyContacts() 935void KABCore::copyContacts()
898{ 936{
899 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 937 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
900 938
901 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 939 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
902 940
903 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 941 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
904 942
905 QClipboard *cb = QApplication::clipboard(); 943 QClipboard *cb = QApplication::clipboard();
906 cb->setText( clipText ); 944 cb->setText( clipText );
907} 945}
908 946
909void KABCore::cutContacts() 947void KABCore::cutContacts()
910{ 948{
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
923void KABCore::pasteContacts() 961void 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
932void KABCore::pasteContacts( KABC::Addressee::List &list ) 970void 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
946void KABCore::setWhoAmI() 984void 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 997void KABCore::editCategories()
998{
999 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1000 dlg.exec();
1001}
960void KABCore::setCategories() 1002void 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
1001void KABCore::setSearchFields( const KABC::Field::List &fields ) 1042void KABCore::setSearchFields( const KABC::Field::List &fields )
1002{ 1043{
1003 mIncSearchWidget->setFields( fields ); 1044 mIncSearchWidget->setFields( fields );
1004} 1045}
1005 1046
1006void KABCore::incrementalSearch( const QString& text ) 1047void KABCore::incrementalSearch( const QString& text )
1007{ 1048{
1008 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1049 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1009} 1050}
1010 1051
1011void KABCore::setModified() 1052void KABCore::setModified()
1012{ 1053{
1013 setModified( true ); 1054 setModified( true );
1014} 1055}
1015 1056
1016void KABCore::setModifiedWOrefresh() 1057void 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}
1026void KABCore::setModified( bool modified ) 1067void 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
1039bool KABCore::modified() const 1080bool KABCore::modified() const
1040{ 1081{
1041 return mModified; 1082 return mModified;
1042} 1083}
1043 1084
1044void KABCore::contactModified( const KABC::Addressee &addr ) 1085void KABCore::contactModified( const KABC::Addressee &addr )
1045{ 1086{
1046 1087
1047 Command *command = 0; 1088 Command *command = 0;
1048 QString uid; 1089 QString uid;
1049 1090
1050 // check if it exists already 1091 // check if it exists already
1051 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1092 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1052 if ( origAddr.isEmpty() ) 1093 if ( origAddr.isEmpty() )
1053 command = new PwNewCommand( mAddressBook, addr ); 1094 command = new PwNewCommand( mAddressBook, addr );
1054 else { 1095 else {
1055 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1096 command = new PwEditCommand( mAddressBook, origAddr, addr );
1056 uid = addr.uid(); 1097 uid = addr.uid();
1057 } 1098 }
1058 1099
1059 UndoStack::instance()->push( command ); 1100 UndoStack::instance()->push( command );
1060 RedoStack::instance()->clear(); 1101 RedoStack::instance()->clear();
1061 1102
1062 setModified( true ); 1103 setModified( true );
1063} 1104}
1064 1105
1065void KABCore::newContact() 1106void KABCore::newContact()
1066{ 1107{
1067 1108
1068 1109
1069 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1110 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1070 1111
1071 QPtrList<KRES::Resource> kresResources; 1112 QPtrList<KRES::Resource> kresResources;
1072 QPtrListIterator<KABC::Resource> it( kabcResources ); 1113 QPtrListIterator<KABC::Resource> it( kabcResources );
1073 KABC::Resource *resource; 1114 KABC::Resource *resource;
1074 while ( ( resource = it.current() ) != 0 ) { 1115 while ( ( resource = it.current() ) != 0 ) {
1075 ++it; 1116 ++it;
1076 if ( !resource->readOnly() ) { 1117 if ( !resource->readOnly() ) {
1077 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1118 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1078 if ( res ) 1119 if ( res )
1079 kresResources.append( res ); 1120 kresResources.append( res );
1080 } 1121 }
1081 } 1122 }
1082 1123
1083 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1124 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1084 resource = static_cast<KABC::Resource*>( res ); 1125 resource = static_cast<KABC::Resource*>( res );
1085 1126
1086 if ( resource ) { 1127 if ( resource ) {
1087 KABC::Addressee addr; 1128 KABC::Addressee addr;
@@ -1789,418 +1830,478 @@ void KABCore::initActions()
1789 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1830 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1790 SLOT( cutContacts() ), actionCollection(), 1831 SLOT( cutContacts() ), actionCollection(),
1791 "kaddressbook_cut" ); 1832 "kaddressbook_cut" );
1792 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1833 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1793 SLOT( pasteContacts() ), actionCollection(), 1834 SLOT( pasteContacts() ), actionCollection(),
1794 "kaddressbook_paste" ); 1835 "kaddressbook_paste" );
1795 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1836 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1796 SLOT( selectAllContacts() ), actionCollection(), 1837 SLOT( selectAllContacts() ), actionCollection(),
1797 "kaddressbook_select_all" ); 1838 "kaddressbook_select_all" );
1798 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1839 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1799 SLOT( undo() ), actionCollection(), 1840 SLOT( undo() ), actionCollection(),
1800 "kaddressbook_undo" ); 1841 "kaddressbook_undo" );
1801 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1842 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1802 this, SLOT( redo() ), actionCollection(), 1843 this, SLOT( redo() ), actionCollection(),
1803 "kaddressbook_redo" ); 1844 "kaddressbook_redo" );
1804 } else { 1845 } else {
1805 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1846 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1806 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1847 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1807 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1848 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1808 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1849 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1809 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1850 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1810 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1851 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1811 } 1852 }
1812 1853
1813 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1854 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1814 Key_Delete, this, SLOT( deleteContacts() ), 1855 Key_Delete, this, SLOT( deleteContacts() ),
1815 actionCollection(), "edit_delete" ); 1856 actionCollection(), "edit_delete" );
1816 1857
1817 mActionUndo->setEnabled( false ); 1858 mActionUndo->setEnabled( false );
1818 mActionRedo->setEnabled( false ); 1859 mActionRedo->setEnabled( false );
1819 1860
1820 // settings menu 1861 // settings menu
1821#ifdef KAB_EMBEDDED 1862#ifdef KAB_EMBEDDED
1822//US special menuentry to configure the addressbook resources. On KDE 1863//US special menuentry to configure the addressbook resources. On KDE
1823// you do that through the control center !!! 1864// you do that through the control center !!!
1824 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1865 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1825 SLOT( configureResources() ), actionCollection(), 1866 SLOT( configureResources() ), actionCollection(),
1826 "kaddressbook_configure_resources" ); 1867 "kaddressbook_configure_resources" );
1827#endif //KAB_EMBEDDED 1868#endif //KAB_EMBEDDED
1828 1869
1829 if ( mIsPart ) { 1870 if ( mIsPart ) {
1830 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1871 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1831 SLOT( openConfigDialog() ), actionCollection(), 1872 SLOT( openConfigDialog() ), actionCollection(),
1832 "kaddressbook_configure" ); 1873 "kaddressbook_configure" );
1833 1874
1834 //US not implemented yet 1875 //US not implemented yet
1835 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1876 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1836 // this, SLOT( configureKeyBindings() ), actionCollection(), 1877 // this, SLOT( configureKeyBindings() ), actionCollection(),
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.
1930void KABCore::addActionsManually() 1974void KABCore::addActionsManually()
1931{ 1975{
1932//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1976//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1933 1977
1934#ifdef KAB_EMBEDDED 1978#ifdef KAB_EMBEDDED
1935 QPopupMenu *fileMenu = new QPopupMenu( this ); 1979 QPopupMenu *fileMenu = new QPopupMenu( this );
1936 QPopupMenu *editMenu = new QPopupMenu( this ); 1980 QPopupMenu *editMenu = new QPopupMenu( this );
1937 QPopupMenu *helpMenu = new QPopupMenu( this ); 1981 QPopupMenu *helpMenu = new QPopupMenu( this );
1938 1982
1939 KToolBar* tb = mMainWindow->toolBar(); 1983 KToolBar* tb = mMainWindow->toolBar();
1940 1984
1941#ifndef DESKTOP_VERSION 1985#ifndef DESKTOP_VERSION
1942 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 1986 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
1943#endif 1987#endif
1944 QMenuBar* mb = mMainWindow->menuBar(); 1988 QMenuBar* mb = mMainWindow->menuBar();
1945 1989
1946 //US setup menubar. 1990 //US setup menubar.
1947 //Disable the following block if you do not want to have a menubar. 1991 //Disable the following block if you do not want to have a menubar.
1948 mb->insertItem( "&File", fileMenu ); 1992 mb->insertItem( "&File", fileMenu );
1949 mb->insertItem( "&Edit", editMenu ); 1993 mb->insertItem( "&Edit", editMenu );
1950 mb->insertItem( "&View", viewMenu ); 1994 mb->insertItem( "&View", viewMenu );
1951 mb->insertItem( "&Settings", settingsMenu ); 1995 mb->insertItem( "&Settings", settingsMenu );
1952 mb->insertItem( i18n("Synchronize"), syncMenu ); 1996 mb->insertItem( i18n("Synchronize"), syncMenu );
1953 mb->insertItem( "&Change selected", changeMenu ); 1997 mb->insertItem( "&Change selected", changeMenu );
1954 mb->insertItem( "&Help", helpMenu ); 1998 mb->insertItem( "&Help", helpMenu );
1955 mIncSearchWidget = new IncSearchWidget( tb ); 1999 mIncSearchWidget = new IncSearchWidget( tb );
1956 // tb->insertWidget(-1, 0, mIncSearchWidget); 2000 // tb->insertWidget(-1, 0, mIncSearchWidget);
1957#ifndef DESKTOP_VERSION 2001#ifndef DESKTOP_VERSION
1958 } else { 2002 } else {
1959 //US setup toolbar 2003 //US setup toolbar
1960 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2004 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
1961 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2005 QPopupMenu *popupBarTB = new QPopupMenu( this );
1962 menuBarTB->insertItem( "ME", popupBarTB); 2006 menuBarTB->insertItem( "ME", popupBarTB);
1963 tb->insertWidget(-1, 0, menuBarTB); 2007 tb->insertWidget(-1, 0, menuBarTB);
1964 mIncSearchWidget = new IncSearchWidget( tb ); 2008 mIncSearchWidget = new IncSearchWidget( tb );
1965 2009
1966 tb->enableMoving(false); 2010 tb->enableMoving(false);
1967 popupBarTB->insertItem( "&File", fileMenu ); 2011 popupBarTB->insertItem( "&File", fileMenu );
1968 popupBarTB->insertItem( "&Edit", editMenu ); 2012 popupBarTB->insertItem( "&Edit", editMenu );
1969 popupBarTB->insertItem( "&View", viewMenu ); 2013 popupBarTB->insertItem( "&View", viewMenu );
1970 popupBarTB->insertItem( "&Settings", settingsMenu ); 2014 popupBarTB->insertItem( "&Settings", settingsMenu );
1971 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2015 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
1972 mViewManager->getFilterAction()->plug ( popupBarTB); 2016 mViewManager->getFilterAction()->plug ( popupBarTB);
1973 popupBarTB->insertItem( "&Change selected", changeMenu ); 2017 popupBarTB->insertItem( "&Change selected", changeMenu );
1974 popupBarTB->insertItem( "&Help", helpMenu ); 2018 popupBarTB->insertItem( "&Help", helpMenu );
1975 if (QApplication::desktop()->width() > 320 ) { 2019 if (QApplication::desktop()->width() > 320 ) {
1976 // mViewManager->getFilterAction()->plug ( tb); 2020 // mViewManager->getFilterAction()->plug ( tb);
1977 } 2021 }
1978 } 2022 }
1979#endif 2023#endif
1980 // mActionQuit->plug ( mMainWindow->toolBar()); 2024 // mActionQuit->plug ( mMainWindow->toolBar());
1981 2025
1982 2026
1983 2027
1984 //US Now connect the actions with the menue entries. 2028 //US Now connect the actions with the menue entries.
1985 mActionPrint->plug( fileMenu ); 2029 mActionPrint->plug( fileMenu );
1986 mActionMail->plug( fileMenu ); 2030 mActionMail->plug( fileMenu );
1987 fileMenu->insertSeparator(); 2031 fileMenu->insertSeparator();
1988 2032
1989 mActionNewContact->plug( fileMenu ); 2033 mActionNewContact->plug( fileMenu );
1990 mActionNewContact->plug( tb ); 2034 mActionNewContact->plug( tb );
1991 2035
1992 mActionEditAddressee->plug( fileMenu ); 2036 mActionEditAddressee->plug( fileMenu );
1993 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2037 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
1994 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2038 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
1995 mActionEditAddressee->plug( tb ); 2039 mActionEditAddressee->plug( tb );
1996 2040
1997 fileMenu->insertSeparator(); 2041 fileMenu->insertSeparator();
1998 mActionSave->plug( fileMenu ); 2042 mActionSave->plug( fileMenu );
1999 fileMenu->insertItem( "&Import", ImportMenu ); 2043 fileMenu->insertItem( "&Import", ImportMenu );
2000 fileMenu->insertItem( "&Export", ExportMenu ); 2044 fileMenu->insertItem( "&Export", ExportMenu );
2001 fileMenu->insertSeparator(); 2045 fileMenu->insertSeparator();
2002 mActionMailVCard->plug( fileMenu ); 2046 mActionMailVCard->plug( fileMenu );
2003#ifndef DESKTOP_VERSION 2047#ifndef DESKTOP_VERSION
2004 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2048 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
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}
2103void KABCore::showLicence() 2148void KABCore::showLicence()
2104{ 2149{
2105 KApplication::showLicence(); 2150 KApplication::showLicence();
2106} 2151}
2107 2152
2108void KABCore::manageCategories( ) 2153void 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}
2112void KABCore::removeVoice() 2213void 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
2127void KABCore::clipboardDataChanged() 2228void 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
2135void KABCore::updateActionMenu() 2236void 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
2155void KABCore::configureKeyBindings() 2256void KABCore::configureKeyBindings()
2156{ 2257{
2157#ifndef KAB_EMBEDDED 2258#ifndef KAB_EMBEDDED
2158 KKeyDialog::configure( actionCollection(), true ); 2259 KKeyDialog::configure( actionCollection(), true );
2159#else //KAB_EMBEDDED 2260#else //KAB_EMBEDDED
2160 qDebug("KABCore::configureKeyBindings() not implemented"); 2261 qDebug("KABCore::configureKeyBindings() not implemented");
2161#endif //KAB_EMBEDDED 2262#endif //KAB_EMBEDDED
2162} 2263}
2163 2264
2164#ifdef KAB_EMBEDDED 2265#ifdef KAB_EMBEDDED
2165void KABCore::configureResources() 2266void KABCore::configureResources()
2166{ 2267{
2167 KRES::KCMKResources dlg( this, "" , 0 ); 2268 KRES::KCMKResources dlg( this, "" , 0 );
2168 2269
2169 if ( !dlg.exec() ) 2270 if ( !dlg.exec() )
2170 return; 2271 return;
2171 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2272 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2172} 2273}
2173#endif //KAB_EMBEDDED 2274#endif //KAB_EMBEDDED
2174 2275
2175 2276
2176/* this method will be called through the QCop interface from Ko/Pi to select addresses 2277/* this method will be called through the QCop interface from Ko/Pi to select addresses
2177 * for the attendees list of an event. 2278 * for the attendees list of an event.
2178 */ 2279 */
2179void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2280void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2180{ 2281{
2181 QStringList nameList; 2282 QStringList nameList;
2182 QStringList emailList; 2283 QStringList emailList;
2183 QStringList uidList; 2284 QStringList uidList;
2184 2285
2185 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2286 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2186 uint i=0; 2287 uint i=0;
2187 for (i=0; i < list.count(); i++) 2288 for (i=0; i < list.count(); i++)
2188 { 2289 {
2189 nameList.append(list[i].realName()); 2290 nameList.append(list[i].realName());
2190 emailList.append(list[i].preferredEmail()); 2291 emailList.append(list[i].preferredEmail());
2191 uidList.append(list[i].uid()); 2292 uidList.append(list[i].uid());
2192 } 2293 }
2193 2294
2194 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2295 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2195 2296
2196} 2297}
2197 2298
2198/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2299/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2199 * to put them into the calendar. 2300 * to put them into the calendar.
2200 */ 2301 */
2201void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2302void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2202{ 2303{
2203 // qDebug("KABCore::requestForBirthdayList"); 2304 // qDebug("KABCore::requestForBirthdayList");
2204 QStringList birthdayList; 2305 QStringList birthdayList;
2205 QStringList anniversaryList; 2306 QStringList anniversaryList;
2206 QStringList realNameList; 2307 QStringList realNameList;
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index bf5398b..d2ee45d 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -151,192 +151,193 @@ class KABCore : public QWidget, public KSyncInterface
151 void showLicence(); 151 void showLicence();
152 void faq(); 152 void faq();
153 void whatsnew() ; 153 void whatsnew() ;
154 void synchowto() ; 154 void synchowto() ;
155 void multisynchowto() ; 155 void multisynchowto() ;
156 void kdesynchowto() ; 156 void kdesynchowto() ;
157 void writeToPhone(); 157 void writeToPhone();
158 158
159 /** 159 /**
160 Is called whenever a contact is selected in the view. 160 Is called whenever a contact is selected in the view.
161 */ 161 */
162 void setContactSelected( const QString &uid ); 162 void setContactSelected( const QString &uid );
163 163
164 /** 164 /**
165 Opens the preferred mail composer with all selected contacts as 165 Opens the preferred mail composer with all selected contacts as
166 arguments. 166 arguments.
167 */ 167 */
168 void sendMail(); 168 void sendMail();
169 169
170 /** 170 /**
171 Opens the preferred mail composer with the given contacts as 171 Opens the preferred mail composer with the given contacts as
172 arguments. 172 arguments.
173 */ 173 */
174 void sendMail( const QString& email ); 174 void sendMail( const QString& email );
175 175
176 176
177 void mailVCard(); 177 void mailVCard();
178 void mailVCard(const QStringList& uids); 178 void mailVCard(const QStringList& uids);
179 179
180 /** 180 /**
181 Beams the "WhoAmI contact. 181 Beams the "WhoAmI contact.
182 */ 182 */
183 void beamMySelf(); 183 void beamMySelf();
184 184
185 void beamVCard(); 185 void beamVCard();
186 void export2phone(); 186 void export2phone();
187 void beamVCard(const QStringList& uids); 187 void beamVCard(const QStringList& uids);
188 void beamDone( Ir *ir ); 188 void beamDone( Ir *ir );
189 189
190 190
191 /** 191 /**
192 Starts the preferred web browser with the given URL as argument. 192 Starts the preferred web browser with the given URL as argument.
193 */ 193 */
194 void browse( const QString& url ); 194 void browse( const QString& url );
195 195
196 /** 196 /**
197 Select all contacts in the view. 197 Select all contacts in the view.
198 */ 198 */
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 */
295 296
296 /** 297 /**
297 Saves the contents of the AddressBook back to disk. 298 Saves the contents of the AddressBook back to disk.
298 */ 299 */
299 void save(); 300 void save();
300 301
301 /** 302 /**
302 Undos the last command using the undo stack. 303 Undos the last command using the undo stack.
303 */ 304 */
304 void undo(); 305 void undo();
305 306
306 /** 307 /**
307 Redos the last command that was undone, using the redo stack. 308 Redos the last command that was undone, using the redo stack.
308 */ 309 */
309 void redo(); 310 void redo();
310 311
311 /** 312 /**
312 Shows the edit dialog for the given uid. If the uid is QString::null, 313 Shows the edit dialog for the given uid. If the uid is QString::null,
313 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
314 */ 315 */
315 void editContact( const QString &uid /*US = QString::null*/ ); 316 void editContact( const QString &uid /*US = QString::null*/ );
316//US added a second method without defaultparameter 317//US added a second method without defaultparameter
317 void editContact2(); 318 void editContact2();
318 319
319 /** 320 /**
320 Shows or edits the detail view for the given uid. If the uid is QString::null, 321 Shows or edits the detail view for the given uid. If the uid is QString::null,
321 the method will try to find a selected addressee in the view. 322 the method will try to find a selected addressee in the view.
322 */ 323 */
323 void executeContact( const QString &uid /*US = QString::null*/ ); 324 void executeContact( const QString &uid /*US = QString::null*/ );
324 325
325 /** 326 /**
326 Launches the configuration dialog. 327 Launches the configuration dialog.
327 */ 328 */
328 void openConfigDialog(); 329 void openConfigDialog();
329 330
330 /** 331 /**
331 Launches the ldap search dialog. 332 Launches the ldap search dialog.
332 */ 333 */
333 void openLDAPDialog(); 334 void openLDAPDialog();
334 335
335 /** 336 /**
336 Creates a KAddressBookPrinter, which will display the print 337 Creates a KAddressBookPrinter, which will display the print
337 dialog and do the printing. 338 dialog and do the printing.
338 */ 339 */
339 void print(); 340 void print();
340 341
341 /** 342 /**
342 Registers a new GUI client, so plugins can register its actions. 343 Registers a new GUI client, so plugins can register its actions.
@@ -359,152 +360,153 @@ class KABCore : public QWidget, public KSyncInterface
359 void setDetailsToState(); 360 void setDetailsToState();
360 // void slotSyncMenu( int ); 361 // void slotSyncMenu( int );
361 private slots: 362 private slots:
362 void receive( const QCString& cmsg, const QByteArray& data ); 363 void receive( const QCString& cmsg, const QByteArray& data );
363 void toggleBeamReceive( ); 364 void toggleBeamReceive( );
364 void disableBR(bool); 365 void disableBR(bool);
365 void setJumpButtonBarVisible( bool visible ); 366 void setJumpButtonBarVisible( bool visible );
366 void setCaptionBack(); 367 void setCaptionBack();
367 void importFromOL(); 368 void importFromOL();
368 void extensionModified( const KABC::Addressee::List &list ); 369 void extensionModified( const KABC::Addressee::List &list );
369 void extensionChanged( int id ); 370 void extensionChanged( int id );
370 void clipboardDataChanged(); 371 void clipboardDataChanged();
371 void updateActionMenu(); 372 void updateActionMenu();
372 void configureKeyBindings(); 373 void configureKeyBindings();
373 void removeVoice(); 374 void removeVoice();
374#ifdef KAB_EMBEDDED 375#ifdef KAB_EMBEDDED
375 void configureResources(); 376 void configureResources();
376#endif //KAB_EMBEDDED 377#endif //KAB_EMBEDDED
377 378
378 void slotEditorDestroyed( const QString &uid ); 379 void slotEditorDestroyed( const QString &uid );
379 void configurationChanged(); 380 void configurationChanged();
380 void addressBookChanged(); 381 void addressBookChanged();
381 382
382 private: 383 private:
383 bool mBRdisabled; 384 bool mBRdisabled;
384#ifndef DESKTOP_VERSION 385#ifndef DESKTOP_VERSION
385 QCopChannel* infrared; 386 QCopChannel* infrared;
386#endif 387#endif
387 QTimer *mMessageTimer; 388 QTimer *mMessageTimer;
388 void initGUI(); 389 void initGUI();
389 void initActions(); 390 void initActions();
390 QString getPhoneFile(); 391 QString getPhoneFile();
391 392
392 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 393 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
393 const char *name = 0 ); 394 const char *name = 0 );
394 395
395 KXMLGUIClient *mGUIClient; 396 KXMLGUIClient *mGUIClient;
396 397
397 KABC::AddressBook *mAddressBook; 398 KABC::AddressBook *mAddressBook;
398 399
399 ViewManager *mViewManager; 400 ViewManager *mViewManager;
400 // QSplitter *mDetailsSplitter; 401 // QSplitter *mDetailsSplitter;
401 KDGanttMinimizeSplitter *mExtensionBarSplitter; 402 KDGanttMinimizeSplitter *mExtensionBarSplitter;
402 ViewContainer *mDetails; 403 ViewContainer *mDetails;
403 KDGanttMinimizeSplitter* mMiniSplitter; 404 KDGanttMinimizeSplitter* mMiniSplitter;
404 XXPortManager *mXXPortManager; 405 XXPortManager *mXXPortManager;
405 JumpButtonBar *mJumpButtonBar; 406 JumpButtonBar *mJumpButtonBar;
406 IncSearchWidget *mIncSearchWidget; 407 IncSearchWidget *mIncSearchWidget;
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);
503 KABC::Addressee getLastSyncAddressee(); 505 KABC::Addressee getLastSyncAddressee();
504 QDateTime mLastAddressbookSync; 506 QDateTime mLastAddressbookSync;
505 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 507 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
506 // ********************* 508 // *********************
507 509
508}; 510};
509 511
510#endif 512#endif