summaryrefslogtreecommitdiffstats
path: root/adept/libadept/filterwidget.cpp
blob: f2943274c8f4ed5a0a9bf471b0dcfa3651fd98fb (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
#include <apt-front/predicate/combinators.h>
#include <apt-front/predicate/factory.h>
#include <klocale.h>
#include <klineedit.h>
#include "filterwidget.h"

using namespace aptFront;
using namespace adept;

void FilterWidget::connectLister( Lister *l ) {
    connect( this, SIGNAL( drop( ListerPredicate ) ),
             l, SLOT( interactiveDrop( ListerPredicate ) ) );
    connect( this, SIGNAL( changed( ListerPredicate ) ),
             l, SLOT( interactiveAnd( ListerPredicate ) ) );
    connect( this, SIGNAL( apply( ListerPredicate ) ),
             l, SLOT( baseAnd( ListerPredicate ) ) );

}

void FilterWidget::changedInternal() {
    setEnabled( false );
    emit drop( m_old );
    emit changed( m_old = predicate() );
    setEnabled( true );
    setFocus();
}

void FilterWidget::applyInternal() {
    // check for emptiness?
    setEnabled( false );
    emit drop( m_old );
    emit apply( m_old = predicate() );
    reset();
    setEnabled( true );
    setFocus();
}