summaryrefslogtreecommitdiffstats
path: root/adept/adept/sourceseditor.h
blob: 37ae0b0818efb97ffb3768deb79ac82ad2499c3b (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
/** -*- C++ -*-
	@file adept/sourceseditor.h
	@author Peter Rockai <me@mornfall.net>
*/

#include <cstddef>
#include <apt-front/sources.h>
#include <adept/sourceseditorui.h>
#include <klistview.h>

namespace adept {

using namespace aptFront;

class SourcesEditor : public SourcesEditorUi
{
    Q_OBJECT
  
public:
    SourcesEditor( std::string f, TQWidget *p = 0, const char *n = 0 );
public slots:
    void save();
    void reset();
protected slots:
    void contextMenu( TQListViewItem *, const TQPoint & );
    void contextMenuActivated( int );
    void newAdd();
signals:
    void close();
protected:
    aptFront::Sources m_sources;
    std::string m_filename;
};

class EntryItem : public TDEListViewItem {
public:
    Sources::Entry entry() const {
        return m_entry;
    }
    void setEntry( const Sources::Entry &e ) {
        m_entry = e;
    }
    EntryItem( Sources::Entry e, TDEListView *v, EntryItem *prev )
        : TDEListViewItem( v, prev ), m_entry( e ) {
        init();
    }
    EntryItem( Sources::Entry e, TDEListView *v )
        : TDEListViewItem( v ), m_entry( e ) {
        init();
    }
    void init() {
        setRenameEnabled( 0, false );
        setRenameEnabled( 1, true );
        setRenameEnabled( 2, true );
        setRenameEnabled( 3, true );
    }
    TQString text( int c ) const;
    void setText( int c, const TQString &s );
    virtual void paintCell (TQPainter *p, const TQColorGroup &cg,
                            int column, int width, int alignment);
protected:
    Sources::Entry m_entry;
};

}