summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/dub/dub/dubplaylistitem.cpp
blob: d38eb241ec92df2a6cebc08834ec745fee5ecafe (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
//
// C++ Implementation: dubplaylistitem.cpp
//
// Description: 
//
//
// Author: Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr>, (C) 2001
//
// Copyright: See COPYING file that comes with this distribution
//
//

//#include dubplaylistitem.cpp


#include "dubplaylistitem.h"
#include <kfile.h>
#include <kfileitem.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h>

DubPlaylistItem::DubPlaylistItem(const KFileItem& fItem)
 : fileItem(fItem)
{
//   kdDebug(90010) << "construct playlist item " << fItem.url().prettyURL() << endl;

//  PlaylistItemData::addRef();
  PlaylistItemData::added();
}

DubPlaylistItem::~DubPlaylistItem(){
//   kdDebug(90010) << "destruct playlist item " << fileItem.url().prettyURL() << endl;

//  PlaylistItemData::removed();
  PlaylistItemData::removeRef();
}

QString DubPlaylistItem::property(const QString &key, const QString &def) const {
//   kdDebug(90010) << "property " << key << endl;
  if (isProperty(key)) {
    kdDebug(90010) << key << " -> " << property_map.find(key).data() << endl;
    return property_map.find(key).data();
  }
  else
    return def;
}

void DubPlaylistItem::setProperty(const QString &key, const QString &val) {
//   kdDebug(90010) << "set property" << endl;
  property_map[key] = val;
}

void DubPlaylistItem::clearProperty(const QString &key) {
//   kdDebug(90010) << "clear property" << endl;
  property_map.remove(key);
}

QStringList DubPlaylistItem::properties() const {
//   kdDebug(90010) << "properties" << endl;
  QStringList list;
  for (Properties::const_iterator i=property_map.begin();
       i!=property_map.end(); i++) {
    list.append(i.data());
  }
  return list;
}

bool DubPlaylistItem::isProperty(const QString &key) const {
//   kdDebug(90010) << "is property? " << key << endl;
  return (property_map.find(key) != property_map.end());
}

KURL DubPlaylistItem::url() const {
//   kdDebug(90010) << "item url" << endl;

  return fileItem.url();
}
/** No descriptions */
void DubPlaylistItem::remove() {
  KMessageBox::information(0, i18n("Do you really want to delete this file?"));
}