Embed "Mailing List Management" into "Folder Properties"

The original action (in the "Folder" menu bar menu) remains
present, it opens the "Folder Properties" dialogue at the
appropriate tab.

This requires commit ea9a9a132e09d2ac1bd359bcccf68cdde3b3c566
to kdepimlibs.

CCBUG:115611
REVIEW:107341
wilder-work
Jonathan Marten 14 years ago
parent 93d324e0cd
commit d503db4cbb
  1. 2
      CMakeLists.txt
  2. 238
      collectionmailinglistpage.cpp
  3. 91
      collectionmailinglistpage.h
  4. 31
      kmmainwidget.cpp
  5. 2
      kmmainwidget.h
  6. 86
      mailinglistpropertiesdialog.h

@ -68,6 +68,7 @@ if (NOT WINCE AND KDEPIM_BUILD_DESKTOP)
collectionviewpage.cpp
collectionquotapage.cpp
collectionquotapage_p.cpp
collectionmailinglistpage.cpp
colorlistbox.cpp
kmmainwin.cpp
configagentdelegate.cpp
@ -98,7 +99,6 @@ if (NOT WINCE AND KDEPIM_BUILD_DESKTOP)
codecaction.cpp
codecmanager.cpp
foldershortcutdialog.cpp
mailinglistpropertiesdialog.cpp
util.cpp
messageactions.cpp
statusbarlabel.cpp

