summaryrefslogtreecommitdiffstats
path: root/src/app/historyAction.h
blob: cd9b60a7e0896cdb3975b8ac8723c3debdc68686 (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
59
60
61
62
63
64
65
//Author:    Max Howell <max.howell@methylblue.com>, (C) 2003-4
//Copyright: See COPYING file that comes with this distribution

#ifndef HISTORYACTION_H
#define HISTORYACTION_H

#include <tdeaction.h>
#include <kurl.h>
#include <tqstringlist.h>

class TDEConfig;


/// defined in mainWindow.cpp
void setActionMenuTextOnly( TDEAction *a, TQString const &suffix );


class HistoryAction : TDEAction
{
    HistoryAction( const TQString &text, const char *icon, const TDEShortcut &cut, TDEActionCollection *ac, const char *name );

    friend class HistoryCollection;

public:
    virtual void setEnabled( bool b = true ) { TDEAction::setEnabled( b ? !m_list.isEmpty() : false ); }

    void clear() { m_list.clear(); TDEAction::setText( m_text ); }

private:
    void setText();

    void push( const TQString &path );
    TQString pop();

    const TQString m_text;
    TQStringList m_list;
};


class HistoryCollection : public TQObject
{
Q_OBJECT
  

public:
    HistoryCollection( TDEActionCollection *ac, TQObject *parent, const char *name );

    void save( TDEConfig *config );
    void restore( TDEConfig *config );

public slots:
    void push( const KURL& );
    void stop() { m_receiver = 0; }

signals:
    void activated( const KURL& );

private slots:
    void pop();

private:
    HistoryAction *m_b, *m_f, *m_receiver;
};

#endif