KNewStuff question

Andras Mantia amantia at kde.org
Fri Jun 25 12:59:06 BST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

 I have a problem with KNewStuff and multiple resource type. I'd like to 
provide different types of resources on a server, so the knewstuff.xml 
looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE knewstuff SYSTEM "knewstuff.dtd">
<knewstuff>
  <stuff>
    <name>Test DTEP</name>
    <type>quanta/dtep</type>
    <author email="amantia at kde.org">Andras Mantia</author>
    <licence>GPL</licence>
    <summary lang="en">Test DTEP</summary>
    <version>1.0</version>
    <release>1</release>
    <releasedate>2004-06-24</releasedate>
    <preview lang="en"></preview>
    <payload lang="en">http://localhost/~andris/test.tar.gz</payload>
    <rating>5</rating>
    <downloads>0</downloads>
  </stuff>
  <stuff>
    <name>Test Toolbar</name>
    <type>quanta/toolbar</type>
    <author email="amantia at kde.org">Andras Mantia</author>
    <licence>GPL</licence>
    <summary lang="en">Test Toolbar</summary>
    <version>1.0</version>
    <release>1</release>
    <releasedate>2004-06-24</releasedate>
    <preview lang="en"></preview>
    <payload 
lang="en">http://localhost/~andris/test-toolbar.tar.gz</payload>
    <rating>5</rating>
    <downloads>0</downloads>
  </stuff>
</knewstuff>

In the code I have two KNewStuff child classes, one for the resource 
"quanta/dtep" the other for "quanta/toolbar". They are called as:
    m_newDTEPStuff = new QNewDTEPStuff("quanta/dtep", this);
    m_newDTEPStuff->download();

and 
    m_newToolbarStuff = new QNewToolbarStuff("quanta/toolbar", this);
    m_newToolbarStuff->download();

The problem is that in the first case "quanta/toolbar" resource are also 
listed (and "quanta/dtep" resources are listed in the second case). 
This of course causes installing of those resource to fail. type() 
always returns "quanta/dtep" in the first case, so I cannot check if 
the selected resource is really a "quanta/dtep" or not and act 
accordingly.

My question is: is this a bug or the intended behavior? If it's not a 
bug how can one write code which treats different resources by using 
the type information and not trying to detect the data type in some 
different way?

Andras

- -- 
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA3BOKTQdfac6L/08RAjrVAJ406FlkkJyMppixHf/uF5Q94TShbwCfZ6YV
Txgw6dnT/YyVNQyRoX9nKrU=
=bQnP
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list