akonadi/contact
contactgroupeditor.h
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 #ifndef AKONADI_CONTACTGROUPEDITOR_H 00023 #define AKONADI_CONTACTGROUPEDITOR_H 00024 00025 #include "akonadi-contact_export.h" 00026 00027 #include <QtGui/QWidget> 00028 00029 namespace KABC { 00030 class ContactGroup; 00031 } 00032 00033 namespace Akonadi { 00034 00035 class Collection; 00036 class Item; 00037 00082 class AKONADI_CONTACT_EXPORT ContactGroupEditor : public QWidget 00083 { 00084 Q_OBJECT 00085 00086 public: 00090 enum Mode 00091 { 00092 CreateMode, 00093 EditMode 00094 }; 00095 00102 explicit ContactGroupEditor( Mode mode, QWidget *parent = 0 ); 00103 00107 virtual ~ContactGroupEditor(); 00108 00115 void setContactGroupTemplate( const KABC::ContactGroup &group ); 00116 00121 void setDefaultAddressBook( const Akonadi::Collection &addressbook ); 00122 00123 public Q_SLOTS: 00127 void loadContactGroup( const Akonadi::Item &group ); 00128 00134 bool saveContactGroup(); 00135 00136 Q_SIGNALS: 00141 void contactGroupStored( const Akonadi::Item &group ); 00142 00148 void error( const QString &errorMsg ); 00149 00150 private: 00151 //@cond PRIVATE 00152 friend class ContactGroupEditorDialog; 00153 00154 class Private; 00155 Private* const d; 00156 00157 Q_DISABLE_COPY( ContactGroupEditor ) 00158 00159 Q_PRIVATE_SLOT( d, void itemFetchDone( KJob* ) ) 00160 Q_PRIVATE_SLOT( d, void parentCollectionFetchDone( KJob* ) ) 00161 Q_PRIVATE_SLOT( d, void storeDone( KJob* ) ) 00162 Q_PRIVATE_SLOT( d, void itemChanged( const Akonadi::Item&, const QSet<QByteArray>& ) ) 00163 Q_PRIVATE_SLOT( d, void adaptHeaderSizes() ) 00164 //@endcond 00165 }; 00166 00167 } 00168 00169 #endif