1 /***************************************************************************
2 kselfilterpage.cpp - description
4 begin : Fri Jan 17 2003
5 copyright : (C) 2003 by Laurence Anderson
6 email : l.d.anderson@warwick.ac.uk
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
19 #include "kselfilterpage.h"
22 #include "filter_mbox.hxx"
23 #include "filter_oe.hxx"
24 #include "filter_outlook.hxx"
25 #include "filter_pmail.hxx"
26 #include "filter_plain.hxx"
27 #include "filter_evolution.hxx"
28 #include "filter_mailapp.hxx"
29 #include "filter_evolution_v2.hxx"
30 #include "filter_opera.hxx"
31 #include "filter_thunderbird.hxx"
32 #include "filter_kmail_maildir.hxx"
33 #include "filter_kmail_archive.hxx"
34 #include "filter_sylpheed.hxx"
35 #include "filter_thebat.hxx"
36 #include "filter_lnotes.hxx"
38 #include "filters.hxx"
41 #include <kstandarddirs.h>
43 #include <kmessagebox.h>
50 #include <akonadi/collectionrequester.h>
51 #include <akonadi/control.h>
55 KSelFilterPage::KSelFilterPage(QWidget
*parent
) : KSelFilterPageDlg(parent
) {
57 mIntroSidebar
->setPixmap(KStandardDirs::locate("data", "kmailcvt/pics/step1.png"));
58 //mFilterList.setAutoDelete( true );
59 connect(mFilterCombo
, SIGNAL(activated(int)), SLOT(filterSelected(int)));
61 // Add new filters below. If this annoys you, please rewrite the stuff to use a factory.
62 // The former approach was overengineered and only worked around problems in the design
63 // For now, we have to live without the warm and fuzzy feeling a refactoring might give.
64 // Patches appreciated. (danimo)
66 addFilter(new FilterKMailArchive
);
67 addFilter(new FilterMBox
);
68 addFilter(new FilterEvolution
);
69 addFilter(new FilterEvolution_v2
);
70 addFilter(new FilterKMail_maildir
);
71 addFilter(new FilterMailApp
);
72 addFilter(new FilterOpera
);
73 addFilter(new FilterSylpheed
);
74 addFilter(new FilterThunderbird
);
75 addFilter(new FilterTheBat
);
76 addFilter(new FilterOE
);
77 // addFilter(new FilterOutlook);
78 addFilter(new FilterPMail
);
79 addFilter(new FilterLNotes
);
80 addFilter(new FilterPlain
);
82 // Ensure we return the correct type of Akonadi collection.
83 mCollectionRequestor
->setMimeTypeFilter( QStringList() << QString( "message/rfc822" ) );
84 mCollectionRequestor
->setCollection(Akonadi::Collection());
85 mCollectionRequestor
->setAccessRightsFilter(
86 Akonadi::Collection::CanCreateCollection
|
87 Akonadi::Collection::CanCreateItem
);
90 KSelFilterPage::~KSelFilterPage() {
91 qDeleteAll(mFilterList
);
95 void KSelFilterPage::filterSelected(int i
)
97 QString info
= mFilterList
.at(i
)->info();
98 const QString author
= mFilterList
.at(i
)->author();
100 info
+= i18n("<p><i>Written by %1.</i></p>", author
);
101 mDesc
->setText(info
);
104 void KSelFilterPage::addFilter(Filter
*f
)
106 mFilterList
.append(f
);
107 mFilterCombo
->addItem(f
->name());
108 if (mFilterCombo
->count() == 1) filterSelected(0); // Setup description box with fist filter selected
111 bool KSelFilterPage::removeDupMsg_checked() const
113 return remDupMsg
->isChecked();
116 Filter
* KSelFilterPage::getSelectedFilter(void)
118 return mFilterList
.at(mFilterCombo
->currentIndex());
121 #include "kselfilterpage.moc"