@ -1,149 +1,134 @@
/*******************************************************************************
**
** Filename : mailinglistpropertiesdialog.cpp
** Created on : 30 January, 2005
** Copyright : (c) 2005 Till Adam
** Email : adam@kde.org
**
*******************************************************************************/
/*******************************************************************************
** Copyright (c) 2011 Montel Laurent <montel@kde.org>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** In addition, as a special exception, the copyright holders give
** permission to link the code of this program with any edition of
** the Qt library by Trolltech AS, Norway (or with modified versions
** of Qt that use the same license as Qt), and distribute linked
** combinations including the two. You must obey the GNU General
** Public License in all respects for all of the code used other than
** Qt. If you modify this file, you may extend this exception to
** your version of the file, but you are not obligated to do so. If
** you do not wish to do so, delete this exception statement from
** your version.
*******************************************************************************/
#include "mailinglistpropertiesdialog.h"
/* -*- mode: C++; c-file-style: "gnu" -*-
This file is part of KMail, the KDE mail client.
Copyright (c) 2005 Till Adam <adam@kde.org>
Copyright (c) 2011 Montel Laurent <montel@kde.org>
Copyright (c) 2012 Jonathan Marten <jjm@keelhaul.me.uk>
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 "collectionmailinglistpage.h"
#include "kmkernel.h"
#include "mailkernel.h"
#include "mailutil.h"
#include "util.h"
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/kmime/messageparts.h>
#include <QGridLayout>
#include <QLabel>
#include <QGroupBox>
#include <QCheckBox>
#include <QGroupBox>
#include <QPushButton>
#include <QSpacerItem>
#include <QVBoxLayout>
#include <QGridLayout>
#include <kcombobox.h>
#include <klocale.h>
#include <keditlistwidget.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include "mailutil.h"
#include "util.h"
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/kmime/messageparts.h>
#include <KComboBox>
#include <KDialog>
#include <KEditListWidget>
#include <KLocale>
#include <KMessageBox>
#include <KSqueezedTextLabel>
using namespace KMail;
using namespace MailCommon;
MailingListFolderPropertiesDialog::MailingListFolderPropertiesDialog( QWidget* parent, const QSharedPointer<FolderCollection> &col )
: KDialog( parent ),
mFolder( col )
CollectionMailingListPage::CollectionMailingListPage(QWidget * parent) :
CollectionPropertiesPage( parent )
{
setCaption( i18n( "Mailinglist Folder Properties" ) );
setButtons( Ok | Cancel );
setObjectName( "mailinglist_properties" );
setModal( false );
setAttribute( Qt::WA_DeleteOnClose );
QLabel* label;
mLastItem = 0;
setObjectName( QLatin1String( "KMail::CollectionMailingListPage" ) );
setPageTitle( i18nc( "@title:tab Mailing list settings for a folder.", "Mailing List" ) );
}
connect( this, SIGNAL(okClicked()), SLOT(slotOk()) );
CollectionMailingListPage::~CollectionMailingListPage()
{
}
QVBoxLayout *topLayout = new QVBoxLayout( mainWidget() );
topLayout->setObjectName( "topLayout" );
topLayout->setSpacing( spacingHint() );
bool CollectionMailingListPage::canHandle( const Akonadi::Collection &col ) const
{
QSharedPointer<FolderCollection> fd = FolderCollection::forCollection( col, false );
return ( !CommonKernel->isSystemFolderCollection( col ) &&
!fd->isStructural() );
}
QGroupBox *mlGroup = new QGroupBox( i18n("Associated Mailing List" ), this );
void CollectionMailingListPage::init(const Akonadi::Collection & col)
{
mCurrentCollection = col;
mFolder = FolderCollection::forCollection( col, false );
mLastItem = 0;
// mlGroup->setColumnLayout( 0, Qt::Vertical );
QGridLayout *groupLayout = new QGridLayout( mlGroup );
//mlGroup->layout()->addItem( groupLayout );
groupLayout->setSpacing( spacingHint() );
topLayout->addWidget( mlGroup );
setMainWidget( mlGroup );
QVBoxLayout *topLayout = new QVBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
mHoldsMailingList = new QCheckBox( i18n("&Folder holds a mailing list"), mlGroup );
mHoldsMailingList = new QCheckBox( i18n("Folder holds a mailing list"), this );
connect( mHoldsMailingList, SIGNAL(toggled(bool)),
SLOT(slotHoldsML(bool)) );
groupLayout->addWidget( mHoldsMailingList, 0, 0, 1, 3 );
topLayout->addWidget( mHoldsMailingList );
groupLayout->addItem( new QSpacerItem( 0, 10 ), 1, 0 );
mGroupWidget = new QWidget( this );
QGridLayout *groupLayout = new QGridLayout( mGroupWidget );
groupLayout->setSpacing( KDialog::spacingHint() );
mDetectButton = new QPushButton( i18n("Detect Automatically"), mlGroup );
mDetectButton->setEnabled( false );
mDetectButton = new QPushButton( i18n("Detect Automatically"), mGroupWidget );
connect( mDetectButton, SIGNAL(pressed()),
SLOT(slotDetectMailingList()) );
groupLayout->addWidget( mDetectButton, 2, 1 );
groupLayout->addItem( new QSpacerItem( 0, 10 ), 3, 0 );
label = new QLabel( i18n("Mailing list description:"), mlGroup );
label->setEnabled( false );
connect( mHoldsMailingList, SIGNAL(toggled(bool)),
label, SLOT(setEnabled(bool)) );
QLabel *label = new QLabel( i18n("Mailing list description:"), mGroupWidget );
groupLayout->addWidget( label, 4, 0 );
mMLId = new QLabel( "", mlGroup );
mMLId->setBuddy( label );
mMLId = new KSqueezedTextLabel( "", mGroupWidget );
mMLId->setTextElideMode( Qt::ElideRight );
groupLayout->addWidget( mMLId, 4, 1, 1, 2 );
mMLId->setEnabled( false );
//FIXME: add QWhatsThis
label = new QLabel( i18n("Preferred handler:"), mlGroup );
label->setEnabled(false);
connect( mHoldsMailingList, SIGNAL(toggled(bool)),
label, SLOT(setEnabled(bool)) );
label = new QLabel( i18n("Preferred handler:"), mGroupWidget );
groupLayout->addWidget( label, 5, 0 );
mMLHandlerCombo = new KComboBox( mlGroup );
mMLHandlerCombo = new KComboBox( mGroupWidget );
mMLHandlerCombo->addItem( i18n("KMail"), MailingList::KMail );
mMLHandlerCombo->addItem( i18n("Browser"), MailingList::Browser );
mMLHandlerCombo->setEnabled( false );
groupLayout->addWidget( mMLHandlerCombo, 5, 1, 1, 2 );
connect( mMLHandlerCombo, SIGNAL(activated(int)),
SLOT(slotMLHandling(int)) );
label->setBuddy( mMLHandlerCombo );
label = new QLabel( i18n("&Address type:"), mlGroup );
label->setEnabled(false);
connect( mHoldsMailingList, SIGNAL(toggled(bool)),
label, SLOT(setEnabled(bool)) );
label = new QLabel( i18n("Address type:"), mGroupWidget );
groupLayout->addWidget( label, 6, 0 );
mAddressCombo = new KComboBox( mlGroup );
mAddressCombo = new KComboBox( mGroupWidget );
label->setBuddy( mAddressCombo );
groupLayout->addWidget( mAddressCombo, 6, 1 );
mAddressCombo->setEnabled( false );
//FIXME: if the mailing list actions have either KAction's or toolbar buttons
// associated with them - remove this button since it's really silly
// here
QPushButton *handleButton = new QPushButton( i18n( "Invoke Handler" ), mlGroup );
handleButton->setEnabled( false );
QPushButton *handleButton = new QPushButton( i18n( "Invoke Handler" ), mGroupWidget );
if( mFolder)
{
connect( mHoldsMailingList, SIGNAL(toggled(bool)),
handleButton, SLOT(setEnabled(bool)) );
connect( handleButton, SIGNAL(clicked()),
SLOT(slotInvokeHandler()) );
} else {
handleButton->setEnabled( false );
}
groupLayout->addWidget( handleButton, 6, 2 );
mEditList = new KEditListWidget( mlGroup );
mEditList->setEnabled( false );
mEditList = new KEditListWidget( mGroupWidget );
groupLayout->addWidget( mEditList, 7, 0, 1, 4 );
QStringList el;
@ -159,36 +144,29 @@ MailingListFolderPropertiesDialog::MailingListFolderPropertiesDialog( QWidget* p
connect( mAddressCombo, SIGNAL(activated(int)),
SLOT(slotAddressChanged(int)) );
load();
resize( QSize(295, 204).expandedTo(minimumSizeHint()) );
setAttribute(Qt::WA_WState_Polished);
topLayout->addWidget( mGroupWidget );
mGroupWidget->setEnabled( false );
}
MailingListFolderPropertiesDialog::~MailingListFolderPropertiesDialog()
void CollectionMailingListPage::load( const Akonadi::Collection & col )
{
}
init( col );
void MailingListFolderPropertiesDialog::slotOk()
{
save();
}
void MailingListFolderPropertiesDialog::load()
{
if ( mFolder )
mMailingList = mFolder->mailingList();
mMLId->setText( (mMailingList.id().isEmpty() ? i18n("Not available") : mMailingList.id()) );
mMLHandlerCombo->setCurrentIndex( mMailingList.handler() );
mEditList->insertStringList( mMailingList.postUrls().toStringList() );
mAddressCombo->setCurrentIndex( mLastItem );
mHoldsMailingList->setChecked( mFolder && mFolder->isMailingListEnabled() );
slotHoldsML( mHoldsMailingList->isChecked() );
}
//-----------------------------------------------------------------------------
void MailingListFolderPropertiesDialog::save()
void CollectionMailingListPage::save( Akonadi::Collection & col )
{
if( mFolder )
if ( mFolder )
{
// settings for mailingList
mFolder->setMailingListEnabled( mHoldsMailingList && mHoldsMailingList->isChecked() );
@ -198,18 +176,14 @@ void MailingListFolderPropertiesDialog::save()
}
//----------------------------------------------------------------------------
void MailingListFolderPropertiesDialog::slotHoldsML( bool holdsML )
void CollectionMailingListPage::slotHoldsML( bool holdsML )
{
mMLHandlerCombo->setEnabled( holdsML );
if ( mFolder && mFolder->count() )
mDetectButton->setEnabled( holdsML );
mAddressCombo->setEnabled( holdsML );
mEditList->setEnabled( holdsML );
mMLId->setEnabled( holdsML );
mGroupWidget->setEnabled( holdsML );
mDetectButton->setEnabled( mFolder && mFolder->count()!=0 );
}
//----------------------------------------------------------------------------
void MailingListFolderPropertiesDialog::slotDetectMailingList()
void CollectionMailingListPage::slotDetectMailingList()
{
if ( !mFolder ) return; // in case the folder was just created
@ -231,7 +205,7 @@ void MailingListFolderPropertiesDialog::slotDetectMailingList()
}
void MailingListFolderPropertiesDialog::slotFetchDone( KJob* job )
void CollectionMailingListPage::slotFetchDone( KJob* job )
{
mDetectButton->setEnabled( true );
if ( MailCommon::Util::showJobErrorMessage(job) ) {
@ -240,7 +214,6 @@ void MailingListFolderPropertiesDialog::slotFetchDone( KJob* job )
Akonadi::ItemFetchJob *fjob = dynamic_cast<Akonadi::ItemFetchJob*>( job );
Q_ASSERT( fjob );
Akonadi::Item::List items = fjob->items();
const int maxchecks = 5;
int num = items.size();
for ( int i = --num ; ( i > num - maxchecks ) && ( i >= 0 ); --i ) {
@ -253,9 +226,14 @@ void MailingListFolderPropertiesDialog::slotFetchDone( KJob* job )
}
}
if ( !(mMailingList.features() & MailingList::Post) ) {
KMessageBox::error( this,
i18n("KMail was unable to detect a mailing list in this folder. "
"Please fill the addresses by hand.") );
if ( mMailingList.features() == MailingList::None ) {
KMessageBox::error( this,
i18n("KMail was unable to detect any mailing list in this folder.") );
} else {
KMessageBox::error( this,
i18n("KMail was unable to fully detect a mailing list in this folder. "
"Please fill in the addresses by hand.") );
}
} else {
mMLId->setText( (mMailingList.id().isEmpty() ? i18n("Not available.") : mMailingList.id() ) );
fillEditBox();
@ -264,13 +242,13 @@ void MailingListFolderPropertiesDialog::slotFetchDone( KJob* job )
}
//----------------------------------------------------------------------------
void MailingListFolderPropertiesDialog::slotMLHandling( int element )
void CollectionMailingListPage::slotMLHandling( int element )
{
mMailingList.setHandler( static_cast<MailingList::Handler>( element ) );
}
//----------------------------------------------------------------------------
void MailingListFolderPropertiesDialog::slotAddressChanged( int i )
void CollectionMailingListPage::slotAddressChanged( int i )
{
fillMLFromWidgets();
fillEditBox();
@ -278,7 +256,7 @@ void MailingListFolderPropertiesDialog::slotAddressChanged( int i )
}
//----------------------------------------------------------------------------
void MailingListFolderPropertiesDialog::fillMLFromWidgets()
void CollectionMailingListPage::fillMLFromWidgets()
{
if ( !mHoldsMailingList->isChecked() )
return;
@ -325,7 +303,7 @@ void MailingListFolderPropertiesDialog::fillMLFromWidgets()
}
}
void MailingListFolderPropertiesDialog::fillEditBox()
void CollectionMailingListPage::fillEditBox()
{
mEditList->clear();
switch ( mAddressCombo->currentIndex() ) {
@ -349,9 +327,9 @@ void MailingListFolderPropertiesDialog::fillEditBox()
}
}
void MailingListFolderPropertiesDialog::slotInvokeHandler()
void CollectionMailingListPage::slotInvokeHandler()
{
save();
save( mCurrentCollection );
switch ( mAddressCombo->currentIndex() ) {
case 0:
KMail::Util::mailingListPost( mFolder );
@ -373,4 +351,4 @@ void MailingListFolderPropertiesDialog::slotInvokeHandler()
}
}
#include "mailinglistpropertiesdialog.moc"
#include "collectionmailinglistpage.moc"

@ -0,0 +1,91 @@
/* -*- mode: C++; c-file-style: "gnu" -*-
This file is part of KMail, the KDE mail client.
Copyright (c) 2005 Till Adam <adam@kde.org>
Copyright (c) 2011 Montel Laurent <montel@kde.org>
Copyright (c) 2012 Jonathan Marten <jjm@keelhaul.me.uk>
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 COLLECTIONMAILINGLISTPAGE_H
#define COLLECTIONMAILINGLISTPAGE_H
#include "messagecore/mailinglist.h"
#include "foldercollection.h"
#include <akonadi/collectionpropertiespage.h>
#include <akonadi/collection.h>
class QCheckBox;
class QLabel;
class QPushButton;
template <typename T> class QSharedPointer;
class KComboBox;
class KJob;
class KEditListWidget;
class KSqueezedTextLabel;
class CollectionMailingListPage : public Akonadi::CollectionPropertiesPage
{
Q_OBJECT
public:
explicit CollectionMailingListPage( QWidget *parent = 0 );
~CollectionMailingListPage();
void load( const Akonadi::Collection & col );
void save( Akonadi::Collection & col );
bool canHandle( const Akonadi::Collection & col ) const;
protected:
void init(const Akonadi::Collection&);
protected slots:
void slotFetchDone( KJob* job );
private slots:
/*
* Detects mailing-list related stuff
*/
void slotDetectMailingList();
void slotInvokeHandler();
void slotMLHandling( int element );
void slotHoldsML( bool holdsML );
void slotAddressChanged( int addr );
private:
void fillMLFromWidgets();
void fillEditBox();
Akonadi::Collection mCurrentCollection;
QSharedPointer<MailCommon::FolderCollection> mFolder;
int mLastItem;
MailingList mMailingList;
QCheckBox *mHoldsMailingList;
KComboBox *mMLHandlerCombo;
QPushButton *mDetectButton;
KComboBox *mAddressCombo;
KEditListWidget *mEditList;
KSqueezedTextLabel *mMLId;
QWidget *mGroupWidget;
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY( CollectionMailingListPageFactory, CollectionMailingListPage )
#endif /* COLLECTIONMAILINGLISTPAGE_H */

