Commit 57a1ed6f authored by Joris Guisson's avatar Joris Guisson
Browse files

Backport rev 965183 from trunk

svn path=/branches/stable/extragear-kde4/network/ktorrent/; revision=965185
parent 58ec83be
......@@ -11,6 +11,7 @@ Changes in 3.2.2 :
- Increase numwant to 200 and the maximum number of potential peers to 500
- Cancel all scan dialogs before exiting, this fixes a crash (191487)
- Config dialog now embeds pages in scroll areas, so that the dialog also is useable on small screens
- Make sure dbus names are valid, this fixes an assert (192007)
Changes in 3.2.1 :
- Resort torrents if display name is changed
......
......@@ -25,11 +25,44 @@
namespace kt
{
static QString ValidDBusName(const QString & s,int extra_digit)
{
if (s.isEmpty())
return s;
QString ret = s;
if (ret[0].isDigit())
ret[0] = '_';
for (int i = 0;i < s.length();i++)
{
QChar c = ret[i];
if (!c.isLetterOrNumber() && c != '_')
ret[i] = '_';
}
if (extra_digit > 0)
return ret + QString::number(extra_digit);
else
return ret;
}
DBusGroup::DBusGroup(Group* g,GroupManager* gman,QObject* parent)
: QObject(parent),group(g),gman(gman)
{
QDBusConnection::sessionBus().registerObject("/group/" + g->groupName(), this,
QString name = ValidDBusName(g->groupName(),0);
if (name != g->groupName())
{
// check for dupes if the name has been changed
int i = 2;
while (gman->find(name) != 0)
{
name = ValidDBusName(g->groupName(),i);
i++;
}
}
QString path = "/group/" + name;
QDBusConnection::sessionBus().registerObject(path, this,
QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportScriptableSignals);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment