22 #include "contacteditorwidget.h" 24 #include "addresseditwidget.h" 25 #include "categorieseditwidget.h" 26 #include "contacteditorpageplugin.h" 27 #include "contactmetadata_p.h" 28 #include "customfieldseditwidget.h" 29 #include "dateeditwidget.h" 30 #include "displaynameeditwidget.h" 31 #include "emaileditwidget.h" 32 #include "freebusyeditwidget.h" 33 #include "geoeditwidget.h" 34 #include "imagewidget.h" 35 #include "imeditwidget.h" 36 #include "nameeditwidget.h" 37 #include "phoneeditwidget.h" 38 #include "soundeditwidget.h" 41 #include <kconfiggroup.h> 42 #include <klineedit.h> 43 #include <klocalizedstring.h> 44 #include <kstandarddirs.h> 45 #include <ktabwidget.h> 46 #include <ktextedit.h> 48 #include <QtCore/QDirIterator> 49 #include <QtCore/QPluginLoader> 53 #include <QVBoxLayout> 55 class ContactEditorWidget::Private
59 : mDisplayMode(displayMode), mParent( parent ), mCustomFieldsWidget(0)
64 void initGuiContactTab();
65 void initGuiLocationTab();
66 void initGuiBusinessTab();
67 void initGuiPersonalTab();
68 void initGuiNotesTab();
69 void initGuiCustomFieldsTab();
71 void loadCustomPages();
73 QString loadCustom(
const KABC::Addressee &contact,
const QString &key )
const;
74 void storeCustom( KABC::Addressee &contact,
const QString &key,
const QString &value )
const;
78 KTabWidget *mTabWidget;
82 ImageWidget *mPhotoWidget;
84 KLineEdit *mNickNameWidget;
85 SoundEditWidget *mPronunciationWidget;
89 KLineEdit *mHomepageWidget;
90 KLineEdit *mBlogWidget;
98 KComboBox* mMailPreferFormatting;
99 QCheckBox *mAllowRemoteContent;
105 GeoEditWidget *mCoordinatesWidget;
108 ImageWidget *mLogoWidget;
109 KLineEdit *mOrganizationWidget;
110 KLineEdit *mProfessionWidget;
111 KLineEdit *mTitleWidget;
112 KLineEdit *mDepartmentWidget;
113 KLineEdit *mOfficeWidget;
114 KLineEdit *mManagerWidget;
115 KLineEdit *mAssistantWidget;
118 FreeBusyEditWidget *mFreeBusyWidget;
121 KTextEdit *mNotesWidget;
124 DateEditWidget *mBirthdateWidget;
125 DateEditWidget *mAnniversaryWidget;
128 KLineEdit *mPartnerWidget;
131 CustomFieldsEditWidget *mCustomFieldsWidget;
134 QList<Akonadi::ContactEditorPagePlugin*> mCustomPages;
137 void ContactEditorWidget::Private::initGui()
139 QVBoxLayout *layout =
new QVBoxLayout( mParent );
140 layout->setMargin( 0 );
142 mTabWidget =
new KTabWidget( mParent );
143 layout->addWidget( mTabWidget );
146 initGuiLocationTab();
147 initGuiBusinessTab();
148 initGuiPersonalTab();
151 initGuiCustomFieldsTab();
156 void ContactEditorWidget::Private::initGuiContactTab()
158 QWidget *widget =
new QWidget;
159 QGridLayout *layout =
new QGridLayout( widget );
161 mTabWidget->addTab( widget, i18nc(
"@title:tab",
"Contact" ) );
163 QGroupBox *nameGroupBox =
new QGroupBox( i18nc(
"@title:group Name related properties of a contact",
"Name" ) );
164 QGroupBox *internetGroupBox =
new QGroupBox( i18nc(
"@title:group",
"Internet" ) );
165 QGroupBox *phonesGroupBox =
new QGroupBox( i18nc(
"@title:group",
"Phones" ) );
167 nameGroupBox->setMinimumSize(320,200);
168 layout->addWidget( nameGroupBox, 0, 0 );
169 layout->addWidget( internetGroupBox, 0, 1 );
170 layout->addWidget( phonesGroupBox, 1, 0, 4, 1 );
172 QGridLayout *nameLayout =
new QGridLayout( nameGroupBox );
173 QGridLayout *internetLayout =
new QGridLayout( internetGroupBox );
174 QGridLayout *phonesLayout =
new QGridLayout( phonesGroupBox );
179 label =
new QLabel( i18nc(
"@label The name of a contact",
"Name:" ) );
180 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
181 nameLayout->addWidget( label, 0, 0 );
184 label->setBuddy( mNameWidget );
185 nameLayout->addWidget( mNameWidget, 0, 1 );
187 mPhotoWidget =
new ImageWidget( ImageWidget::Photo );
188 nameLayout->addWidget( mPhotoWidget, 0, 2, 4, 1 );
190 label =
new QLabel( i18nc(
"@label The display name of a contact",
"Display:" ) );
191 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
192 nameLayout->addWidget( label, 1, 0 );
195 label->setBuddy( mDisplayNameWidget );
196 nameLayout->addWidget( mDisplayNameWidget, 1, 1 );
198 label =
new QLabel( i18nc(
"@label The nickname of a contact",
"Nickname:" ) );
199 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
200 nameLayout->addWidget( label, 2, 0 );
202 mNickNameWidget =
new KLineEdit;
203 label->setBuddy( mNickNameWidget );
204 nameLayout->addWidget( mNickNameWidget, 2, 1 );
206 label =
new QLabel( i18nc(
"@label The pronunciation of a contact's name",
"Pronunciation:" ) );
207 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
208 nameLayout->addWidget( label, 3, 0 );
210 mPronunciationWidget =
new SoundEditWidget;
211 label->setBuddy( mPronunciationWidget );
212 nameLayout->addWidget( mPronunciationWidget, 3, 1 );
214 nameLayout->setRowStretch( 4, 1 );
217 label =
new QLabel( i18nc(
"@label The email address of a contact",
"Email:" ) );
218 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
219 internetLayout->addWidget( label, 0, 0 );
222 label->setBuddy( mEmailWidget );
223 internetLayout->addWidget( mEmailWidget, 0, 1 );
225 label =
new QLabel( i18nc(
"@label The homepage URL of a contact",
"Homepage:" ) );
226 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
227 internetLayout->addWidget( label, 1, 0 );
229 mHomepageWidget =
new KLineEdit;
230 label->setBuddy( mHomepageWidget );
231 internetLayout->addWidget( mHomepageWidget, 1, 1 );
233 label =
new QLabel( i18nc(
"@label The blog URL of a contact",
"Blog:" ) );
234 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
235 internetLayout->addWidget( label, 2, 0 );
237 mBlogWidget =
new KLineEdit;
238 label->setBuddy( mBlogWidget );
239 internetLayout->addWidget( mBlogWidget, 2, 1 );
241 label =
new QLabel( i18nc(
"@label The instant messaging address of a contact",
"Messaging:" ) );
242 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
243 internetLayout->addWidget( label, 3, 0 );
246 label->setBuddy( mIMWidget );
247 internetLayout->addWidget( mIMWidget, 3, 1 );
249 internetLayout->setRowStretch( 4, 1 );
253 phonesLayout->addWidget( mPhonesWidget, 0, 0 );
258 QHBoxLayout *categoriesLayout =
new QHBoxLayout;
259 label =
new QLabel( i18nc(
"@label The categories of a contact",
"Categories:" ) );
260 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
263 label->setBuddy( mCategoriesWidget );
265 categoriesLayout->addWidget( label );
266 categoriesLayout->addWidget( mCategoriesWidget );
268 layout->addLayout( categoriesLayout, 1, 1 );
270 QGroupBox *receivedMessageGroupBox =
new QGroupBox( i18n(
"Messages") );
271 layout->addWidget( receivedMessageGroupBox, 2, 1 );
273 QVBoxLayout *vbox =
new QVBoxLayout(receivedMessageGroupBox);
275 QHBoxLayout *mailPreferFormattingLayout =
new QHBoxLayout;
276 label =
new QLabel( i18n(
"Show messages received from this contact as:" ) );
277 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
278 mMailPreferFormatting =
new KComboBox;
279 label->setBuddy( mMailPreferFormatting );
280 QStringList listFormat;
281 listFormat << i18n(
"Default" ) << i18n(
"Plain Text" ) << i18n(
"HTML" );
282 mMailPreferFormatting->addItems( listFormat );
283 mailPreferFormattingLayout->addWidget( label );
284 mailPreferFormattingLayout->addWidget( mMailPreferFormatting );
287 vbox->addLayout( mailPreferFormattingLayout );
289 mAllowRemoteContent =
new QCheckBox( i18n(
"Allow remote content in received HTML messages" ) );
290 vbox->addWidget( mAllowRemoteContent );
292 layout->setRowStretch( 4,1 );
295 void ContactEditorWidget::Private::initGuiLocationTab()
297 QWidget *widget =
new QWidget;
298 QHBoxLayout *layout =
new QHBoxLayout( widget );
300 mTabWidget->addTab( widget, i18nc(
"@title:tab",
"Location" ) );
302 QGroupBox *addressesGroupBox =
new QGroupBox( i18nc(
"@title:group",
"Addresses" ) );
303 QGroupBox *coordinatesGroupBox =
new QGroupBox( i18nc(
"@title:group",
"Coordinates" ) );
305 layout->addWidget( addressesGroupBox );
306 layout->addWidget( coordinatesGroupBox );
308 QGridLayout *addressesLayout =
new QGridLayout( addressesGroupBox );
309 QGridLayout *coordinatesLayout =
new QGridLayout( coordinatesGroupBox );
313 mAddressesWidget->setMinimumHeight( 200 );
314 addressesLayout->addWidget( mAddressesWidget, 0, 0 );
315 addressesLayout->setRowStretch( 1, 1 );
318 mCoordinatesWidget =
new GeoEditWidget;
319 coordinatesLayout->addWidget( mCoordinatesWidget, 0, 0 );
320 coordinatesLayout->setRowStretch( 1, 1 );
323 void ContactEditorWidget::Private::initGuiBusinessTab()
325 QWidget *widget =
new QWidget;
326 QVBoxLayout *layout =
new QVBoxLayout( widget );
328 mTabWidget->addTab( widget, i18nc(
"@title:tab",
"Business" ) );
330 QGroupBox *generalGroupBox =
new QGroupBox( i18nc(
"@title:group General properties of a contact",
"General" ) );
331 QGroupBox *groupwareGroupBox =
new QGroupBox( i18nc(
"@title:group",
"Groupware" ) );
333 layout->addWidget( generalGroupBox );
334 layout->addWidget( groupwareGroupBox );
336 QGridLayout *generalLayout =
new QGridLayout( generalGroupBox );
337 QGridLayout *groupwareLayout =
new QGridLayout( groupwareGroupBox );
342 mLogoWidget =
new ImageWidget( ImageWidget::Logo );
343 generalLayout->addWidget( mLogoWidget, 0, 2, 6, 1, Qt::AlignTop );
345 label =
new QLabel( i18nc(
"@label The organization of a contact",
"Organization:" ) );
346 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
347 generalLayout->addWidget( label, 0, 0 );
349 mOrganizationWidget =
new KLineEdit;
350 label->setBuddy( mOrganizationWidget );
351 generalLayout->addWidget( mOrganizationWidget, 0, 1 );
353 label =
new QLabel( i18nc(
"@label The profession of a contact",
"Profession:" ) );
354 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
355 generalLayout->addWidget( label, 1, 0 );
357 mProfessionWidget =
new KLineEdit;
358 label->setBuddy( mProfessionWidget );
359 generalLayout->addWidget( mProfessionWidget, 1, 1 );
361 label =
new QLabel( i18nc(
"@label The title of a contact",
"Title:" ) );
362 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
363 generalLayout->addWidget( label, 2, 0 );
365 mTitleWidget =
new KLineEdit;
366 label->setBuddy( mTitleWidget );
367 generalLayout->addWidget( mTitleWidget , 2, 1 );
369 label =
new QLabel( i18nc(
"@label The department of a contact",
"Department:" ) );
370 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
371 generalLayout->addWidget( label, 3, 0 );
373 mDepartmentWidget =
new KLineEdit;
374 label->setBuddy( mDepartmentWidget );
375 generalLayout->addWidget( mDepartmentWidget, 3, 1 );
377 label =
new QLabel( i18nc(
"@label The office of a contact",
"Office:" ) );
378 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
379 generalLayout->addWidget( label, 4, 0 );
381 mOfficeWidget =
new KLineEdit;
382 label->setBuddy( mOfficeWidget );
383 generalLayout->addWidget( mOfficeWidget, 4, 1 );
385 label =
new QLabel( i18nc(
"@label The manager's name of a contact",
"Manager's name:" ) );
386 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
387 generalLayout->addWidget( label, 5, 0 );
389 mManagerWidget =
new KLineEdit;
390 label->setBuddy( mManagerWidget );
391 generalLayout->addWidget( mManagerWidget, 5, 1 );
393 label =
new QLabel( i18nc(
"@label The assistant's name of a contact",
"Assistant's name:" ) );
394 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
395 generalLayout->addWidget( label, 6, 0 );
397 mAssistantWidget =
new KLineEdit;
398 label->setBuddy( mAssistantWidget );
399 generalLayout->addWidget( mAssistantWidget, 6, 1 );
402 label =
new QLabel( i18nc(
"@label The free/busy information of a contact",
"Free/Busy:" ) );
403 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
404 groupwareLayout->addWidget( label, 0, 0 );
406 mFreeBusyWidget =
new FreeBusyEditWidget;
407 label->setBuddy( mFreeBusyWidget );
408 groupwareLayout->addWidget( mFreeBusyWidget, 0, 1 );
409 groupwareLayout->setRowStretch( 1, 1 );
412 void ContactEditorWidget::Private::initGuiPersonalTab()
414 QWidget *widget =
new QWidget;
415 QVBoxLayout *layout =
new QVBoxLayout( widget );
417 mTabWidget->addTab( widget, i18nc(
"@title:tab Personal properties of a contact",
"Personal" ) );
419 QGroupBox *datesGroupBox =
new QGroupBox( i18nc(
"@title:group Date related properties of a contact",
"Dates" ) );
420 QGroupBox *familyGroupBox =
new QGroupBox( i18nc(
"@title:group Family related properties of a contact",
"Family" ) );
422 layout->addWidget( datesGroupBox );
423 layout->addWidget( familyGroupBox );
425 QGridLayout *datesLayout =
new QGridLayout( datesGroupBox );
426 QGridLayout *familyLayout =
new QGridLayout( familyGroupBox );
431 label =
new QLabel( i18nc(
"@label The birthdate of a contact",
"Birthdate:" ) );
432 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
433 datesLayout->addWidget( label, 0, 0 );
435 mBirthdateWidget =
new DateEditWidget( DateEditWidget::Birthday );
436 label->setBuddy( mBirthdateWidget );
437 datesLayout->addWidget( mBirthdateWidget, 0, 1 );
439 label =
new QLabel( i18nc(
"@label The wedding anniversary of a contact",
"Anniversary:" ) );
440 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
441 datesLayout->addWidget( label, 1, 0 );
443 mAnniversaryWidget =
new DateEditWidget( DateEditWidget::Anniversary );
444 label->setBuddy( mAnniversaryWidget );
445 datesLayout->addWidget( mAnniversaryWidget, 1, 1 );
447 datesLayout->setRowStretch( 2, 1 );
448 datesLayout->setColumnStretch( 1, 1 );
451 label =
new QLabel( i18nc(
"@label The partner's name of a contact",
"Partner's name:" ) );
452 label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
453 familyLayout->addWidget( label, 0, 0 );
455 mPartnerWidget =
new KLineEdit;
456 label->setBuddy( mPartnerWidget );
457 familyLayout->addWidget( mPartnerWidget, 0, 1 );
459 familyLayout->setRowStretch( 1, 1 );
462 void ContactEditorWidget::Private::initGuiNotesTab()
464 QWidget *widget =
new QWidget;
465 QVBoxLayout *layout =
new QVBoxLayout( widget );
467 mTabWidget->addTab( widget, i18nc(
"@title:tab",
"Notes" ) );
469 mNotesWidget =
new KTextEdit;
470 mNotesWidget->setAcceptRichText(
false);
471 layout->addWidget( mNotesWidget );
474 void ContactEditorWidget::Private::initGuiCustomFieldsTab()
476 QWidget *widget =
new QWidget;
477 QVBoxLayout *layout =
new QVBoxLayout( widget );
479 mTabWidget->addTab( widget, i18nc(
"@title:tab",
"Custom Fields" ) );
481 mCustomFieldsWidget =
new CustomFieldsEditWidget;
482 layout->addWidget( mCustomFieldsWidget );
485 void ContactEditorWidget::Private::loadCustomPages()
487 qDeleteAll( mCustomPages );
488 mCustomPages.clear();
490 const QString pluginDirectory = KStandardDirs::locate(
"lib", QLatin1String(
"akonadi/contact/editorpageplugins/" ) );
491 QDirIterator it( pluginDirectory, QDir::Files );
492 while ( it.hasNext() ) {
493 QPluginLoader loader( it.next() );
494 if ( !loader.load() ) {
503 mCustomPages.append( plugin );
507 mTabWidget->addTab( plugin, plugin->
title() );
511 QString ContactEditorWidget::Private::loadCustom(
const KABC::Addressee &contact,
const QString &key )
const 513 return contact.custom( QLatin1String(
"KADDRESSBOOK" ), key );
516 void ContactEditorWidget::Private::storeCustom( KABC::Addressee &contact,
const QString &key,
const QString &value )
const 518 if ( value.isEmpty() ) {
519 contact.removeCustom( QLatin1String(
"KADDRESSBOOK" ), key );
521 contact.insertCustom( QLatin1String(
"KADDRESSBOOK" ), key, value );
526 : d( new Private(
FullMode, this ) )
530 connect( d->mNameWidget, SIGNAL(nameChanged(KABC::Addressee)),
531 d->mDisplayNameWidget, SLOT(changeName(KABC::Addressee)) );
532 connect( d->mOrganizationWidget, SIGNAL(textChanged(QString)),
533 d->mDisplayNameWidget, SLOT(changeOrganization(QString)) );
537 : d(
new Private( displayMode,
this ) )
541 connect( d->mNameWidget, SIGNAL(nameChanged(KABC::Addressee)),
542 d->mDisplayNameWidget, SLOT(changeName(KABC::Addressee)) );
543 connect( d->mOrganizationWidget, SIGNAL(textChanged(QString)),
544 d->mDisplayNameWidget, SLOT(changeOrganization(QString)) );
555 d->mPhotoWidget->loadContact( contact );
556 d->mNameWidget->loadContact( contact );
557 d->mDisplayNameWidget->loadContact( contact );
558 d->mNickNameWidget->setText( contact.nickName() );
559 d->mPronunciationWidget->loadContact( contact );
562 d->mEmailWidget->loadContact( contact );
563 d->mHomepageWidget->setUrl( contact.url() );
564 d->mBlogWidget->setText( d->loadCustom( contact, QLatin1String(
"BlogFeed" ) ) );
565 d->mIMWidget->loadContact( contact );
568 d->mPhonesWidget->loadContact( contact );
571 d->mCategoriesWidget->loadContact( contact );
573 const QString mailPreferedFormatting = d->loadCustom( contact, QLatin1String(
"MailPreferedFormatting" ) );
574 if ( mailPreferedFormatting.isEmpty() ) {
575 d->mMailPreferFormatting->setCurrentIndex( 0 );
576 }
else if ( mailPreferedFormatting == QLatin1String(
"TEXT" ) ) {
577 d->mMailPreferFormatting->setCurrentIndex( 1 );
578 }
else if ( mailPreferedFormatting == QLatin1String(
"HTML" ) ) {
579 d->mMailPreferFormatting->setCurrentIndex( 2 );
581 d->mMailPreferFormatting->setCurrentIndex( 0 );
584 const QString mailAllowToRemoteContent = d->loadCustom( contact, QLatin1String(
"MailAllowToRemoteContent" ) );
585 d->mAllowRemoteContent->setChecked( mailAllowToRemoteContent == QLatin1String(
"TRUE" ) );
588 d->mAddressesWidget->loadContact( contact );
591 d->mCoordinatesWidget->loadContact( contact );
594 d->mLogoWidget->loadContact( contact );
595 d->mOrganizationWidget->setText( contact.organization() );
596 d->mProfessionWidget->setText( d->loadCustom( contact, QLatin1String(
"X-Profession" ) ) );
597 d->mTitleWidget->setText( contact.title() );
598 d->mDepartmentWidget->setText( contact.department() );
599 d->mOfficeWidget->setText( d->loadCustom( contact, QLatin1String(
"X-Office" ) ) );
600 d->mManagerWidget->setText( d->loadCustom( contact, QLatin1String(
"X-ManagersName" ) ) );
601 d->mAssistantWidget->setText( d->loadCustom( contact, QLatin1String(
"X-AssistantsName" ) ) );
604 d->mFreeBusyWidget->loadContact( contact );
607 d->mNotesWidget->setPlainText( contact.note() );
610 d->mBirthdateWidget->setDate( contact.birthday().date() );
611 d->mAnniversaryWidget->setDate( QDate::fromString( d->loadCustom( contact, QLatin1String(
"X-Anniversary" ) ),
615 d->mPartnerWidget->setText( d->loadCustom( contact, QLatin1String(
"X-SpousesName" ) ) );
622 d->mCustomFieldsWidget->loadContact( contact );
634 d->mPhotoWidget->storeContact( contact );
635 d->mNameWidget->storeContact( contact );
636 d->mDisplayNameWidget->storeContact( contact );
637 contact.setNickName( d->mNickNameWidget->text().trimmed() );
638 d->mPronunciationWidget->storeContact( contact );
641 d->mEmailWidget->storeContact( contact );
642 contact.setUrl( KUrl( d->mHomepageWidget->text().trimmed() ) );
643 d->storeCustom( contact, QLatin1String(
"BlogFeed" ), d->mBlogWidget->text().trimmed() );
644 d->mIMWidget->storeContact( contact );
647 d->mPhonesWidget->storeContact( contact );
650 d->mCategoriesWidget->storeContact( contact );
652 QString mailPreferedFormatting;
653 const int index = d->mMailPreferFormatting->currentIndex();
656 }
else if ( index == 1 ) {
657 mailPreferedFormatting = QLatin1String(
"TEXT" );
658 }
else if ( index == 2 ) {
659 mailPreferedFormatting = QLatin1String(
"HTML" );
661 d->storeCustom( contact, QLatin1String(
"MailPreferedFormatting" ), mailPreferedFormatting );
663 QString mailAllowToRemoteContent;
664 if ( d->mAllowRemoteContent->isChecked() ) {
665 mailAllowToRemoteContent = QLatin1String(
"TRUE" );
667 d->storeCustom( contact, QLatin1String(
"MailAllowToRemoteContent" ), mailAllowToRemoteContent );
670 d->mAddressesWidget->storeContact( contact );
673 d->mCoordinatesWidget->storeContact( contact );
676 d->mLogoWidget->storeContact( contact );
677 contact.setOrganization( d->mOrganizationWidget->text() );
678 d->storeCustom( contact, QLatin1String(
"X-Profession" ), d->mProfessionWidget->text().trimmed() );
679 contact.setTitle( d->mTitleWidget->text().trimmed() );
680 contact.setDepartment( d->mDepartmentWidget->text().trimmed() );
681 d->storeCustom( contact, QLatin1String(
"X-Office" ), d->mOfficeWidget->text().trimmed() );
682 d->storeCustom( contact, QLatin1String(
"X-ManagersName" ), d->mManagerWidget->text().trimmed() );
683 d->storeCustom( contact, QLatin1String(
"X-AssistantsName" ), d->mAssistantWidget->text().trimmed() );
686 d->mFreeBusyWidget->storeContact( contact );
689 contact.setNote( d->mNotesWidget->toPlainText() );
692 QDateTime birthday = QDateTime( d->mBirthdateWidget->date(), QTime(), contact.birthday().timeSpec() );
695 birthday.setTime( QTime() );
697 contact.setBirthday( birthday );
698 d->storeCustom( contact, QLatin1String(
"X-Anniversary" ), d->mAnniversaryWidget->date().toString( Qt::ISODate ) );
701 d->storeCustom( contact, QLatin1String(
"X-SpousesName" ), d->mPartnerWidget->text().trimmed() );
705 d->mCustomFieldsWidget->storeContact( contact );
720 d->mNameWidget->setReadOnly( readOnly );
721 d->mPhotoWidget->setReadOnly( readOnly );
722 d->mDisplayNameWidget->setReadOnly( readOnly );
723 d->mNickNameWidget->setReadOnly( readOnly );
724 d->mPronunciationWidget->setReadOnly( readOnly );
727 d->mEmailWidget->setReadOnly( readOnly );
728 d->mHomepageWidget->setReadOnly( readOnly );
729 d->mBlogWidget->setReadOnly( readOnly );
730 d->mIMWidget->setReadOnly( readOnly );
733 d->mPhonesWidget->setReadOnly( readOnly );
736 d->mCategoriesWidget->setReadOnly( readOnly );
739 d->mMailPreferFormatting->setEnabled( !readOnly );
740 d->mAllowRemoteContent->setEnabled( !readOnly );
743 d->mAddressesWidget->setReadOnly( readOnly );
746 d->mCoordinatesWidget->setReadOnly( readOnly );
749 d->mLogoWidget->setReadOnly( readOnly );
750 d->mOrganizationWidget->setReadOnly( readOnly );
751 d->mProfessionWidget->setReadOnly( readOnly );
752 d->mTitleWidget->setReadOnly( readOnly );
753 d->mDepartmentWidget->setReadOnly( readOnly );
754 d->mOfficeWidget->setReadOnly( readOnly );
755 d->mManagerWidget->setReadOnly( readOnly );
756 d->mAssistantWidget->setReadOnly( readOnly );
759 d->mFreeBusyWidget->setReadOnly( readOnly );
762 d->mNotesWidget->setReadOnly( readOnly );
765 d->mBirthdateWidget->setReadOnly( readOnly );
766 d->mAnniversaryWidget->setReadOnly( readOnly );
769 d->mPartnerWidget->setReadOnly( readOnly );
773 d->mCustomFieldsWidget->setReadOnly( readOnly );
virtual void loadContact(const KABC::Addressee &contact)=0
This method is called to fill the editor widget with the data from contact.
The base class for custom ContactEditor page plugins.
virtual void storeContact(KABC::Addressee &contact) const =0
This method is called to store the data from the editor widget into contact.
virtual QString title() const =0
Returns the i18n'd page title.
virtual void setReadOnly(bool readOnly)=0
This method is called to set the editor widget readOnly.