• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

akonadi/contact

contacteditorwidget.cpp

00001 /*
00002     This file is part of Akonadi Contact.
00003 
00004     Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or modify it
00007     under the terms of the GNU Library General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or (at your
00009     option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful, but WITHOUT
00012     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014     License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to the
00018     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019     02110-1301, USA.
00020 */
00021 
00022 #include "contacteditorwidget.h"
00023 
00024 #include "addresseditwidget.h"
00025 #include "contacteditorpageplugin.h"
00026 #include "contactmetadata_p.h"
00027 #include "dateeditwidget.h"
00028 #include "displaynameeditwidget.h"
00029 #include "emaileditwidget.h"
00030 #include "freebusyeditwidget.h"
00031 #include "geoeditwidget.h"
00032 #include "imagewidget.h"
00033 #include "imeditwidget.h"
00034 #include "nameeditwidget.h"
00035 #include "phoneeditwidget.h"
00036 #include "soundeditwidget.h"
00037 
00038 #include <kconfig.h>
00039 #include <kconfiggroup.h>
00040 #include <klineedit.h>
00041 #include <klocale.h>
00042 #include <kstandarddirs.h>
00043 #include <ktabwidget.h>
00044 #include <ktextedit.h>
00045 #include <kurlrequester.h>
00046 
00047 #include <QtCore/QDirIterator>
00048 #include <QtCore/QPluginLoader>
00049 #include <QtGui/QGroupBox>
00050 #include <QtGui/QLabel>
00051 #include <QtGui/QLayout>
00052 
00053 class ContactEditorWidget::Private
00054 {
00055   public:
00056     Private( ContactEditorWidget *parent )
00057       : mParent( parent )
00058     {
00059     }
00060 
00061     void initGui();
00062     void initGuiContactTab();
00063     void initGuiLocationTab();
00064     void initGuiBusinessTab();
00065     void initGuiPersonalTab();
00066 
00067     void loadCustomPages();
00068 
00069     QString loadCustom( const KABC::Addressee &contact, const QString &key ) const;
00070     void storeCustom( KABC::Addressee &contact, const QString &key, const QString &value ) const;
00071 
00072     ContactEditorWidget *mParent;
00073     KTabWidget *mTabWidget;
00074 
00075     // widgets from name group
00076     NameEditWidget *mNameWidget;
00077     ImageWidget *mPhotoWidget;
00078     DisplayNameEditWidget *mDisplayNameWidget;
00079     KLineEdit *mNickNameWidget;
00080     SoundEditWidget *mPronunciationWidget;
00081 
00082     // widgets from Internet group
00083     EmailEditWidget *mEmailWidget;
00084     KLineEdit *mHomepageWidget;
00085     KLineEdit *mBlogWidget;
00086     IMEditWidget *mIMWidget;
00087 
00088     // widgets from phones group
00089     PhoneEditWidget *mPhonesWidget;
00090 
00091     // widgets from addresses group
00092     AddressEditWidget *mAddressesWidget;
00093 
00094     // widgets from coordinates group
00095     GeoEditWidget *mCoordinatesWidget;
00096 
00097     // widgets from general group
00098     ImageWidget *mLogoWidget;
00099     KLineEdit *mOrganizationWidget;
00100     KLineEdit *mProfessionWidget;
00101     KLineEdit *mTitleWidget;
00102     KLineEdit *mDepartmentWidget;
00103     KLineEdit *mOfficeWidget;
00104     KLineEdit *mManagerWidget;
00105     KLineEdit *mAssistantWidget;
00106 
00107     // widgets from groupware group
00108     FreeBusyEditWidget *mFreeBusyWidget;
00109 
00110     // widgets from notes group
00111     KTextEdit *mNotesWidget;
00112 
00113     // widgets from dates group
00114     DateEditWidget *mBirthdateWidget;
00115     DateEditWidget *mAnniversaryWidget;
00116 
00117     // widgets from family group
00118     KLineEdit *mPartnerWidget;
00119 
00120     // custom editor pages
00121     QList<Akonadi::ContactEditorPagePlugin*> mCustomPages;
00122 };
00123 
00124 void ContactEditorWidget::Private::initGui()
00125 {
00126   QVBoxLayout *layout = new QVBoxLayout( mParent );
00127   layout->setMargin( 0 );
00128 
00129   mTabWidget = new KTabWidget( mParent );
00130   layout->addWidget( mTabWidget );
00131 
00132   initGuiContactTab();
00133   initGuiLocationTab();
00134   initGuiBusinessTab();
00135   initGuiPersonalTab();
00136 
00137   loadCustomPages();
00138 }
00139 
00140 void ContactEditorWidget::Private::initGuiContactTab()
00141 {
00142   QWidget *widget = new QWidget;
00143   QVBoxLayout *layout = new QVBoxLayout( widget );
00144 
00145   mTabWidget->addTab( widget, i18n( "Contact" ) );
00146 
00147   QGroupBox *nameGroupBox = new QGroupBox( i18n( "Name" ) );
00148   QGroupBox *internetGroupBox = new QGroupBox( i18n( "Internet" ) );
00149   QGroupBox *phonesGroupBox = new QGroupBox( i18n( "Phones" ) );
00150 
00151   layout->addWidget( nameGroupBox );
00152   layout->addWidget( internetGroupBox );
00153   layout->addWidget( phonesGroupBox );
00154 
00155   QGridLayout *nameLayout = new QGridLayout( nameGroupBox );
00156   QGridLayout *internetLayout = new QGridLayout( internetGroupBox );
00157   QGridLayout *phonesLayout = new QGridLayout( phonesGroupBox );
00158 
00159   QLabel *label = 0;
00160 
00161   // setup name group box
00162   label = new QLabel( i18n( "Name:" ) );
00163   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00164   nameLayout->addWidget( label, 0, 0 );
00165 
00166   mNameWidget = new NameEditWidget;
00167   label->setBuddy( mNameWidget );
00168   nameLayout->addWidget( mNameWidget, 0, 1 );
00169 
00170   mPhotoWidget = new ImageWidget( ImageWidget::Photo );
00171   mPhotoWidget->setMinimumSize( QSize( 100, 140 ) );
00172   nameLayout->addWidget( mPhotoWidget, 0, 2, 4, 1 );
00173 
00174   label = new QLabel( i18n( "Display:" ) );
00175   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00176   nameLayout->addWidget( label, 1, 0 );
00177 
00178   mDisplayNameWidget = new DisplayNameEditWidget;
00179   label->setBuddy( mDisplayNameWidget );
00180   nameLayout->addWidget( mDisplayNameWidget, 1, 1 );
00181 
00182   label = new QLabel( i18n( "Nickname:" ) );
00183   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00184   nameLayout->addWidget( label, 2, 0 );
00185 
00186   mNickNameWidget = new KLineEdit;
00187   label->setBuddy( mNickNameWidget );
00188   nameLayout->addWidget( mNickNameWidget, 2, 1 );
00189 
00190   label = new QLabel( i18n( "Pronunciation:" ) );
00191   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00192   nameLayout->addWidget( label, 3, 0 );
00193 
00194   mPronunciationWidget = new SoundEditWidget;
00195   label->setBuddy( mPronunciationWidget );
00196   nameLayout->addWidget( mPronunciationWidget, 3, 1 );
00197 
00198   nameLayout->setRowStretch( 4, 1 );
00199 
00200   // setup Internet group box
00201   label = new QLabel( i18n( "Email:" ) );
00202   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00203   internetLayout->addWidget( label, 0, 0 );
00204 
00205   mEmailWidget = new EmailEditWidget;
00206   label->setBuddy( mEmailWidget );
00207   internetLayout->addWidget( mEmailWidget, 0, 1 );
00208 
00209   label = new QLabel( i18n( "Homepage:" ) );
00210   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00211   internetLayout->addWidget( label, 1, 0 );
00212 
00213   mHomepageWidget = new KLineEdit;
00214   label->setBuddy( mHomepageWidget );
00215   internetLayout->addWidget( mHomepageWidget, 1, 1 );
00216 
00217   label = new QLabel( i18n( "Blog:" ) );
00218   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00219   internetLayout->addWidget( label, 2, 0 );
00220 
00221   mBlogWidget = new KLineEdit;
00222   label->setBuddy( mBlogWidget );
00223   internetLayout->addWidget( mBlogWidget, 2, 1 );
00224 
00225   label = new QLabel( i18n( "Messaging:" ) );
00226   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00227   internetLayout->addWidget( label, 3, 0 );
00228 
00229   mIMWidget = new IMEditWidget;
00230   label->setBuddy( mIMWidget );
00231   internetLayout->addWidget( mIMWidget, 3, 1 );
00232 
00233   internetLayout->setRowStretch( 4, 1 );
00234 
00235   // setup phones group box
00236   mPhonesWidget = new PhoneEditWidget;
00237   phonesLayout->addWidget( mPhonesWidget, 0, 0 );
00238 
00239   phonesLayout->setRowStretch( 1, 1 );
00240 }
00241 
00242 void ContactEditorWidget::Private::initGuiLocationTab()
00243 {
00244   QWidget *widget = new QWidget;
00245   QVBoxLayout *layout = new QVBoxLayout( widget );
00246 
00247   mTabWidget->addTab( widget, i18n( "Location" ) );
00248 
00249   QGroupBox *addressesGroupBox = new QGroupBox( i18n( "Addresses" ) );
00250   QGroupBox *coordinatesGroupBox = new QGroupBox( i18n( "Coordinates" ) );
00251 
00252   layout->addWidget( addressesGroupBox );
00253   layout->addWidget( coordinatesGroupBox );
00254 
00255   QGridLayout *addressesLayout = new QGridLayout( addressesGroupBox );
00256   QGridLayout *coordinatesLayout = new QGridLayout( coordinatesGroupBox );
00257 
00258   // setup addresses group box
00259   mAddressesWidget = new AddressEditWidget( addressesGroupBox );
00260   mAddressesWidget->setMinimumHeight( 200 );
00261   addressesLayout->addWidget( mAddressesWidget, 0, 0 );
00262   addressesLayout->setRowStretch( 1, 1 );
00263 
00264   // setup coordinates group box
00265   mCoordinatesWidget = new GeoEditWidget;
00266   coordinatesLayout->addWidget( mCoordinatesWidget, 0, 0 );
00267   coordinatesLayout->setRowStretch( 1, 1 );
00268 }
00269 
00270 void ContactEditorWidget::Private::initGuiBusinessTab()
00271 {
00272   QWidget *widget = new QWidget;
00273   QVBoxLayout *layout = new QVBoxLayout( widget );
00274 
00275   mTabWidget->addTab( widget, i18n( "Business" ) );
00276 
00277   QGroupBox *generalGroupBox = new QGroupBox( i18n( "General" ) );
00278   QGroupBox *groupwareGroupBox = new QGroupBox( i18n( "Groupware" ) );
00279   QGroupBox *notesGroupBox = new QGroupBox( i18n( "Notes" ) );
00280 
00281   layout->addWidget( generalGroupBox );
00282   layout->addWidget( groupwareGroupBox );
00283   layout->addWidget( notesGroupBox );
00284 
00285   QGridLayout *generalLayout = new QGridLayout( generalGroupBox );
00286   QGridLayout *groupwareLayout = new QGridLayout( groupwareGroupBox );
00287   QGridLayout *notesLayout = new QGridLayout( notesGroupBox );
00288 
00289   QLabel *label = 0;
00290 
00291   // setup general group box
00292   mLogoWidget = new ImageWidget( ImageWidget::Logo );
00293   generalLayout->addWidget( mLogoWidget, 0, 2, 6, 1, Qt::AlignTop );
00294 
00295   label = new QLabel( i18n( "Organization:" ) );
00296   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00297   generalLayout->addWidget( label, 0, 0 );
00298 
00299   mOrganizationWidget = new KLineEdit;
00300   label->setBuddy( mOrganizationWidget );
00301   generalLayout->addWidget( mOrganizationWidget, 0, 1 );
00302 
00303   label = new QLabel( i18n( "Profession:" ) );
00304   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00305   generalLayout->addWidget( label, 1, 0 );
00306 
00307   mProfessionWidget = new KLineEdit;
00308   label->setBuddy( mProfessionWidget );
00309   generalLayout->addWidget( mProfessionWidget, 1, 1 );
00310 
00311   label = new QLabel( i18n( "Title:" ) );
00312   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00313   generalLayout->addWidget( label, 2, 0 );
00314 
00315   mTitleWidget = new KLineEdit;
00316   label->setBuddy( mTitleWidget );
00317   generalLayout->addWidget( mTitleWidget , 2, 1 );
00318 
00319   label = new QLabel( i18n( "Department:" ) );
00320   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00321   generalLayout->addWidget( label, 3, 0 );
00322 
00323   mDepartmentWidget = new KLineEdit;
00324   label->setBuddy( mDepartmentWidget );
00325   generalLayout->addWidget( mDepartmentWidget, 3, 1 );
00326 
00327   label = new QLabel( i18n( "Office:" ) );
00328   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00329   generalLayout->addWidget( label, 4, 0 );
00330 
00331   mOfficeWidget = new KLineEdit;
00332   label->setBuddy( mOfficeWidget );
00333   generalLayout->addWidget( mOfficeWidget, 4, 1 );
00334 
00335   label = new QLabel( i18n( "Manager's name:" ) );
00336   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00337   generalLayout->addWidget( label, 5, 0 );
00338 
00339   mManagerWidget = new KLineEdit;
00340   label->setBuddy( mManagerWidget );
00341   generalLayout->addWidget( mManagerWidget, 5, 1 );
00342 
00343   label = new QLabel( i18n( "Assistant's name:" ) );
00344   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00345   generalLayout->addWidget( label, 6, 0 );
00346 
00347   mAssistantWidget = new KLineEdit;
00348   label->setBuddy( mAssistantWidget );
00349   generalLayout->addWidget( mAssistantWidget, 6, 1 );
00350 
00351   // setup groupware group box
00352   label = new QLabel( i18n( "Free/Busy:" ) );
00353   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00354   groupwareLayout->addWidget( label, 0, 0 );
00355 
00356   mFreeBusyWidget = new FreeBusyEditWidget;
00357   label->setBuddy( mFreeBusyWidget );
00358   groupwareLayout->addWidget( mFreeBusyWidget, 0, 1 );
00359 
00360   // setup notes group box
00361   mNotesWidget = new KTextEdit;
00362   notesLayout->addWidget( mNotesWidget, 0, 0 );
00363 }
00364 
00365 void ContactEditorWidget::Private::initGuiPersonalTab()
00366 {
00367   QWidget *widget = new QWidget;
00368   QVBoxLayout *layout = new QVBoxLayout( widget );
00369 
00370   mTabWidget->addTab( widget, i18n( "Personal" ) );
00371 
00372   QGroupBox *datesGroupBox = new QGroupBox( i18n( "Dates" ) );
00373   QGroupBox *familyGroupBox = new QGroupBox( i18n( "Family" ) );
00374 
00375   layout->addWidget( datesGroupBox );
00376   layout->addWidget( familyGroupBox );
00377 
00378   QGridLayout *datesLayout = new QGridLayout( datesGroupBox );
00379   QGridLayout *familyLayout = new QGridLayout( familyGroupBox );
00380 
00381   QLabel *label = 0;
00382 
00383   // setup dates group box
00384   label = new QLabel( i18n( "Birthdate:" ) );
00385   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00386   datesLayout->addWidget( label, 0, 0 );
00387 
00388   mBirthdateWidget = new DateEditWidget( DateEditWidget::Birthday );
00389   label->setBuddy( mBirthdateWidget );
00390   datesLayout->addWidget( mBirthdateWidget, 0, 1 );
00391 
00392   label = new QLabel( i18n( "Anniversary:" ) );
00393   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00394   datesLayout->addWidget( label, 1, 0 );
00395 
00396   mAnniversaryWidget = new DateEditWidget( DateEditWidget::Anniversary );
00397   label->setBuddy( mAnniversaryWidget );
00398   datesLayout->addWidget( mAnniversaryWidget, 1, 1 );
00399 
00400   datesLayout->setRowStretch( 2, 1 );
00401   datesLayout->setColumnStretch( 1, 1 );
00402 
00403   // widgets from family group
00404   label = new QLabel( i18n( "Partner's name:" ) );
00405   label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
00406   familyLayout->addWidget( label, 0, 0 );
00407 
00408   mPartnerWidget = new KLineEdit;
00409   label->setBuddy( mPartnerWidget );
00410   familyLayout->addWidget( mPartnerWidget, 0, 1 );
00411 
00412   familyLayout->setRowStretch( 1, 1 );
00413 }
00414 
00415 void ContactEditorWidget::Private::loadCustomPages()
00416 {
00417   qDeleteAll( mCustomPages );
00418   mCustomPages.clear();
00419 
00420   const QString pluginDirectory = KStandardDirs::locate( "lib", QLatin1String( "akonadi/contact/editorpageplugins/" ) );
00421   QDirIterator it( pluginDirectory, QDir::Files );
00422   while ( it.hasNext() ) {
00423     QPluginLoader loader( it.next() );
00424     if ( !loader.load() )
00425       continue;
00426 
00427     Akonadi::ContactEditorPagePlugin *plugin = qobject_cast<Akonadi::ContactEditorPagePlugin*>( loader.instance() );
00428     if ( !plugin )
00429       continue;
00430 
00431     mCustomPages.append( plugin );
00432   }
00433 
00434   foreach ( Akonadi::ContactEditorPagePlugin *plugin, mCustomPages )
00435     mTabWidget->addTab( plugin, plugin->title() );
00436 }
00437 
00438 QString ContactEditorWidget::Private::loadCustom( const KABC::Addressee &contact, const QString &key ) const
00439 {
00440   return contact.custom( QLatin1String( "KADDRESSBOOK" ), key );
00441 }
00442 
00443 void ContactEditorWidget::Private::storeCustom( KABC::Addressee &contact, const QString &key, const QString &value ) const
00444 {
00445   if ( value.isEmpty() )
00446     contact.removeCustom( QLatin1String( "KADDRESSBOOK" ), key );
00447   else
00448     contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), key, value );
00449 }
00450 
00451 ContactEditorWidget::ContactEditorWidget( QWidget* )
00452   : d( new Private( this ) )
00453 {
00454   d->initGui();
00455 
00456   connect( d->mNameWidget, SIGNAL( nameChanged( const KABC::Addressee& ) ),
00457            d->mDisplayNameWidget, SLOT( changeName( const KABC::Addressee& ) ) );
00458   connect( d->mOrganizationWidget, SIGNAL( textChanged( const QString& ) ),
00459            d->mDisplayNameWidget, SLOT( changeOrganization( const QString& ) ) );
00460 }
00461 
00462 ContactEditorWidget::~ContactEditorWidget()
00463 {
00464   delete d;
00465 }
00466 
00467 void ContactEditorWidget::loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData )
00468 {
00469   // name group
00470   d->mPhotoWidget->loadContact( contact );
00471   d->mNameWidget->loadContact( contact );
00472   d->mDisplayNameWidget->loadContact( contact );
00473   d->mNickNameWidget->setText( contact.nickName() );
00474   d->mPronunciationWidget->loadContact( contact );
00475 
00476   // Internet group
00477   d->mEmailWidget->loadContact( contact );
00478   d->mHomepageWidget->setUrl( contact.url() );
00479   d->mBlogWidget->setText( d->loadCustom( contact, QLatin1String( "BlogFeed" ) ) );
00480   d->mIMWidget->loadContact( contact );
00481 
00482   // phones group
00483   d->mPhonesWidget->loadContact( contact );
00484 
00485   // address group
00486   d->mAddressesWidget->loadContact( contact );
00487 
00488   // coordinates group
00489   d->mCoordinatesWidget->loadContact( contact );
00490 
00491   // general group
00492   d->mLogoWidget->loadContact( contact );
00493   d->mOrganizationWidget->setText( contact.organization() );
00494   d->mProfessionWidget->setText( d->loadCustom( contact, QLatin1String( "X-Profession" ) ) );
00495   d->mTitleWidget->setText( contact.title() );
00496   d->mDepartmentWidget->setText( contact.department() );
00497   d->mOfficeWidget->setText( d->loadCustom( contact, QLatin1String( "X-Office" ) ) );
00498   d->mManagerWidget->setText( d->loadCustom( contact, QLatin1String( "X-ManagersName" ) ) );
00499   d->mAssistantWidget->setText( d->loadCustom( contact, QLatin1String( "X-AssistantsName" ) ) );
00500 
00501   // groupware group
00502   d->mFreeBusyWidget->loadContact( contact );
00503 
00504   // notes group
00505   d->mNotesWidget->setPlainText( contact.note() );
00506 
00507   // dates group
00508   d->mBirthdateWidget->setDate( contact.birthday().date() );
00509   d->mAnniversaryWidget->setDate( QDate::fromString( d->loadCustom( contact, QLatin1String( "X-Anniversary" ) ),
00510                                                      Qt::ISODate ) );
00511 
00512   // family group
00513   d->mPartnerWidget->setText( d->loadCustom( contact, QLatin1String( "X-SpousesName" ) ) );
00514 
00515   d->mDisplayNameWidget->setDisplayType( (DisplayNameEditWidget::DisplayType)metaData.displayNameMode() );
00516 
00517   // custom pages
00518   foreach ( Akonadi::ContactEditorPagePlugin *plugin, d->mCustomPages )
00519     plugin->loadContact( contact );
00520 }
00521 
00522 void ContactEditorWidget::storeContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const
00523 {
00524   // name group
00525   d->mPhotoWidget->storeContact( contact );
00526   d->mNameWidget->storeContact( contact );
00527   d->mDisplayNameWidget->storeContact( contact );
00528   contact.setNickName( d->mNickNameWidget->text().trimmed() );
00529   d->mPronunciationWidget->storeContact( contact );
00530 
00531   // Internet group
00532   d->mEmailWidget->storeContact( contact );
00533   contact.setUrl( KUrl( d->mHomepageWidget->text().trimmed() ) );
00534   d->storeCustom( contact, QLatin1String( "BlogFeed" ), d->mBlogWidget->text().trimmed() );
00535   d->mIMWidget->storeContact( contact );
00536 
00537   // phones group
00538   d->mPhonesWidget->storeContact( contact );
00539 
00540   // address group
00541   d->mAddressesWidget->storeContact( contact );
00542 
00543   // coordinates group
00544   d->mCoordinatesWidget->storeContact( contact );
00545 
00546   // general group
00547   d->mLogoWidget->storeContact( contact );
00548   contact.setOrganization( d->mOrganizationWidget->text() );
00549   d->storeCustom( contact, QLatin1String( "X-Profession" ), d->mProfessionWidget->text().trimmed() );
00550   contact.setTitle( d->mTitleWidget->text().trimmed() );
00551   contact.setDepartment( d->mDepartmentWidget->text().trimmed() );
00552   d->storeCustom( contact, QLatin1String( "X-Office" ), d->mOfficeWidget->text().trimmed() );
00553   d->storeCustom( contact, QLatin1String( "X-ManagersName" ), d->mManagerWidget->text().trimmed() );
00554   d->storeCustom( contact, QLatin1String( "X-AssistantsName" ), d->mAssistantWidget->text().trimmed() );
00555 
00556   // groupware group
00557   d->mFreeBusyWidget->storeContact( contact );
00558 
00559   // notes group
00560   contact.setNote( d->mNotesWidget->toPlainText() );
00561 
00562   // dates group
00563   contact.setBirthday( QDateTime( d->mBirthdateWidget->date(), QTime(), contact.birthday().timeSpec() ) );
00564   d->storeCustom( contact, QLatin1String( "X-Anniversary" ), d->mAnniversaryWidget->date().toString( Qt::ISODate ) );
00565 
00566   // family group
00567   d->storeCustom( contact, QLatin1String( "X-SpousesName" ), d->mPartnerWidget->text().trimmed() );
00568 
00569   metaData.setDisplayNameMode( d->mDisplayNameWidget->displayType() );
00570 
00571   // custom pages
00572   foreach ( Akonadi::ContactEditorPagePlugin *plugin, d->mCustomPages )
00573     plugin->storeContact( contact );
00574 }
00575 
00576 void ContactEditorWidget::setReadOnly( bool readOnly )
00577 {
00578   // widgets from name group
00579   d->mNameWidget->setReadOnly( readOnly );
00580   d->mPhotoWidget->setReadOnly( readOnly );
00581   d->mDisplayNameWidget->setReadOnly( readOnly );
00582   d->mNickNameWidget->setReadOnly( readOnly );
00583   d->mPronunciationWidget->setReadOnly( readOnly );
00584 
00585   // widgets from Internet group
00586   d->mEmailWidget->setReadOnly( readOnly );
00587   d->mHomepageWidget->setReadOnly( readOnly );
00588   d->mBlogWidget->setReadOnly( readOnly );
00589   d->mIMWidget->setReadOnly( readOnly );
00590 
00591   // widgets from phones group
00592   d->mPhonesWidget->setReadOnly( readOnly );
00593 
00594   // widgets from addresses group
00595   d->mAddressesWidget->setReadOnly( readOnly );
00596 
00597   // widgets from coordinates group
00598   d->mCoordinatesWidget->setReadOnly( readOnly );
00599 
00600   // widgets from general group
00601   d->mLogoWidget->setReadOnly( readOnly );
00602   d->mOrganizationWidget->setReadOnly( readOnly );
00603   d->mProfessionWidget->setReadOnly( readOnly );
00604   d->mTitleWidget->setReadOnly( readOnly );
00605   d->mDepartmentWidget->setReadOnly( readOnly );
00606   d->mOfficeWidget->setReadOnly( readOnly );
00607   d->mManagerWidget->setReadOnly( readOnly );
00608   d->mAssistantWidget->setReadOnly( readOnly );
00609 
00610   // widgets from groupware group
00611   d->mFreeBusyWidget->setReadOnly( readOnly );
00612 
00613   // widgets from notes group
00614   d->mNotesWidget->setReadOnly( readOnly );
00615 
00616   // widgets from dates group
00617   d->mBirthdateWidget->setReadOnly( readOnly );
00618   d->mAnniversaryWidget->setReadOnly( readOnly );
00619 
00620   // widgets from family group
00621   d->mPartnerWidget->setReadOnly( readOnly );
00622 
00623   // custom pages
00624   foreach ( Akonadi::ContactEditorPagePlugin *plugin, d->mCustomPages )
00625     plugin->setReadOnly( readOnly );
00626 }

akonadi/contact

Skip menu "akonadi/contact"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal