summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp108
-rw-r--r--kaddressbook/kabcore.h6
2 files changed, 94 insertions, 20 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 6610288..96603e6 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -168,161 +168,176 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
168 "X-SpousesName", "KADDRESSBOOK" ); 168 "X-SpousesName", "KADDRESSBOOK" );
169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 169 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
170 "X-Office", "KADDRESSBOOK" ); 170 "X-Office", "KADDRESSBOOK" );
171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 171 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
172 "X-IMAddress", "KADDRESSBOOK" ); 172 "X-IMAddress", "KADDRESSBOOK" );
173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 173 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
174 "X-Anniversary", "KADDRESSBOOK" ); 174 "X-Anniversary", "KADDRESSBOOK" );
175 175
176 //US added this field to become compatible with Opie/qtopia addressbook 176 //US added this field to become compatible with Opie/qtopia addressbook
177 // values can be "female" or "male" or "". An empty field represents undefined. 177 // values can be "female" or "male" or "". An empty field represents undefined.
178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 178 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
179 "X-Gender", "KADDRESSBOOK" ); 179 "X-Gender", "KADDRESSBOOK" );
180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 180 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
181 "X-Children", "KADDRESSBOOK" ); 181 "X-Children", "KADDRESSBOOK" );
182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 182 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
183 "X-FreeBusyUrl", "KADDRESSBOOK" ); 183 "X-FreeBusyUrl", "KADDRESSBOOK" );
184 184
185 initGUI(); 185 initGUI();
186 186
187 mIncSearchWidget->setFocus(); 187 mIncSearchWidget->setFocus();
188 188
189 189
190 connect( mViewManager, SIGNAL( selected( const QString& ) ), 190 connect( mViewManager, SIGNAL( selected( const QString& ) ),
191 SLOT( setContactSelected( const QString& ) ) ); 191 SLOT( setContactSelected( const QString& ) ) );
192 connect( mViewManager, SIGNAL( executed( const QString& ) ), 192
193 //small devices show only the details view. bigger devices can edit the entry
194 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
195 connect( mViewManager, SIGNAL( executed( const QString& ) ),
193 SLOT( editContact( const QString& ) ) ); 196 SLOT( editContact( const QString& ) ) );
197 }
198 else
199 {
200 connect( mViewManager, SIGNAL( executed( const QString& ) ),
201 SLOT( showContact( const QString& ) ) );
202 }
203
194 connect( mViewManager, SIGNAL( deleteRequest( ) ), 204 connect( mViewManager, SIGNAL( deleteRequest( ) ),
195 SLOT( deleteContacts( ) ) ); 205 SLOT( deleteContacts( ) ) );
196 connect( mViewManager, SIGNAL( modified() ), 206 connect( mViewManager, SIGNAL( modified() ),
197 SLOT( setModified() ) ); 207 SLOT( setModified() ) );
198 208
199 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 209 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
200 210
201 connect( mXXPortManager, SIGNAL( modified() ), 211 connect( mXXPortManager, SIGNAL( modified() ),
202 SLOT( setModified() ) ); 212 SLOT( setModified() ) );
203 213
204 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 214 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
205 SLOT( incrementalSearch( const QString& ) ) ); 215 SLOT( incrementalSearch( const QString& ) ) );
206 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 216 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
207 mJumpButtonBar, SLOT( recreateButtons() ) ); 217 mJumpButtonBar, SLOT( recreateButtons() ) );
208 218
209 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 219 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
210 SLOT( sendMail( const QString& ) ) ); 220 SLOT( sendMail( const QString& ) ) );
211 221
212#ifndef KAB_EMBEDDED 222#ifndef KAB_EMBEDDED
213 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 223 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
214 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 224 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
215 225
216 connect( mDetails, SIGNAL( browse( const QString& ) ), 226 connect( mDetails, SIGNAL( browse( const QString& ) ),
217 SLOT( browse( const QString& ) ) ); 227 SLOT( browse( const QString& ) ) );
218 228
219 mAddressBookService = new KAddressBookService( this ); 229 mAddressBookService = new KAddressBookService( this );
220 230
221#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
222 mEditorDialog = 0; 232 mEditorDialog = 0;
223 createAddresseeEditorDialog( this ); 233 createAddresseeEditorDialog( this );
224 setModified( false ); 234 setModified( false );
225} 235}
226 236
227KABCore::~KABCore() 237KABCore::~KABCore()
228{ 238{
229 // save(); 239 // save();
230 //saveSettings(); 240 //saveSettings();
231 //KABPrefs::instance()->writeConfig(); 241 //KABPrefs::instance()->writeConfig();
232 delete AddresseeConfig::instance(); 242 delete AddresseeConfig::instance();
233 mAddressBook = 0; 243 mAddressBook = 0;
234 KABC::StdAddressBook::close(); 244 KABC::StdAddressBook::close();
235} 245}
236 246
237void KABCore::restoreSettings() 247void KABCore::restoreSettings()
238{ 248{
239 bool state = KABPrefs::instance()->mJumpButtonBarVisible; 249 bool state;
240 250
241 mActionJumpBar->setChecked( state ); 251 //small devices have at startup the details view disabled
242 setJumpButtonBarVisible( state ); 252 if (KGlobal::getDesktopSize() > KGlobal::Small )
243 253 state = KABPrefs::instance()->mDetailsPageVisible;
244 state = KABPrefs::instance()->mDetailsPageVisible; 254 else
255 state = false;
245 256
246 mActionDetails->setChecked( state ); 257 mActionDetails->setChecked( state );
247 setDetailsVisible( state ); 258 setDetailsVisible( state );
259
260 state = KABPrefs::instance()->mJumpButtonBarVisible;
261
262 mActionJumpBar->setChecked( state );
263 setJumpButtonBarVisible( state );
264
248 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 265 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
249 if ( splitterSize.count() == 0 ) { 266 if ( splitterSize.count() == 0 ) {
250 splitterSize.append( width() / 2 ); 267 splitterSize.append( width() / 2 );
251 splitterSize.append( width() / 2 ); 268 splitterSize.append( width() / 2 );
252 } 269 }
253 mMiniSplitter->setSizes( splitterSize ); 270 mMiniSplitter->setSizes( splitterSize );
254 if ( mExtensionBarSplitter ) { 271 if ( mExtensionBarSplitter ) {
255 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 272 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
256 if ( splitterSize.count() == 0 ) { 273 if ( splitterSize.count() == 0 ) {
257 splitterSize.append( width() / 2 ); 274 splitterSize.append( width() / 2 );
258 splitterSize.append( width() / 2 ); 275 splitterSize.append( width() / 2 );
259 } 276 }
260 mExtensionBarSplitter->setSizes( splitterSize ); 277 mExtensionBarSplitter->setSizes( splitterSize );
261 278
262 } 279 }
263#ifndef KAB_EMBEDDED 280#ifndef KAB_EMBEDDED
264 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; 281 QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter;
265 if ( splitterSize.count() == 0 ) { 282 if ( splitterSize.count() == 0 ) {
266 splitterSize.append( width() / 2 ); 283 splitterSize.append( width() / 2 );
267 splitterSize.append( width() / 2 ); 284 splitterSize.append( width() / 2 );
268 } 285 }
269 mExtensionBarSplitter->setSizes( splitterSize ); 286 mExtensionBarSplitter->setSizes( splitterSize );
270 287
271 splitterSize = KABPrefs::instance()->mDetailsSplitter; 288 splitterSize = KABPrefs::instance()->mDetailsSplitter;
272 if ( splitterSize.count() == 0 ) { 289 if ( splitterSize.count() == 0 ) {
273 splitterSize.append( height() / 2 ); 290 splitterSize.append( height() / 2 );
274 splitterSize.append( height() / 2 ); 291 splitterSize.append( height() / 2 );
275 } 292 }
276 mDetailsSplitter->setSizes( splitterSize ); 293 mDetailsSplitter->setSizes( splitterSize );
277 294
278 mExtensionManager->restoreSettings(); 295 mExtensionManager->restoreSettings();
279 296
280#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
281 298
282 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
283
284 mViewManager->restoreSettings(); 299 mViewManager->restoreSettings();
300 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
285 mExtensionManager->restoreSettings(); 301 mExtensionManager->restoreSettings();
286} 302}
287 303
288void KABCore::saveSettings() 304void KABCore::saveSettings()
289{ 305{
290 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 306 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
291 if ( mExtensionBarSplitter ) 307 if ( mExtensionBarSplitter )
292 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 308 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
293 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 309 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
294 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 310 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
295#ifndef KAB_EMBEDDED 311#ifndef KAB_EMBEDDED
296 312
297 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 313 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
298 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 314 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
299#endif //KAB_EMBEDDED 315#endif //KAB_EMBEDDED
300 mExtensionManager->saveSettings(); 316 mExtensionManager->saveSettings();
301 mViewManager->saveSettings(); 317 mViewManager->saveSettings();
302 318
303 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 319 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
304
305} 320}
306 321
307KABC::AddressBook *KABCore::addressBook() const 322KABC::AddressBook *KABCore::addressBook() const
308{ 323{
309 return mAddressBook; 324 return mAddressBook;
310} 325}
311 326
312KConfig *KABCore::config() 327KConfig *KABCore::config()
313{ 328{
314#ifndef KAB_EMBEDDED 329#ifndef KAB_EMBEDDED
315 return KABPrefs::instance()->config(); 330 return KABPrefs::instance()->config();
316#else //KAB_EMBEDDED 331#else //KAB_EMBEDDED
317 return KABPrefs::instance()->getConfig(); 332 return KABPrefs::instance()->getConfig();
318#endif //KAB_EMBEDDED 333#endif //KAB_EMBEDDED
319} 334}
320 335
321KActionCollection *KABCore::actionCollection() const 336KActionCollection *KABCore::actionCollection() const
322{ 337{
323 return mGUIClient->actionCollection(); 338 return mGUIClient->actionCollection();
324} 339}
325 340
326KABC::Field *KABCore::currentSearchField() const 341KABC::Field *KABCore::currentSearchField() const
327{ 342{
328 if (mIncSearchWidget) 343 if (mIncSearchWidget)
@@ -394,49 +409,49 @@ void KABCore::createAboutData()
394#else 409#else
395 "PDA-Edition\n" 410 "PDA-Edition\n"
396 "for: Zaurus 5500 / 7x0 / 8x0\n" 411 "for: Zaurus 5500 / 7x0 / 8x0\n"
397#endif 412#endif
398 413
399 "(c) 2004 Ulf Schenk\n" 414 "(c) 2004 Ulf Schenk\n"
400 "(c) 1997-2003, The KDE PIM Team\n" 415 "(c) 1997-2003, The KDE PIM Team\n"
401 "Tobias Koenig Current maintainer tokoe@kde.org\n" 416 "Tobias Koenig Current maintainer tokoe@kde.org\n"
402 "Don Sanders Original author\n" 417 "Don Sanders Original author\n"
403 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n" 418 "Cornelius Schumacher Co-maintainer schumacher@kde.org\n"
404 "Mike Pilone GUI and framework redesign mpilone@slac.com\n" 419 "Mike Pilone GUI and framework redesign mpilone@slac.com\n"
405 "Greg Stern DCOP interface\n" 420 "Greg Stern DCOP interface\n"
406 "Mark Westcot Contact pinning\n" 421 "Mark Westcot Contact pinning\n"
407 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 422 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
408 "Steffen Hansen LDAP Lookup hansen@kde.org\n" 423 "Steffen Hansen LDAP Lookup hansen@kde.org\n"
409#ifdef _WIN32_ 424#ifdef _WIN32_
410 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n" 425 "(c) 2004 Lutz Rogowski Import from OL rogowski@kde.org\n"
411#endif 426#endif
412 ); 427 );
413} 428}
414 429
415void KABCore::setContactSelected( const QString &uid ) 430void KABCore::setContactSelected( const QString &uid )
416{ 431{
417 KABC::Addressee addr = mAddressBook->findByUid( uid ); 432 KABC::Addressee addr = mAddressBook->findByUid( uid );
418 if ( !mDetails->isHidden() ) 433//US if ( !mDetails->isHidden() )
419 mDetails->setAddressee( addr ); 434 mDetails->setAddressee( addr );
420 435
421 if ( !addr.isEmpty() ) { 436 if ( !addr.isEmpty() ) {
422 emit contactSelected( addr.formattedName() ); 437 emit contactSelected( addr.formattedName() );
423 KABC::Picture pic = addr.photo(); 438 KABC::Picture pic = addr.photo();
424 if ( pic.isIntern() ) { 439 if ( pic.isIntern() ) {
425//US emit contactSelected( pic.data() ); 440//US emit contactSelected( pic.data() );
426//US instead use: 441//US instead use:
427 QPixmap px; 442 QPixmap px;
428 if (pic.data().isNull() != true) 443 if (pic.data().isNull() != true)
429 { 444 {
430 px.convertFromImage(pic.data()); 445 px.convertFromImage(pic.data());
431 } 446 }
432 447
433 emit contactSelected( px ); 448 emit contactSelected( px );
434 } 449 }
435 } 450 }
436 451
437 452
438 mExtensionManager->setSelectionChanged(); 453 mExtensionManager->setSelectionChanged();
439 454
440 // update the actions 455 // update the actions
441 bool selected = !uid.isEmpty(); 456 bool selected = !uid.isEmpty();
442 457
@@ -1020,111 +1035,162 @@ void KABCore::editContact2() {
1020 editContact( QString::null ); 1035 editContact( QString::null );
1021} 1036}
1022 1037
1023void KABCore::editContact( const QString &uid ) 1038void KABCore::editContact( const QString &uid )
1024{ 1039{
1025 1040
1026 if ( mExtensionManager->isQuickEditVisible() ) 1041 if ( mExtensionManager->isQuickEditVisible() )
1027 return; 1042 return;
1028 1043
1029 // First, locate the contact entry 1044 // First, locate the contact entry
1030 QString localUID = uid; 1045 QString localUID = uid;
1031 if ( localUID.isNull() ) { 1046 if ( localUID.isNull() ) {
1032 QStringList uidList = mViewManager->selectedUids(); 1047 QStringList uidList = mViewManager->selectedUids();
1033 if ( uidList.count() > 0 ) 1048 if ( uidList.count() > 0 )
1034 localUID = *( uidList.at( 0 ) ); 1049 localUID = *( uidList.at( 0 ) );
1035 } 1050 }
1036 1051
1037 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1052 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1038 if ( !addr.isEmpty() ) { 1053 if ( !addr.isEmpty() ) {
1039 mEditorDialog->setAddressee( addr ); 1054 mEditorDialog->setAddressee( addr );
1040 KApplication::execDialog ( mEditorDialog ); 1055 KApplication::execDialog ( mEditorDialog );
1041 } 1056 }
1042} 1057}
1043 1058
1059/**
1060 Shows the detail view for the given uid. If the uid is QString::null,
1061 the method will try to find a selected addressee in the view.
1062 We call this method only if we use a small device. Bigger devices are calling editContact instead
1063 */
1064void KABCore::showContact( const QString &uid /*US = QString::null*/ )
1065{
1066 setDetailsVisible( true );
1067 mActionDetails->setChecked(true);
1068}
1069
1044void KABCore::save() 1070void KABCore::save()
1045{ 1071{
1046 if ( !mModified ) 1072 if ( !mModified )
1047 return; 1073 return;
1048 QString text = i18n( "There was an error while attempting to save\n the " 1074 QString text = i18n( "There was an error while attempting to save\n the "
1049 "address book. Please check that some \nother application is " 1075 "address book. Please check that some \nother application is "
1050 "not using it. " ); 1076 "not using it. " );
1051 statusMessage(i18n("Saving addressbook ... ")); 1077 statusMessage(i18n("Saving addressbook ... "));
1052#ifndef KAB_EMBEDDED 1078#ifndef KAB_EMBEDDED
1053 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1079 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1054 if ( !b || !b->save() ) { 1080 if ( !b || !b->save() ) {
1055 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1081 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1056 } 1082 }
1057#else //KAB_EMBEDDED 1083#else //KAB_EMBEDDED
1058 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1084 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1059 if ( !b || !b->save() ) { 1085 if ( !b || !b->save() ) {
1060 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1086 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1061 } 1087 }
1062#endif //KAB_EMBEDDED 1088#endif //KAB_EMBEDDED
1063 1089
1064 statusMessage(i18n("Addressbook saved!")); 1090 statusMessage(i18n("Addressbook saved!"));
1065 setModified( false ); 1091 setModified( false );
1066} 1092}
1067 1093
1068void KABCore::statusMessage(QString mess , int time ) 1094void KABCore::statusMessage(QString mess , int time )
1069{ 1095{
1070 //topLevelWidget()->setCaption( mess ); 1096 //topLevelWidget()->setCaption( mess );
1071 // pending setting timer to revome message 1097 // pending setting timer to revome message
1072} 1098}
1073void KABCore::undo() 1099void KABCore::undo()
1074{ 1100{
1075 UndoStack::instance()->undo(); 1101 UndoStack::instance()->undo();
1076 1102
1077 // Refresh the view 1103 // Refresh the view
1078 mViewManager->refreshView(); 1104 mViewManager->refreshView();
1079} 1105}
1080 1106
1081void KABCore::redo() 1107void KABCore::redo()
1082{ 1108{
1083 RedoStack::instance()->redo(); 1109 RedoStack::instance()->redo();
1084 1110
1085 // Refresh the view 1111 // Refresh the view
1086 mViewManager->refreshView(); 1112 mViewManager->refreshView();
1087} 1113}
1088 1114
1089void KABCore::setJumpButtonBarVisible( bool visible ) 1115void KABCore::setJumpButtonBarVisible( bool visible )
1090{ 1116{
1091 if ( visible ) 1117 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1092 mJumpButtonBar->show(); 1118 if ( visible )
1119 mJumpButtonBar->show();
1120 else
1121 mJumpButtonBar->hide();
1122 }
1093 else 1123 else
1094 mJumpButtonBar->hide(); 1124 {
1125 // for the Z5500, show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1126 if (mViewManager->isVisible())
1127 {
1128 if ( visible )
1129 mJumpButtonBar->show();
1130 else
1131 mJumpButtonBar->hide();
1132 }
1133 else
1134 {
1135 mJumpButtonBar->hide();
1136 }
1137 }
1095} 1138}
1096void KABCore::setDetailsToState() 1139void KABCore::setDetailsToState()
1097{ 1140{
1098 setDetailsVisible( mActionDetails->isChecked() ); 1141 setDetailsVisible( mActionDetails->isChecked() );
1099} 1142}
1100 1143
1144
1145
1101void KABCore::setDetailsVisible( bool visible ) 1146void KABCore::setDetailsVisible( bool visible )
1102{ 1147{
1103 if ( visible ) 1148 //US "details visible" has two different meanings for small devices like the 5500
1104 mDetails->show(); 1149 // compared with large devices like the c series.
1150
1151 // small devices: mDetails is always visible. But we switch between
1152 // the listview and the detailview. We do that by changing the splitbar size.
1153 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1154 if ( visible )
1155 mDetails->show();
1156 else
1157 mDetails->hide();
1158 }
1105 else 1159 else
1106 mDetails->hide(); 1160 {
1161 if ( visible ) {
1162 mViewManager->hide();
1163 mDetails->show();
1164// mDetails->show();
1165 }
1166 else {
1167 mViewManager->show();
1168 mDetails->hide();
1169 }
1170 setJumpButtonBarVisible( !visible );
1171
1172 }
1107} 1173}
1108 1174
1109void KABCore::extensionModified( const KABC::Addressee::List &list ) 1175void KABCore::extensionModified( const KABC::Addressee::List &list )
1110{ 1176{
1111 1177
1112 if ( list.count() != 0 ) { 1178 if ( list.count() != 0 ) {
1113 KABC::Addressee::List::ConstIterator it; 1179 KABC::Addressee::List::ConstIterator it;
1114 for ( it = list.begin(); it != list.end(); ++it ) 1180 for ( it = list.begin(); it != list.end(); ++it )
1115 mAddressBook->insertAddressee( *it ); 1181 mAddressBook->insertAddressee( *it );
1116 if ( list.count() > 1 ) 1182 if ( list.count() > 1 )
1117 setModified(); 1183 setModified();
1118 else 1184 else
1119 setModifiedWOrefresh(); 1185 setModifiedWOrefresh();
1120 } 1186 }
1121 if ( list.count() == 0 ) 1187 if ( list.count() == 0 )
1122 mViewManager->refreshView(); 1188 mViewManager->refreshView();
1123 else 1189 else
1124 mViewManager->refreshView( list[ 0 ].uid() ); 1190 mViewManager->refreshView( list[ 0 ].uid() );
1125 1191
1126 1192
1127 1193
1128} 1194}
1129 1195
1130QString KABCore::getNameByPhone( const QString &phone ) 1196QString KABCore::getNameByPhone( const QString &phone )
@@ -1550,49 +1616,49 @@ void KABCore::initActions()
1550 1616
1551 if ( mIsPart ) { 1617 if ( mIsPart ) {
1552 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1618 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1553 SLOT( openConfigDialog() ), actionCollection(), 1619 SLOT( openConfigDialog() ), actionCollection(),
1554 "kaddressbook_configure" ); 1620 "kaddressbook_configure" );
1555 1621
1556 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1622 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1557 this, SLOT( configureKeyBindings() ), actionCollection(), 1623 this, SLOT( configureKeyBindings() ), actionCollection(),
1558 "kaddressbook_configure_shortcuts" ); 1624 "kaddressbook_configure_shortcuts" );
1559#ifdef KAB_EMBEDDED 1625#ifdef KAB_EMBEDDED
1560 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1626 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1561 mActionConfigureToolbars->setEnabled( false ); 1627 mActionConfigureToolbars->setEnabled( false );
1562#endif //KAB_EMBEDDED 1628#endif //KAB_EMBEDDED
1563 1629
1564 } else { 1630 } else {
1565 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1631 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1566 1632
1567 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1633 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1568 } 1634 }
1569 1635
1570 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1636 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1571 actionCollection(), "options_show_jump_bar" ); 1637 actionCollection(), "options_show_jump_bar" );
1572 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1638 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1573 1639
1574 mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, 1640 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1575 actionCollection(), "options_show_details" ); 1641 actionCollection(), "options_show_details" );
1576 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1642 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1577 1643
1578 // misc 1644 // misc
1579 // only enable LDAP lookup if we can handle the protocol 1645 // only enable LDAP lookup if we can handle the protocol
1580#ifndef KAB_EMBEDDED 1646#ifndef KAB_EMBEDDED
1581 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1647 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1582 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1648 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1583 this, SLOT( openLDAPDialog() ), actionCollection(), 1649 this, SLOT( openLDAPDialog() ), actionCollection(),
1584 "ldap_lookup" ); 1650 "ldap_lookup" );
1585 } 1651 }
1586#else //KAB_EMBEDDED 1652#else //KAB_EMBEDDED
1587 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1653 //qDebug("KABCore::initActions() LDAP has to be implemented");
1588#endif //KAB_EMBEDDED 1654#endif //KAB_EMBEDDED
1589 1655
1590 1656
1591 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1657 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1592 SLOT( setWhoAmI() ), actionCollection(), 1658 SLOT( setWhoAmI() ), actionCollection(),
1593 "set_personal" ); 1659 "set_personal" );
1594 1660
1595 1661
1596 1662
1597 1663
1598 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1664 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
@@ -1658,109 +1724,111 @@ void KABCore::addActionsManually()
1658 popupBarTB->insertItem( "&File", fileMenu ); 1724 popupBarTB->insertItem( "&File", fileMenu );
1659 popupBarTB->insertItem( "&Edit", editMenu ); 1725 popupBarTB->insertItem( "&Edit", editMenu );
1660 popupBarTB->insertItem( "&View", viewMenu ); 1726 popupBarTB->insertItem( "&View", viewMenu );
1661 popupBarTB->insertItem( "&Settings", settingsMenu ); 1727 popupBarTB->insertItem( "&Settings", settingsMenu );
1662 mViewManager->getFilterAction()->plug ( popupBarTB); 1728 mViewManager->getFilterAction()->plug ( popupBarTB);
1663 popupBarTB->insertItem( "&Change selected", changeMenu ); 1729 popupBarTB->insertItem( "&Change selected", changeMenu );
1664 popupBarTB->insertItem( "&Help", helpMenu ); 1730 popupBarTB->insertItem( "&Help", helpMenu );
1665 if (QApplication::desktop()->width() > 320 ) { 1731 if (QApplication::desktop()->width() > 320 ) {
1666 // mViewManager->getFilterAction()->plug ( tb); 1732 // mViewManager->getFilterAction()->plug ( tb);
1667 } 1733 }
1668#endif 1734#endif
1669 // mActionQuit->plug ( mMainWindow->toolBar()); 1735 // mActionQuit->plug ( mMainWindow->toolBar());
1670 1736
1671 1737
1672 1738
1673 //US Now connect the actions with the menue entries. 1739 //US Now connect the actions with the menue entries.
1674 mActionPrint->plug( fileMenu ); 1740 mActionPrint->plug( fileMenu );
1675 mActionMail->plug( fileMenu ); 1741 mActionMail->plug( fileMenu );
1676 fileMenu->insertSeparator(); 1742 fileMenu->insertSeparator();
1677 1743
1678 mActionNewContact->plug( fileMenu ); 1744 mActionNewContact->plug( fileMenu );
1679 mActionNewContact->plug( tb ); 1745 mActionNewContact->plug( tb );
1680 1746
1681 mActionEditAddressee->plug( fileMenu ); 1747 mActionEditAddressee->plug( fileMenu );
1748 mActionEditAddressee->plug( tb );
1682 fileMenu->insertSeparator(); 1749 fileMenu->insertSeparator();
1683 mActionSave->plug( fileMenu ); 1750 mActionSave->plug( fileMenu );
1684 fileMenu->insertItem( "&Import", ImportMenu ); 1751 fileMenu->insertItem( "&Import", ImportMenu );
1685 fileMenu->insertItem( "&Emport", ExportMenu ); 1752 fileMenu->insertItem( "&Emport", ExportMenu );
1686 fileMenu->insertSeparator(); 1753 fileMenu->insertSeparator();
1687 mActionMailVCard->plug( fileMenu ); 1754 mActionMailVCard->plug( fileMenu );
1688#ifndef DESKTOP_VERSION 1755#ifndef DESKTOP_VERSION
1689 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1756 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1690 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1757 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1691#endif 1758#endif
1692 fileMenu->insertSeparator(); 1759 fileMenu->insertSeparator();
1693 mActionQuit->plug( fileMenu ); 1760 mActionQuit->plug( fileMenu );
1694#ifdef _WIN32_ 1761#ifdef _WIN32_
1695 mActionImportOL->plug( ImportMenu ); 1762 mActionImportOL->plug( ImportMenu );
1696#endif 1763#endif
1697 // edit menu 1764 // edit menu
1698 mActionUndo->plug( editMenu ); 1765 mActionUndo->plug( editMenu );
1699 mActionRedo->plug( editMenu ); 1766 mActionRedo->plug( editMenu );
1700 editMenu->insertSeparator(); 1767 editMenu->insertSeparator();
1701 mActionCut->plug( editMenu ); 1768 mActionCut->plug( editMenu );
1702 mActionCopy->plug( editMenu ); 1769 mActionCopy->plug( editMenu );
1703 mActionPaste->plug( editMenu ); 1770 mActionPaste->plug( editMenu );
1704 mActionDelete->plug( editMenu ); 1771 mActionDelete->plug( editMenu );
1705 editMenu->insertSeparator(); 1772 editMenu->insertSeparator();
1706 mActionSelectAll->plug( editMenu ); 1773 mActionSelectAll->plug( editMenu );
1707 1774
1708 mActionRemoveVoice->plug( changeMenu ); 1775 mActionRemoveVoice->plug( changeMenu );
1709 // settings menu 1776 // settings menu
1710//US special menuentry to configure the addressbook resources. On KDE 1777//US special menuentry to configure the addressbook resources. On KDE
1711// you do that through the control center !!! 1778// you do that through the control center !!!
1712 mActionConfigResources->plug( settingsMenu ); 1779 mActionConfigResources->plug( settingsMenu );
1713 settingsMenu->insertSeparator(); 1780 settingsMenu->insertSeparator();
1714 1781
1715 mActionConfigKAddressbook->plug( settingsMenu ); 1782 mActionConfigKAddressbook->plug( settingsMenu );
1716 1783
1717 if ( mIsPart ) { 1784 if ( mIsPart ) {
1718 mActionConfigShortcuts->plug( settingsMenu ); 1785 mActionConfigShortcuts->plug( settingsMenu );
1719 mActionConfigureToolbars->plug( settingsMenu ); 1786 mActionConfigureToolbars->plug( settingsMenu );
1720 1787
1721 } else { 1788 } else {
1722 mActionKeyBindings->plug( settingsMenu ); 1789 mActionKeyBindings->plug( settingsMenu );
1723 } 1790 }
1724 1791
1725 settingsMenu->insertSeparator(); 1792 settingsMenu->insertSeparator();
1726 1793
1727 mActionJumpBar->plug( settingsMenu ); 1794 mActionJumpBar->plug( settingsMenu );
1728 mActionDetails->plug( settingsMenu ); 1795 mActionDetails->plug( settingsMenu );
1796 if (KGlobal::getDesktopSize() == KGlobal::Small )
1797 mActionDetails->plug( tb );
1729 settingsMenu->insertSeparator(); 1798 settingsMenu->insertSeparator();
1730 1799
1731 mActionWhoAmI->plug( settingsMenu ); 1800 mActionWhoAmI->plug( settingsMenu );
1732 mActionCategories->plug( settingsMenu ); 1801 mActionCategories->plug( settingsMenu );
1733 1802
1734 mActionAboutKAddressbook->plug( helpMenu ); 1803 mActionAboutKAddressbook->plug( helpMenu );
1735 mActionLicence->plug( helpMenu ); 1804 mActionLicence->plug( helpMenu );
1736 1805
1737 if (QApplication::desktop()->width() > 320 ) { 1806 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1738 1807
1739 mActionEditAddressee->plug( tb );
1740 mActionSave->plug( tb ); 1808 mActionSave->plug( tb );
1741 mViewManager->getFilterAction()->plug ( tb); 1809 mViewManager->getFilterAction()->plug ( tb);
1742 if (QApplication::desktop()->width() > 480 ) { 1810 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1743 mActionUndo->plug( tb ); 1811 mActionUndo->plug( tb );
1744 mActionDelete->plug( tb ); 1812 mActionDelete->plug( tb );
1745 mActionRedo->plug( tb ); 1813 mActionRedo->plug( tb );
1746 } 1814 }
1747 } 1815 }
1748 //mActionQuit->plug ( tb ); 1816 //mActionQuit->plug ( tb );
1749 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1817 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1750 1818
1751 //US link the searchwidget first to this. 1819 //US link the searchwidget first to this.
1752 // The real linkage to the toolbar happens later. 1820 // The real linkage to the toolbar happens later.
1753//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1821//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1754//US tb->insertItem( mIncSearchWidget ); 1822//US tb->insertItem( mIncSearchWidget );
1755/*US 1823/*US
1756 mIncSearchWidget = new IncSearchWidget( tb ); 1824 mIncSearchWidget = new IncSearchWidget( tb );
1757 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1825 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1758 SLOT( incrementalSearch( const QString& ) ) ); 1826 SLOT( incrementalSearch( const QString& ) ) );
1759 1827
1760 mJumpButtonBar = new JumpButtonBar( this, this ); 1828 mJumpButtonBar = new JumpButtonBar( this, this );
1761 1829
1762//US topLayout->addWidget( mJumpButtonBar ); 1830//US topLayout->addWidget( mJumpButtonBar );
1763 this->layout()->add( mJumpButtonBar ); 1831 this->layout()->add( mJumpButtonBar );
1764*/ 1832*/
1765 1833
1766#endif //KAB_EMBEDDED 1834#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 6bbdfd4..a45c4c6 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -281,48 +281,54 @@ class KABCore : public QWidget
281 /** 281 /**
282 Saves the contents of the AddressBook back to disk. 282 Saves the contents of the AddressBook back to disk.
283 */ 283 */
284 void save(); 284 void save();
285 285
286 /** 286 /**
287 Undos the last command using the undo stack. 287 Undos the last command using the undo stack.
288 */ 288 */
289 void undo(); 289 void undo();
290 290
291 /** 291 /**
292 Redos the last command that was undone, using the redo stack. 292 Redos the last command that was undone, using the redo stack.
293 */ 293 */
294 void redo(); 294 void redo();
295 295
296 /** 296 /**
297 Shows the edit dialog for the given uid. If the uid is QString::null, 297 Shows the edit dialog for the given uid. If the uid is QString::null,
298 the method will try to find a selected addressee in the view. 298 the method will try to find a selected addressee in the view.
299 */ 299 */
300 void editContact( const QString &uid /*US = QString::null*/ ); 300 void editContact( const QString &uid /*US = QString::null*/ );
301//US added a second method without defaultparameter 301//US added a second method without defaultparameter
302 void editContact2(); 302 void editContact2();
303 303
304 /** 304 /**
305 Shows the detail view for the given uid. If the uid is QString::null,
306 the method will try to find a selected addressee in the view.
307 */
308 void showContact( const QString &uid /*US = QString::null*/ );
309
310 /**
305 Launches the configuration dialog. 311 Launches the configuration dialog.
306 */ 312 */
307 void openConfigDialog(); 313 void openConfigDialog();
308 314
309 /** 315 /**
310 Launches the ldap search dialog. 316 Launches the ldap search dialog.
311 */ 317 */
312 void openLDAPDialog(); 318 void openLDAPDialog();
313 319
314 /** 320 /**
315 Creates a KAddressBookPrinter, which will display the print 321 Creates a KAddressBookPrinter, which will display the print
316 dialog and do the printing. 322 dialog and do the printing.
317 */ 323 */
318 void print(); 324 void print();
319 325
320 /** 326 /**
321 Registers a new GUI client, so plugins can register its actions. 327 Registers a new GUI client, so plugins can register its actions.
322 */ 328 */
323 void addGUIClient( KXMLGUIClient *client ); 329 void addGUIClient( KXMLGUIClient *client );
324 330
325 signals: 331 signals:
326 void contactSelected( const QString &name ); 332 void contactSelected( const QString &name );
327 void contactSelected( const QPixmap &pixmap ); 333 void contactSelected( const QPixmap &pixmap );
328 public slots: 334 public slots: