summaryrefslogtreecommitdiffstats
path: root/kmailcvt/kselfilterpage.cpp
blob: ef3d9577361b747d9e9121ebaeffa2c5c3398ff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/***************************************************************************
                          kselfilterpage.cpp  -  description
                             -------------------
    begin                : Fri Jan 17 2003
    copyright            : (C) 2003 by Laurence Anderson
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#include <kstandarddirs.h>
#include <tqtextedit.h>
#include <tqcheckbox.h> 
#include <tdelocale.h>
#include "filters.h"

#include "filter_mbox.h"
#include "filter_oe.h"
#include "filter_outlook.h"
#include "filter_pmail.h"
#include "filter_plain.h"
#include "filter_evolution.h"
#include "filter_mailapp.h"
#include "filter_evolution_v2.h"
#include "filter_opera.h"
#include "filter_thunderbird.h"
#include "filter_kmail_maildir.h"
#include "filter_kmail_archive.h"
#include "filter_sylpheed.h"
#include "filter_thebat.h"
#include "filter_lnotes.h"

#include "kselfilterpage.h"

KSelFilterPage::KSelFilterPage(TQWidget *parent, const char *name ) : KSelFilterPageDlg(parent,name) {

	mIntroSidebar->setPixmap(locate("data", "kmailcvt/pics/step1.png"));
	mFilterList.setAutoDelete( TRUE );
	connect(mFilterCombo, TQ_SIGNAL(activated(int)), TQ_SLOT(filterSelected(int)));

	// Add new filters below. If this annoys you, please rewrite the stuff to use a factory.
        // The former approach was overengineered and only worked around problems in the design
        // For now, we have to live without the warm and fuzzy feeling a refactoring might give. 
        // Patches appreciated. (danimo)

        addFilter(new FilterKMailArchive);
        addFilter(new FilterMBox);
        addFilter(new FilterEvolution);
        addFilter(new FilterEvolution_v2);
        addFilter(new FilterKMail_maildir);
        addFilter(new FilterMailApp);
        addFilter(new FilterOpera);
        addFilter(new FilterSylpheed);
        addFilter(new FilterThunderbird);
        addFilter(new FilterTheBat);
        addFilter(new FilterOE);
//        addFilter(new FilterOutlook);
        addFilter(new FilterPMail);
        addFilter(new FilterLNotes);
        addFilter(new FilterPlain);
}

KSelFilterPage::~KSelFilterPage() {
}

void KSelFilterPage::filterSelected(int i)
{
	TQString info = mFilterList.at(i)->info();
	TQString author = mFilterList.at(i)->author();
	if(!author.isEmpty())
		info += i18n("<p><i>Written by %1.</i></p>").arg(author);
	mDesc->setText(info);
}

void KSelFilterPage::addFilter(Filter *f)
{
	mFilterList.append(f);
	mFilterCombo->insertItem(f->name());
	if (mFilterCombo->count() == 1) filterSelected(0); // Setup description box with fist filter selected
}

bool KSelFilterPage::removeDupMsg_checked()
{
        return remDupMsg->isChecked();
}

Filter * KSelFilterPage::getSelectedFilter(void)
{
	return mFilterList.at(mFilterCombo->currentItem());
}

#include "kselfilterpage.moc"