~ubuntu-branches/ubuntu/vivid/kfilemetadata-kf5/vivid

« back to all changes in this revision

Viewing changes to src/usermetadata.cpp

  • Committer: Package Import Robot
  • Author(s): Harald Sitter, Harald Sitter, Scarlett Clark
  • Date: 2015-02-23 09:52:52 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20150223095252-sju4qoz5xks5q811
Tags: 5.6.1-0ubuntu1
[ Harald Sitter ]
* Resolve transitional problems from lib2 to lib3 package with
  APT. Apt would refuse to upgrade the new (re-introduced) data
  package as it replaces and breaks the lib2 package and for some
  reason Apt considers the data package to be less useful, so it
  will hold lib2 and not upgrade which in turn results in the
  removal of plama-desktop & plasma-workspace as they need lib3.
  To prevent this problem also replicate the transition relationship
  onto the lib3 package (now breaks/replaces the lib2 package). This
  seems to give a sufficiently important package the breaks such
  that apt would choose to remove lib2 and install lib3.
  This transition is slightly unfortunate alltogether as it only
  ended up being so complicated by having data in the lib package
  to begin with.
* Also soften the transitional relationship of the -data package.
  Originally it had use Conflicts where it should have used Breaks
  because files had simply moved about, there is no inherent conflict.

[ Scarlett Clark ]
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
    return d->filePath;
58
58
}
59
59
 
60
 
void UserMetaData::addTag(const QString& tag)
61
 
{
62
 
    QSet<QString> tagSet = tags().toSet();
63
 
    tagSet << tag;
64
 
 
65
 
    setTags(tagSet.toList());
66
 
}
67
 
 
68
 
void UserMetaData::addTags(const QStringList& tagList)
69
 
{
70
 
    QSet<QString> tagSet = tags().toSet();
71
 
    tagSet.unite(tagList.toSet());
72
 
 
73
 
    setTags(tagSet.toList());
74
 
}
75
 
 
76
60
void UserMetaData::setTags(const QStringList& tags)
77
61
{
78
62
    k_setxattr(d->filePath, QStringLiteral("user.xdg.tags"), tags.join(", "));
79
63
}
80
64
 
81
 
void UserMetaData::removeTag(const QString& tag)
82
 
{
83
 
    QSet<QString> tagSet = tags().toSet();
84
 
    tagSet.remove(tag);
85
 
 
86
 
    setTags(tagSet.toList());
87
 
}
88
 
 
89
 
void UserMetaData::removeTags(const QStringList& tagList)
90
 
{
91
 
    QSet<QString> tagSet = tags().toSet();
92
 
    tagSet.subtract(tagList.toSet());
93
 
 
94
 
    setTags(tagSet.toList());
95
 
 
96
 
}
97
 
 
98
65
QStringList UserMetaData::tags() const
99
66
{
100
67
    QString value;
131
98
 
132
99
void UserMetaData::setAttribute(const QString& key, const QString& value)
133
100
{
134
 
    k_setxattr(d->filePath, QStringLiteral("user") + key, value);
 
101
    k_setxattr(d->filePath, QStringLiteral("user.") + key, value);
135
102
}
136
103
 
137
104
bool UserMetaData::hasAttribute(const QString& key)
138
105
{
139
 
    k_getxattr(d->filePath, QStringLiteral("user") + key, 0);
 
106
    k_getxattr(d->filePath, QStringLiteral("user.") + key, 0);
140
107
 
141
108
    return (errno != ENODATA);
142
109
}
144
111
QString UserMetaData::attribute(const QString& key)
145
112
{
146
113
    QString value;
147
 
    k_getxattr(d->filePath, QStringLiteral("user") + key, &value);
 
114
    k_getxattr(d->filePath, QStringLiteral("user.") + key, &value);
148
115
 
149
116
    return value;
150
117
}