improve the readability of the log output (separators and indentation),

allow to clear the log (via button in the viewer)

svn path=/trunk/kdepim/; revision=288565
wilder-work
Andreas Gungl 22 years ago
parent a42868c03b
commit f5e3a8520d
  1. 5
      filterlog.cpp
  2. 11
      filterlogdlg.cpp
  3. 1
      filterlogdlg.h
  4. 7
      kmfiltermgr.cpp
  5. 8
      kmsearchpattern.cpp

@ -57,11 +57,6 @@ void FilterLog::add( QString logEntry )
{
logEntries.append( logEntry );
emit logEntryAdded( logEntry );
// FIXME to be removed
#ifndef NDEBUG
//if ( !(logEntries.size() % 10) )
// dump();
#endif
}
}

@ -41,8 +41,8 @@ using namespace KMail;
FilterLogDialog::FilterLogDialog( QWidget * parent )
: KDialogBase(parent, "FilterLogDlg", false, i18n( "KMail Filter Log Viewer" ),
Close, Close )
: KDialogBase( parent, "FilterLogDlg", false, i18n( "KMail Filter Log Viewer" ),
User1|Close, Close, true, i18n("C&lear") )
{
textEdit = new KTextEdit( this );
setMainWidget( textEdit );
@ -68,4 +68,11 @@ void FilterLogDialog::slotLogEntryAdded( QString logEntry )
}
void FilterLogDialog::slotUser1()
{
FilterLog::instance()->clear();
textEdit->clear();
}
#include "filterlogdlg.moc"

@ -54,6 +54,7 @@ namespace KMail {
void slotLogEntryAdded( QString logEntry );
protected:
virtual void slotUser1();
KTextEdit * textEdit;
};

@ -135,6 +135,9 @@ bool KMFilterMgr::beginFiltering(KMMsgBase *msgBase) const
return false;
MessageProperty::setFiltering( msgBase, true );
MessageProperty::setFilterFolder( msgBase, 0 );
if ( FilterLog::instance()->isLogging() ) {
FilterLog::instance()->add( "------------------------------" );
}
return true;
}
@ -207,14 +210,14 @@ int KMFilterMgr::process( KMMessage * msg, FilterSet set ) {
// filter is applicable
if ( FilterLog::instance()->isLogging() ) {
QString logText( i18n( "Evaluating filter rule: " ) );
QString logText( i18n( "Evaluating filter rules:\n" ) );
logText.append( (*it)->pattern()->asString() );
FilterLog::instance()->add( logText );
}
if ( (*it)->pattern()->matches( msg ) ) {
// filter matches
if ( FilterLog::instance()->isLogging() )
FilterLog::instance()->add( i18n( "Filter rule has matched." ) );
FilterLog::instance()->add( i18n( "Filter rules have matched." ) );
// execute actions:
if ( (*it)->execActions(msg, stopIt) == KMFilter::CriticalError )
return 2;

@ -699,9 +699,11 @@ void KMSearchPattern::init() {
}
QString KMSearchPattern::asString() const {
QString result = "(match ";
result += ( mOperator == OpOr ) ? "any" : "all";
result += " of the following)\n";
QString result = "\t";
if ( mOperator == OpOr )
result += i18n("(match any of the following)") + "\n";
else
result += i18n("(match all of the following)") + "\n";
for ( QPtrListIterator<KMSearchRule> it( *this ) ; it.current() ; ++it )
result += (*it)->asString() + '\n';

Loading…
Cancel
Save