summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-06-30 22:09:15 (UTC)
committer ulf69 <ulf69>2004-06-30 22:09:15 (UTC)
commit99cfbc59b260614905e91a841481d80c2c202c4f (patch) (unidiff)
tree9c40d61f6c4d1521301b2cf25974ca34bc2723e5
parent1b7b7755bfbedddc72293b784577ded4e684bd6f (diff)
downloadkdepimpi-99cfbc59b260614905e91a841481d80c2c202c4f.zip
kdepimpi-99cfbc59b260614905e91a841481d80c2c202c4f.tar.gz
kdepimpi-99cfbc59b260614905e91a841481d80c2c202c4f.tar.bz2
added two custom fields to be more complient with the opie addressbook:
Gender and Children.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 70ab6b7..7bf1a2f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -30,256 +30,262 @@
30#include <qclipboard.h> 30#include <qclipboard.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplicaton.h> 33#include <qapplicaton.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qvbox.h> 36#include <qvbox.h>
37#include <kabc/addresseelist.h> 37#include <kabc/addresseelist.h>
38#include <kabc/errorhandler.h> 38#include <kabc/errorhandler.h>
39#include <kabc/resource.h> 39#include <kabc/resource.h>
40#include <kabc/vcardconverter.h> 40#include <kabc/vcardconverter.h>
41#include <kapplication.h> 41#include <kapplication.h>
42#include <kactionclasses.h> 42#include <kactionclasses.h>
43#include <kcmultidialog.h> 43#include <kcmultidialog.h>
44#include <kdebug.h> 44#include <kdebug.h>
45#include <kdeversion.h> 45#include <kdeversion.h>
46#include <kkeydialog.h> 46#include <kkeydialog.h>
47#include <kmessagebox.h> 47#include <kmessagebox.h>
48#include <kprinter.h> 48#include <kprinter.h>
49#include <kprotocolinfo.h> 49#include <kprotocolinfo.h>
50#include <kresources/selectdialog.h> 50#include <kresources/selectdialog.h>
51#include <kstandarddirs.h> 51#include <kstandarddirs.h>
52#include <ktempfile.h> 52#include <ktempfile.h>
53#include <kxmlguiclient.h> 53#include <kxmlguiclient.h>
54#include <kaboutdata.h> 54#include <kaboutdata.h>
55#include <libkdepim/categoryselectdialog.h> 55#include <libkdepim/categoryselectdialog.h>
56 56
57#include "addresseeutil.h" 57#include "addresseeutil.h"
58#include "addresseeeditordialog.h" 58#include "addresseeeditordialog.h"
59#include "extensionmanager.h" 59#include "extensionmanager.h"
60#include "kstdaction.h" 60#include "kstdaction.h"
61#include "kaddressbookservice.h" 61#include "kaddressbookservice.h"
62#include "ldapsearchdialog.h" 62#include "ldapsearchdialog.h"
63#include "printing/printingwizard.h" 63#include "printing/printingwizard.h"
64#else // KAB_EMBEDDED 64#else // KAB_EMBEDDED
65 65
66#include "KDGanttMinimizeSplitter.h" 66#include "KDGanttMinimizeSplitter.h"
67#include "kaddressbookmain.h" 67#include "kaddressbookmain.h"
68#include "kactioncollection.h" 68#include "kactioncollection.h"
69#include <qapp.h> 69#include <qapp.h>
70#include <qmenubar.h> 70#include <qmenubar.h>
71//#include <qtoolbar.h> 71//#include <qtoolbar.h>
72#include <qmessagebox.h> 72#include <qmessagebox.h>
73#include <kdebug.h> 73#include <kdebug.h>
74#include <kiconloader.h> // needed for SmallIcon 74#include <kiconloader.h> // needed for SmallIcon
75#include <kresources/kcmkresources.h> 75#include <kresources/kcmkresources.h>
76#include <ktoolbar.h> 76#include <ktoolbar.h>
77 77
78#include <kcmkabconfig.h> 78#include <kcmkabconfig.h>
79 79
80//US#include <qpe/resource.h> // needed for Resource::loadPixmap 80//US#include <qpe/resource.h> // needed for Resource::loadPixmap
81//#include <qlabel.h> 81//#include <qlabel.h>
82#endif // KAB_EMBEDDED 82#endif // KAB_EMBEDDED
83#include <kcmkabconfig.h> 83#include <kcmkabconfig.h>
84 84
85 85
86#include <kresources/selectdialog.h> 86#include <kresources/selectdialog.h>
87#include <kmessagebox.h> 87#include <kmessagebox.h>
88 88
89#include <picture.h> 89#include <picture.h>
90#include <resource.h> 90#include <resource.h>
91 91
92//US#include <qsplitter.h> 92//US#include <qsplitter.h>
93#include <qvbox.h> 93#include <qvbox.h>
94#include <qlayout.h> 94#include <qlayout.h>
95#include <qclipboard.h> 95#include <qclipboard.h>
96 96
97#include <libkdepim/categoryselectdialog.h> 97#include <libkdepim/categoryselectdialog.h>
98 98
99#include "addresseeutil.h" 99#include "addresseeutil.h"
100#include "undocmds.h" 100#include "undocmds.h"
101#include "addresseeeditordialog.h" 101#include "addresseeeditordialog.h"
102#include "viewmanager.h" 102#include "viewmanager.h"
103#include "details/detailsviewcontainer.h" 103#include "details/detailsviewcontainer.h"
104#include "kabprefs.h" 104#include "kabprefs.h"
105#include "xxportmanager.h" 105#include "xxportmanager.h"
106#include "incsearchwidget.h" 106#include "incsearchwidget.h"
107#include "jumpbuttonbar.h" 107#include "jumpbuttonbar.h"
108#include "extensionmanager.h" 108#include "extensionmanager.h"
109#include "addresseeconfig.h" 109#include "addresseeconfig.h"
110#include <kcmultidialog.h> 110#include <kcmultidialog.h>
111 111
112 112
113#ifdef KAB_EMBEDDED 113#ifdef KAB_EMBEDDED
114KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 114KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
115 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 115 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
116 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 116 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
117 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 117 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
118#else //KAB_EMBEDDED 118#else //KAB_EMBEDDED
119KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 119KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
120 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 120 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
121 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 121 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
122 mReadWrite( readWrite ), mModified( false ) 122 mReadWrite( readWrite ), mModified( false )
123#endif //KAB_EMBEDDED 123#endif //KAB_EMBEDDED
124{ 124{
125#ifdef KAB_EMBEDDED 125#ifdef KAB_EMBEDDED
126 //US we define here our own global actioncollection. 126 //US we define here our own global actioncollection.
127 //mActionCollection = new KActionCollection(this); 127 //mActionCollection = new KActionCollection(this);
128#endif //KAB_EMBEDDED 128#endif //KAB_EMBEDDED
129 mExtensionBarSplitter = 0; 129 mExtensionBarSplitter = 0;
130 mIsPart = !parent->inherits( "KAddressBookMain" ); 130 mIsPart = !parent->inherits( "KAddressBookMain" );
131 131
132 mAddressBook = KABC::StdAddressBook::self(); 132 mAddressBook = KABC::StdAddressBook::self();
133 KABC::StdAddressBook::setAutomaticSave( true ); 133 KABC::StdAddressBook::setAutomaticSave( true );
134 134
135#ifndef KAB_EMBEDDED 135#ifndef KAB_EMBEDDED
136 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 136 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
137#endif //KAB_EMBEDDED 137#endif //KAB_EMBEDDED
138 138
139 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 139 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
140 SLOT( addressBookChanged() ) ); 140 SLOT( addressBookChanged() ) );
141 141
142 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 142 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
143 "X-Department", "KADDRESSBOOK" ); 143 "X-Department", "KADDRESSBOOK" );
144 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 144 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
145 "X-Profession", "KADDRESSBOOK" ); 145 "X-Profession", "KADDRESSBOOK" );
146 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 146 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
147 "X-AssistantsName", "KADDRESSBOOK" ); 147 "X-AssistantsName", "KADDRESSBOOK" );
148 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 148 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
149 "X-ManagersName", "KADDRESSBOOK" ); 149 "X-ManagersName", "KADDRESSBOOK" );
150 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 150 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
151 "X-SpousesName", "KADDRESSBOOK" ); 151 "X-SpousesName", "KADDRESSBOOK" );
152 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 152 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
153 "X-Office", "KADDRESSBOOK" ); 153 "X-Office", "KADDRESSBOOK" );
154 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 154 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
155 "X-IMAddress", "KADDRESSBOOK" ); 155 "X-IMAddress", "KADDRESSBOOK" );
156 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 156 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
157 "X-Anniversary", "KADDRESSBOOK" ); 157 "X-Anniversary", "KADDRESSBOOK" );
158
159//US added this field to become compatible with Opie addressbook
160 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
161 "X-Gender", "KADDRESSBOOK" );
162 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
163 "X-Children", "KADDRESSBOOK" );
158 164
159 initGUI(); 165 initGUI();
160 166
161 mIncSearchWidget->setFocus(); 167 mIncSearchWidget->setFocus();
162 168
163 169
164 connect( mViewManager, SIGNAL( selected( const QString& ) ), 170 connect( mViewManager, SIGNAL( selected( const QString& ) ),
165 SLOT( setContactSelected( const QString& ) ) ); 171 SLOT( setContactSelected( const QString& ) ) );
166 connect( mViewManager, SIGNAL( executed( const QString& ) ), 172 connect( mViewManager, SIGNAL( executed( const QString& ) ),
167 SLOT( editContact( const QString& ) ) ); 173 SLOT( editContact( const QString& ) ) );
168 connect( mViewManager, SIGNAL( deleteRequest( ) ), 174 connect( mViewManager, SIGNAL( deleteRequest( ) ),
169 SLOT( deleteContacts( ) ) ); 175 SLOT( deleteContacts( ) ) );
170 connect( mViewManager, SIGNAL( modified() ), 176 connect( mViewManager, SIGNAL( modified() ),
171 SLOT( setModified() ) ); 177 SLOT( setModified() ) );
172 178
173 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 179 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
174 180
175 connect( mXXPortManager, SIGNAL( modified() ), 181 connect( mXXPortManager, SIGNAL( modified() ),
176 SLOT( setModified() ) ); 182 SLOT( setModified() ) );
177 183
178 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 184 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
179 SLOT( incrementalSearch( const QString& ) ) ); 185 SLOT( incrementalSearch( const QString& ) ) );
180 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 186 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
181 mJumpButtonBar, SLOT( recreateButtons() ) ); 187 mJumpButtonBar, SLOT( recreateButtons() ) );
182 188
183#ifndef KAB_EMBEDDED 189#ifndef KAB_EMBEDDED
184 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 190 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
185 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 191 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
186 192
187 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 193 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
188 SLOT( sendMail( const QString& ) ) ); 194 SLOT( sendMail( const QString& ) ) );
189 connect( mDetails, SIGNAL( browse( const QString& ) ), 195 connect( mDetails, SIGNAL( browse( const QString& ) ),
190 SLOT( browse( const QString& ) ) ); 196 SLOT( browse( const QString& ) ) );
191 197
192 mAddressBookService = new KAddressBookService( this ); 198 mAddressBookService = new KAddressBookService( this );
193 199
194#endif //KAB_EMBEDDED 200#endif //KAB_EMBEDDED
195 201
196 setModified( false ); 202 setModified( false );
197} 203}
198 204
199KABCore::~KABCore() 205KABCore::~KABCore()
200{ 206{
201 // save(); 207 // save();
202 //saveSettings(); 208 //saveSettings();
203 //KABPrefs::instance()->writeConfig(); 209 //KABPrefs::instance()->writeConfig();
204 delete AddresseeConfig::instance(); 210 delete AddresseeConfig::instance();
205 mAddressBook = 0; 211 mAddressBook = 0;
206 KABC::StdAddressBook::close(); 212 KABC::StdAddressBook::close();
207 213
208#ifdef KAB_EMBEDDED 214#ifdef KAB_EMBEDDED
209 //US we define here our own global actioncollection. 215 //US we define here our own global actioncollection.
210 // delete mActionCollection; 216 // delete mActionCollection;
211#endif //KAB_EMBEDDED 217#endif //KAB_EMBEDDED
212 218
213} 219}
214 220
215void KABCore::restoreSettings() 221void KABCore::restoreSettings()
216{ 222{
217 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 223 bool state = KABPrefs::instance()->mJumpButtonBarVisible;
218 224
219 mActionJumpBar->setChecked( state ); 225 mActionJumpBar->setChecked( state );
220 setJumpButtonBarVisible( state ); 226 setJumpButtonBarVisible( state );
221 227
222 state = KABPrefs::instance()->mDetailsPageVisible; 228 state = KABPrefs::instance()->mDetailsPageVisible;
223 229
224 mActionDetails->setChecked( state ); 230 mActionDetails->setChecked( state );
225 setDetailsVisible( state ); 231 setDetailsVisible( state );
226 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 232 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
227 if ( splitterSize.count() == 0 ) { 233 if ( splitterSize.count() == 0 ) {
228 splitterSize.append( width() / 2 ); 234 splitterSize.append( width() / 2 );
229 splitterSize.append( width() / 2 ); 235 splitterSize.append( width() / 2 );
230 } 236 }
231 mMiniSplitter->setSizes( splitterSize ); 237 mMiniSplitter->setSizes( splitterSize );
232 if ( mExtensionBarSplitter ) { 238 if ( mExtensionBarSplitter ) {
233 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 239 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
234 if ( splitterSize.count() == 0 ) { 240 if ( splitterSize.count() == 0 ) {
235 splitterSize.append( width() / 2 ); 241 splitterSize.append( width() / 2 );
236 splitterSize.append( width() / 2 ); 242 splitterSize.append( width() / 2 );
237 } 243 }
238 mExtensionBarSplitter->setSizes( splitterSize ); 244 mExtensionBarSplitter->setSizes( splitterSize );
239 245
240 } 246 }
241#ifndef KAB_EMBEDDED 247#ifndef KAB_EMBEDDED
242 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 248 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
243 if ( splitterSize.count() == 0 ) { 249 if ( splitterSize.count() == 0 ) {
244 splitterSize.append( width() / 2 ); 250 splitterSize.append( width() / 2 );
245 splitterSize.append( width() / 2 ); 251 splitterSize.append( width() / 2 );
246 } 252 }
247 mExtensionBarSplitter->setSizes( splitterSize ); 253 mExtensionBarSplitter->setSizes( splitterSize );
248 254
249 splitterSize = KABPrefs::instance()->mDetailsSplitter; 255 splitterSize = KABPrefs::instance()->mDetailsSplitter;
250 if ( splitterSize.count() == 0 ) { 256 if ( splitterSize.count() == 0 ) {
251 splitterSize.append( height() / 2 ); 257 splitterSize.append( height() / 2 );
252 splitterSize.append( height() / 2 ); 258 splitterSize.append( height() / 2 );
253 } 259 }
254 mDetailsSplitter->setSizes( splitterSize ); 260 mDetailsSplitter->setSizes( splitterSize );
255 261
256 mExtensionManager->restoreSettings(); 262 mExtensionManager->restoreSettings();
257 263
258#endif //KAB_EMBEDDED 264#endif //KAB_EMBEDDED
259 265
260 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 266 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
261 267
262 mViewManager->restoreSettings(); 268 mViewManager->restoreSettings();
263 mExtensionManager->restoreSettings(); 269 mExtensionManager->restoreSettings();
264} 270}
265 271
266void KABCore::saveSettings() 272void KABCore::saveSettings()
267{ 273{
268 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 274 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
269 if ( mExtensionBarSplitter ) 275 if ( mExtensionBarSplitter )
270 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 276 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
271 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 277 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
272 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 278 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
273#ifndef KAB_EMBEDDED 279#ifndef KAB_EMBEDDED
274 280
275 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 281 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
276 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 282 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
277#endif //KAB_EMBEDDED 283#endif //KAB_EMBEDDED
278 mExtensionManager->saveSettings(); 284 mExtensionManager->saveSettings();
279 mViewManager->saveSettings(); 285 mViewManager->saveSettings();
280 286
281 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 287 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
282 288
283} 289}
284 290
285KABC::AddressBook *KABCore::addressBook() const 291KABC::AddressBook *KABCore::addressBook() const