KMCollectionPropertiesDialog svn path=/trunk/KDE/kdepim/kmail/; revision=1199968wilder-work
parent
cfa5fc25e6
commit
54055a3c94
16 changed files with 51 additions and 152 deletions
@ -1,93 +0,0 @@ |
||||
/*
|
||||
This file is part of KMail, the KDE mail client. |
||||
Copyright (c) 2010 Montel Laurent <montel@kde.org> |
||||
|
||||
KMail is free software; you can redistribute it and/or modify it |
||||
under the terms of the GNU General Public License, version 2, as |
||||
published by the Free Software Foundation. |
||||
|
||||
KMail is distributed in the hope that it will be useful, but |
||||
WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License along |
||||
with this program; if not, write to the Free Software Foundation, Inc., |
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
*/ |
||||
|
||||
#include "kmcollectionpropertiesdialog.h" |
||||
#include "collectiontemplatespage.h" |
||||
#include "collectionmaintenancepage.h" |
||||
#include "collectiongeneralpage.h" |
||||
#include "collectionviewpage.h" |
||||
#include "collectionquotapage.h" |
||||
#include "collectionaclpage.h" |
||||
|
||||
#include <akonadi/cachepolicypage.h> |
||||
#include <akonadi/collectionmodifyjob.h> |
||||
|
||||
#include <ktabwidget.h> |
||||
|
||||
#include <QtGui/QBoxLayout> |
||||
|
||||
|
||||
KMCollectionPropertiesDialog::KMCollectionPropertiesDialog( const Akonadi::Collection &collection, QWidget *parent ) : |
||||
KDialog( parent ) |
||||
{ |
||||
mCollection = collection; |
||||
QBoxLayout *layout = new QHBoxLayout( mainWidget() ); |
||||
layout->setMargin( 0 ); |
||||
mTabWidget = new KTabWidget( mainWidget() ); |
||||
layout->addWidget( mTabWidget ); |
||||
|
||||
Akonadi::CollectionPropertiesPage *page = new CollectionGeneralPage( mTabWidget ); |
||||
insertPage( page ); |
||||
page = new CollectionViewPage( mTabWidget ); |
||||
insertPage( page ); |
||||
page = new Akonadi::CachePolicyPage( mTabWidget ); |
||||
insertPage( page ); |
||||
page = new CollectionTemplatesPage( mTabWidget ); |
||||
insertPage( page ); |
||||
page = new CollectionAclPage( mTabWidget ); |
||||
insertPage( page ); |
||||
page = new CollectionQuotaPage( mTabWidget ); |
||||
insertPage( page ); |
||||
page = new CollectionMaintenancePage( mTabWidget ); |
||||
insertPage( page ); |
||||
connect( this, SIGNAL( okClicked() ), SLOT( save() ) ); |
||||
connect( this, SIGNAL( cancelClicked() ), SLOT( deleteLater() ) ); |
||||
|
||||
} |
||||
|
||||
void KMCollectionPropertiesDialog::insertPage( Akonadi::CollectionPropertiesPage * page ) |
||||
{ |
||||
if ( page->canHandle( mCollection ) ) { |
||||
mTabWidget->addTab( page, page->pageTitle() ); |
||||
page->load( mCollection ); |
||||
} else { |
||||
delete page; |
||||
} |
||||
} |
||||
|
||||
void KMCollectionPropertiesDialog::save() |
||||
{ |
||||
for ( int i = 0; i < mTabWidget->count(); ++i ) { |
||||
Akonadi::CollectionPropertiesPage *page = static_cast<Akonadi::CollectionPropertiesPage*>( mTabWidget->widget( i ) ); |
||||
page->save( mCollection ); |
||||
} |
||||
|
||||
Akonadi::CollectionModifyJob *job = new Akonadi::CollectionModifyJob( mCollection, this ); |
||||
connect( job, SIGNAL( result( KJob* ) ), this, SLOT( saveResult( KJob* ) ) ); |
||||
} |
||||
|
||||
void KMCollectionPropertiesDialog::saveResult( KJob *job ) |
||||
{ |
||||
if ( job->error() ) { |
||||
// TODO
|
||||
kWarning() << job->errorString(); |
||||
} |
||||
deleteLater(); |
||||
} |
||||
|
||||
#include "kmcollectionpropertiesdialog.moc" |
||||
@ -1,50 +0,0 @@ |
||||
/*
|
||||
This file is part of KMail, the KDE mail client. |
||||
Copyright (c) 2010 Montel Laurent <montel@kde.org> |
||||
|
||||
KMail is free software; you can redistribute it and/or modify it |
||||
under the terms of the GNU General Public License, version 2, as |
||||
published by the Free Software Foundation. |
||||
|
||||
KMail is distributed in the hope that it will be useful, but |
||||
WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License along |
||||
with this program; if not, write to the Free Software Foundation, Inc., |
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
*/ |
||||
|
||||
#ifndef KMCOLLECTIONPROPERTIESDIALOG_H |
||||
#define KMCOLLECTIONPROPERTIESDIALOG_H |
||||
|
||||
#include <KDialog> |
||||
#include <KJob> |
||||
#include <Akonadi/Collection> |
||||
#include <Akonadi/CollectionPropertiesPage> |
||||
|
||||
class KTabWidget; |
||||
|
||||
class KMCollectionPropertiesDialog : public KDialog |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit KMCollectionPropertiesDialog( const Akonadi::Collection &collection, QWidget *parent = 0 ); |
||||
|
||||
protected: |
||||
void insertPage( Akonadi::CollectionPropertiesPage * page ); |
||||
|
||||
protected slots: |
||||
void save(); |
||||
void saveResult( KJob *job ); |
||||
|
||||
private: |
||||
Akonadi::Collection mCollection; |
||||
KTabWidget* mTabWidget; |
||||
|
||||
}; |
||||
|
||||
|
||||
#endif /* KMCOLLECTIONPROPERTIESDIALOG_H */ |
||||
|
||||
Loading…
Reference in new issue