blob: 1f778afeb2ada57cfb09af39a669dc5e143012fa (
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
|
The KDE Mail Import tool - KMailCVT
===================================
This directory contains the sources for the kmailcvt program. It communicates
with KMail via its DCOP interface to add messages.
Writing a filter
----------------
...is very easy. Create two files filter_myformat.cpp and filter_myformat.h
and add "filter_myformat.cpp" to the end of the kmailcvt_SOURCES line in
Makefile.am and "filter_myformat.cpp filter_myformat.h" to the end of the
EXTRA_DIST line in Makefile.am. Now run "make -f Makefile.cvs; ./configure" in
your tdepim source directory.
In the import method of your filter you are passed a FilterInfo object. This has
the following methods that you may want to use:
void setFrom( const TQString& from ); // Set to file importing from
void setTo( const TQString& to ); // Set to folder importing into
void setCurrent( const TQString& current ); // What we are doing
void setCurrent( int percent = 0 ); // Set percentage of current file
void setOverall( int percent = 0 ); // Set overall percentage
void addLog( const TQString& log ); // Add a message for the user to see
void alert( const TQString& message ); // Tell user something has gone wrong
TQWidget *parent(); // The parent widget
bool removeDupMsg; // true, if user selected 'remove duplicated messages'
Also, every now and again you should check to see if the shouldTerminate method
returns true, if it does the user has pressed cancel and your import method
should return.
To add messages, extract the email (including all headers) into a KTempFile.
Then use the following:
if(info->removeDupMsg) addMessage( info, folderName, tempfilepath );
else addMessage_fastImport( info, folderName, tempfilepath );
For a simple example, look at filter_plain
Finally for the filter to appear in the combo box in the wizard you need to edit
kselfilterpage.cpp and add an appropriate addFilter() function call.
Danny Kukawka, February 2005
Laurence Anderson, April 2003.
|