summaryrefslogtreecommitdiff
path: root/libopie/ofileselector/ofilefactory.cpp
blob: aa143b446e5c0c1caec56ac844c556727d15756a (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
#include "ofilefactory.h"

OFileFactory::OFileFactory() {
}
OFileFactory::~OFileFactory() {
}
QStringList OFileFactory::lister()const {
    QStringList list;
    QMap<QString, listerFact>::ConstIterator it;
    for ( it = m_lister.begin(); it != m_lister.end(); ++it ) {
        list << it.key();
    }
    return list;
}
QStringList OFileFactory::views()const {
    QStringList list;
    QMap<QString, viewFact>::ConstIterator it;
    for (it = m_view.begin(); it != m_view.end(); ++it ) {
        list << it.key();
    }

    return list;
}
OFileView* OFileFactory::view( const QString& name,
                               OFileSelector* sel, QWidget* par) {
    OFileView* vie= 0l;

    QMap<QString, viewFact>::Iterator it;
    it = m_view.find( name );

    if ( it != m_view.end() ) {
        vie = (*(it.data() ) )(sel, par);
    }
    return vie;
}
OLister* OFileFactory::lister(const QString& name,  OFileSelector* sel) {
    OLister* lis = 0l;

    QMap<QString, listerFact>::Iterator it;
    it = m_lister.find( name );
    if ( it != m_lister.end() ) {
        lis = (*(it.data() ) )(sel);
    }

    return lis;
}
void OFileFactory::addLister( const QString& name, listerFact fact ) {
    m_lister.insert( name, fact );
}
void OFileFactory::addView( const QString& name, viewFact fact ) {
    m_view.insert( name, fact );
}
void OFileFactory::removeLister( const QString& name) {
    m_lister.remove( name );
}
void OFileFactory::removeView( const QString& name) {
    m_view.remove( name );
}