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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
#ifndef VIEW_H
#define VIEW_H
#include <qevent.h>
#include <qptrlist.h>
#include <klistview.h>
#include <kmainwindow.h>
#include <qrect.h>
#include <qdict.h>
#include <kio/global.h>
#include <noatun/downloader.h>
class Finder;
class View;
namespace KIO { class ListJob; }
class SafeListViewItem
: public QCheckListItem
, public PlaylistItemData
, public DownloadItem
{
public:
SafeListViewItem(QListView *parent, QListViewItem *after, const KURL &text);
SafeListViewItem(QListView *parent, QListViewItem *after, const QMap<QString,QString> &properties);
virtual ~SafeListViewItem();
virtual QString property(const QString &, const QString & = 0) const;
virtual void setProperty(const QString &, const QString &);
virtual void clearProperty(const QString &);
virtual QStringList properties() const;
virtual bool isProperty(const QString &) const;
virtual QString file() const;
int compare(QListViewItem * i, int col, bool ascending) const;
virtual void remove();
protected:
virtual void downloaded(int percent);
virtual void downloadTimeout();
virtual void downloadFinished();
virtual void modified();
virtual void stateChange(bool s);
void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align);
private:
struct Property
{
QString key;
QString value;
};
QValueList<Property> mProperties;
bool removed;
};
class List : public KListView
{
Q_OBJECT
friend class View;
public:
List(View *parent);
virtual ~List();
QListViewItem *openGlobal(const KURL&, QListViewItem * =0);
QListViewItem *importGlobal(const KURL&, QListViewItem * =0);
QListViewItem *addFile(const KURL&, bool play=false, QListViewItem * =0);
void addDirectoryRecursive(const KURL &dir, QListViewItem *after= 0);
public slots:
virtual void clear();
signals:
void modified(void);
void deleteCurrentItem();
protected:
virtual bool acceptDrag(QDropEvent *event) const;
virtual void keyPressEvent(QKeyEvent *e);
protected slots:
virtual void dropEvent(QDropEvent *event, QListViewItem *after);
void move();
protected:
QListViewItem *recursiveAddAfter;
protected slots:
// used when adding directories via KIO::listRecursive
void slotResult(KIO::Job *job);
void slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries);
void slotRedirection(KIO::Job *, const KURL & url);
protected:
void addNextPendingDirectory();
KURL::List pendingAddDirectories;
KIO::ListJob *listJob;
KURL currentJobURL;
};
class KFileDialog;
class KToggleAction;
class KToolBar;
class View : public KMainWindow
{
Q_OBJECT
public:
View(SplitPlaylist *mother);
// load the SM playlist
void init();
virtual ~View();
List *listView() const { return list; }
QListViewItem *addFile(const KURL &u, bool play=false)
{ return list->addFile(u, play, list->lastItem()); }
public slots:
void deleteSelected();
void addFiles();
void addDirectory();
void save();
void saveAs();
void open();
void openNew();
void setSorting(bool on, int column = 0);
void setNoSorting() { setSorting(false); }
void headerClicked(int column);void find();
void findIt(Finder *);
private slots:
void setModified();
void saveState();
void configureToolBars();
void newToolBarConfig();
protected:
void setupActions();
bool saveToURL(const KURL &);
void exportTo(const KURL &);
void setModified(bool);
virtual void closeEvent(QCloseEvent*e);
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
signals:
void hidden();
void shown();
private:
List *list;
KAction *mOpen, *mDelete, *mSave, *mSaveAs, *mOpenpl, *mOpenNew;
KAction *mClose;
KAction *mFind;
Finder *mFinder;
KURL mPlaylistFile;
bool modified;
};
#endif
|