summaryrefslogtreecommitdiffstats
path: root/amarok/src/mydiroperator.cpp
blob: 461122152caea7ad8a88b4eec9c0f0d8876ba74f (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
#include "medium.h"
#include "mydiroperator.h"

#include <kurl.h>

#include <tqdir.h>

MyDirOperator::MyDirOperator ( const KURL &url, TQWidget *parent, Medium *medium ) : KDirOperator( url, parent )
{
    m_medium = medium;
    setDirLister( new MyDirLister( true ) );
    reenableDeleteKey();
}

void
MyDirOperator::myHome()
{
    KURL u;
    u.setPath( m_medium ? m_medium->mountPoint() : TQDir::homeDirPath() );
    setURL(u, true);
}

void
MyDirOperator::myCdUp()
{
    KURL tmp( url() );
    tmp.cd( TQString::fromLatin1(".."));
    if( m_medium && !tmp.path().startsWith( m_medium->mountPoint() ) )
        tmp.setPath( m_medium->mountPoint() );
    setURL(tmp, true);
}


//BEGIN private methods
void
MyDirOperator::reenableDeleteKey()
{
    TDEActionCollection* dirActionCollection = static_cast<TDEActionCollection*>(KDirOperator::child("KDirOperator::myActionCollection"));
    if( dirActionCollection )
    {
        TDEAction* trash = dirActionCollection->action("trash");
        if(trash)
            trash->setEnabled(false);
    }
}
//END private methods
#include "mydiroperator.moc"