@ -25,7 +25,6 @@
#include "composer.h"
#include "searchwindow.h"
#include "antispamwizard.h"
#include "mailinglistpropertiesdialog.h"
#include "statusbarlabel.h"
#include "expirypropertiesdialog.h"
#include "undostack.h"
@ -53,6 +52,7 @@
#include "collectionquotapage.h"
#include "collectiontemplatespage.h"
#include "collectionviewpage.h"
#include "collectionmailinglistpage.h"
#include "tagselectdialog.h"
#include "archivemailagentinterface.h"
@ -304,6 +304,7 @@ K_GLOBAL_STATIC( KMMainWidget::PtrList, theMainWidgetList )
Akonadi::CollectionPropertiesDialog::registerPage( new CollectionQuotaPageFactory );
Akonadi::CollectionPropertiesDialog::registerPage( new CollectionTemplatesPageFactory );
Akonadi::CollectionPropertiesDialog::registerPage( new CollectionViewPageFactory );
Akonadi::CollectionPropertiesDialog::registerPage( new CollectionMailingListPageFactory );
pagesRegistered = true;
}
@ -1633,10 +1634,7 @@ void KMMainWidget::slotPostToML()
//-----------------------------------------------------------------------------
void KMMainWidget::slotFolderMailingListProperties()
{
if ( !mFolderTreeWidget || !mCurrentFolder )
return;
( new KMail::MailingListFolderPropertiesDialog( this, mCurrentFolder ) )->show();
showCollectionProperties( QLatin1String( "KMail::CollectionMailingListPage" ) );
}
//-----------------------------------------------------------------------------
@ -4635,24 +4633,29 @@ KAction *KMMainWidget::akonadiStandardAction( Akonadi::StandardMailActionManager
return mAkonadiStandardActionManager->action( type );
}
void KMMainWidget::slotCollectionProperties()
{
showCollectionProperties( QString() );
}
void KMMainWidget::showCollectionProperties( const QString &pageToShow )
{
if ( !mCurrentFolder )
return;
if ( Solid::Networking::status() == Solid::Networking::Unconnected ) {
KMessageBox::information( this, i18n( "Network is unconnected, some infos from folder could not be updated." ) );
slotCollectionPropertiesContinued( 0 );
showCollectionPropertiesContinued( pageToShow );
} else {
const Akonadi::AgentInstance agentInstance = Akonadi::AgentManager::self()->instance( mCurrentFolder->collection().resource() );
bool isOnline = agentInstance.isOnline();
if (!isOnline) {
slotCollectionPropertiesContinued( 0 );
showCollectionPropertiesContinued( pageToShow );
} else {
Akonadi::CollectionAttributesSynchronizationJob *sync
= new Akonadi::CollectionAttributesSynchronizationJob( mCurrentFolder->collection() );
sync->setProperty( "collectionId", mCurrentFolder->collection().id() );
sync->setProperty( "pageToShow", pageToShow ); // note for dialog later
connect( sync, SIGNAL(result(KJob*)),
this, SLOT(slotCollectionPropertiesContinued(KJob*)) );
sync->start();
@ -4662,13 +4665,21 @@ void KMMainWidget::slotCollectionProperties()
void KMMainWidget::slotCollectionPropertiesContinued( KJob* job )
{
QString pageToShow;
if ( job ) {
Akonadi::CollectionAttributesSynchronizationJob *sync
= dynamic_cast<Akonadi::CollectionAttributesSynchronizationJob *>( job );
Q_ASSERT( sync );
if ( sync->property( "collectionId" ) != mCurrentFolder->collection().id() )
return;
pageToShow = sync->property( "pageToShow" ).toString();
}
showCollectionPropertiesContinued( pageToShow );
}
void KMMainWidget::showCollectionPropertiesContinued( const QString &pageToShow )
{
Akonadi::CollectionFetchJob fetch( mCurrentFolder->collection(), Akonadi::CollectionFetchJob::Base );
fetch.fetchScope().setIncludeStatistics( true );
fetch.exec();
@ -4680,12 +4691,16 @@ void KMMainWidget::slotCollectionPropertiesContinued( KJob* job )
<< QLatin1String( "Akonadi::CachePolicyPage" )
<< QLatin1String( "KMail::CollectionTemplatesPage" )
<< QLatin1String( "PimCommon::CollectionAclPage" )
<< QLatin1String( "KMail::CollectionMailingListPage" )
<< QLatin1String( "KMail::CollectionQuotaPage" )
<< QLatin1String( "KMail::CollectionMaintenancePage" );
Akonadi::CollectionPropertiesDialog *dlg = new Akonadi::CollectionPropertiesDialog( collection, pages, this );
dlg->setCaption( i18nc( "@title:window", "Properties of Folder %1", collection.name() ) );
dlg->resize( 500, 400 );
if ( !pageToShow.isEmpty() ) { // show a specific page
dlg->setCurrentPage( pageToShow );
}
dlg->show();
}

@ -505,6 +505,8 @@ class KMAIL_EXPORT KMMainWidget : public QWidget
void showMessagePopup(const Akonadi::Item&msg ,const KUrl&aUrl,const KUrl &imageUrl,const QPoint& aPoint, bool contactAlreadyExists, bool uniqueContactFound);
void showCollectionProperties( const QString &pageToShow );
void showCollectionPropertiesContinued( const QString &pageToShow );
private slots:
/**

@ -1,86 +0,0 @@
/*******************************************************************************
**
** Filename : mailinglistpropertiesdialog.h
** Created on : 30 January, 2005
** Copyright : (c) 2005 Till Adam
** Email : adam@kde.org
**
*******************************************************************************/
/*******************************************************************************
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** In addition, as a special exception, the copyright holders give
** permission to link the code of this program with any edition of
** the Qt library by Trolltech AS, Norway (or with modified versions
** of Qt that use the same license as Qt), and distribute linked
** combinations including the two. You must obey the GNU General
** Public License in all respects for all of the code used other than
** Qt. If you modify this file, you may extend this exception to
** your version of the file, but you are not obligated to do so. If
** you do not wish to do so, delete this exception statement from
** your version.
*******************************************************************************/
#ifndef MAILINGLISTPROPERTIESDIALOG_H
#define MAILINGLISTPROPERTIESDIALOG_H
#include "messagecore/mailinglist.h"
#include <kdialog.h>
#include "foldercollection.h"
class QCheckBox;
class QPushButton;
class QLabel;
class KComboBox;
class KEditListWidget;
namespace KMail
{
class MailingListFolderPropertiesDialog : public KDialog
{
Q_OBJECT
public:
explicit MailingListFolderPropertiesDialog( QWidget *parent, const QSharedPointer<MailCommon::FolderCollection>& folder );
~MailingListFolderPropertiesDialog();
protected:
void load();
void save();
protected slots:
void slotOk();
void slotFetchDone( KJob* job );
private slots:
/*
* Detects mailing-list related stuff
*/
void slotDetectMailingList();
void slotInvokeHandler();
void slotMLHandling( int element );
void slotHoldsML( bool holdsML );
void slotAddressChanged( int addr );
private:
QSharedPointer<MailCommon::FolderCollection> mFolder;
void fillMLFromWidgets();
void fillEditBox();
int mLastItem;
MailingList mMailingList;
QCheckBox *mHoldsMailingList;
KComboBox *mMLHandlerCombo;
QPushButton *mDetectButton;
KComboBox *mAddressCombo;
KEditListWidget *mEditList;
QLabel *mMLId;
}; // End of class MailingListFolderProperties
} // End of namespace KMail
#endif // MAILINGLISTPROPERTIESDIALOG_H
Loading…
Cancel
Save