You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, August 6th 2004, 5:05pm

[Kopete] Chat Window Styles

Hi!

The Window Styles "Kopete" and "MSN" are very good. But i want to create my own style. but i don´t know what i have to do :(

could somebody help me?

is anywhere a website where i can download kopete styles?
over google search i did not found any result.


thx!

Greetz ViperNeo

2

Friday, August 6th 2004, 6:31pm

Re: [Kopete] Chat Window Styles

Quoted

Original von ViperNeo

Hi!

The Window Styles "Kopete" and "MSN" are very good. But i want to create my own style. but i don´t know what i have to do :(

could somebody help me?

is anywhere a website where i can download kopete styles?
over google search i did not found any result.


thx!

Greetz ViperNeo

Here's one I know of:
http://www.kde-look.org/content/show.php?content=11265

I guess that looking at the files can give you an idea of how it works.
You might also ask the author how he did it and if he knows of any docs.

m4ktub

Intermediate

Posts: 257

Location: Lisbon, Portugal

Occupation: Software Engineer

  • Send private message

3

Saturday, August 7th 2004, 8:49pm

The documentation is short, specially about styles that is a very technical part, at least in the user perspective.

Basically kopete uses XSLT to match a dynamic XML document created from all messages and produce html that is what the user sees. Aditionally the provide some variables that work as abbreviations and are translated to XSLT when the style is used.

Each message is translated to a XML structure like
[code:1]
<message time="<time>"
timestamp="<timestamp as 2004-08-07 19&#58;08>"
formattedTimestamp="<a formatted time stamp, a mistery to me>"
subject="<the message subject>"
direction="<1=outgoing, 2=internal, 3=incomming>"
importance="<a number>"
mainContactId="<the contact id from the message>">
<from>
<contact contactId="<id>" color="<color>">
<contactDisplayname dir="<text dirrection>"
text="<name text>">
<metaContactDisplayname dir="<text dirrection>"
text="<name text>" protocolIcon="<icon path>">
</from>
<to>
<contact contactId="<id>" color="<color>">
<contactDisplayname dir="<text dirrection>"
text="<name text>">
<metaContactDisplayname dir="<text dirrection>"
text="<name text>" protocolIcon="<icon path>">
</to>
<body color="<color>" bgcolor="<color>" dir="<text direction>">
message text
</body>
</message>
[/code:1]
The style is applied agains each message to generate html. The variables that kopete supports are:
[list]
%TIME% - the value of the attribute time
%TIMESTAMP% - the value of the timestamp attribute
%FORMATTEDTIMESTAMP% - same as above for that strange attribute. I think this works like this: if the message is from today then the time is shown; if the message is from other day then a timestamp is shown.
%FROM_CONTACT_DISPLAYNAME% - the from contact name
%TO_CONTACT_DISPLAYNAME% - the to contat name
%FROM_METACONTACT_DISPLAYNAME% - etc
%TO_METACONTACT_DISPLAYNAME% - etc
%FROM_CONTACT_ID%
%TO_CONTACT_ID%
%BODY% - the message body
[/list:u]
NOTE: Variables are used inside "<kopete-i18n></kopete-i18n>" tags.

The rest is XSLT and thats more difficult to explain here. In a basic form you have
[code:1]
<?xml version="1.0" encoding="UTF-8"?>
<xsl&#58;stylesheet version="1.0" xmlns&#58;xsl="http&#58;//www.w3.org/1999/XSL/Transform">
<xsl&#58;output method="html"/>
<xsl&#58;template match="message">
##
</xsl&#58;template>
</xsl&#58;stylesheet>
[/code:1]
Changes are made were ## is. Everything that does not have a "xsl" prefix is plain html and is used as is. Elements like "xsl:choose" are part of xls and are "interpreted". "xsl:value-of" allows you to select values from the message structure. A path like structure is used to reference nodes like "from/contact/contactDisplayName" and attributes like "from/contact/contactDisplayName/@dir".

It's better if you see examples to see serveral XSL examples. The "Enclosed" style is enough for you to see many uses of the this listed here.

Good luck :-)[/list]

seb

Professional

Posts: 622

Location: Sydney

Occupation: Student

  • Send private message

4

Sunday, August 8th 2004, 1:24am

Here is my xsl theme, based around the minimalistic and msn themes.

[code:1]
<?xml version="1.0" encoding="UTF-8"?>
<xsl&#58;stylesheet version="1.0" xmlns&#58;xsl="http&#58;//www.w3.org/1999/XSL/Transform">
<xsl&#58;output method="html"/>
<xsl&#58;template match="message">
<div class="KopeteMessage" style="padding-bottom&#58;5px;">
<xsl&#58;attribute name="id">
<xsl&#58;value-of select="@id"/>
</xsl&#58;attribute>
<div>
<div>
<xsl&#58;choose>
<xsl&#58;when test="@direction='3'">
<!-- action message -->
</xsl&#58;when>
<xsl&#58;when test="@direction='2'">
<!-- internal message -->
</xsl&#58;when>
<xsl&#58;when test="@direction='1'">
<!-- Outgoing -->
<div style="color&#58; #535353">
<kopete-i18n> %FROM_CONTACT_DISPLAYNAME% says&#58;</kopete-i18n>
</div>
</xsl&#58;when>
<xsl&#58;otherwise>
<!-- Incoming -->
<div style="color&#58; #535353">
<kopete-i18n> %FROM_CONTACT_DISPLAYNAME% says&#58;</kopete-i18n>
</div>
</xsl&#58;otherwise>
</xsl&#58;choose>
</div>
<div style="text-align&#58;right;margin-top&#58;-1em;float&#58;right;">
<xsl&#58;value-of select="@time"/>
</div>
<div>
<xsl&#58;attribute name="dir">
<xsl&#58;value-of select="body/@dir"/>
</xsl&#58;attribute>
<xsl&#58;attribute name="style">
<xsl&#58;text>padding-left&#58;15px;padding-right&#58;15px;</xsl&#58;text>
<xsl&#58;if test="body/@color">
<xsl&#58;text>color&#58;</xsl&#58;text>
<xsl&#58;value-of select="body/@color"/>
<xsl&#58;text>;</xsl&#58;text>
</xsl&#58;if>
<xsl&#58;if test="body/@bgcolor">
<xsl&#58;text>background-color&#58;</xsl&#58;text>
<xsl&#58;value-of select="body/@bgcolor"/>
</xsl&#58;if>
<xsl&#58;if test="body/@font">
<xsl&#58;text>; </xsl&#58;text>
<xsl&#58;value-of select="body/@font"/>
</xsl&#58;if>
</xsl&#58;attribute>
<xsl&#58;if test="@importance='2'">
<xsl&#58;attribute name="class">
<xsl&#58;text>highlight</xsl&#58;text>
</xsl&#58;attribute>
</xsl&#58;if>
<xsl&#58;choose>
<xsl&#58;when test="@direction='3'">
<!--action message-->
<span style="color&#58;darkgreen">
<xsl&#58;text>* </xsl&#58;text>
<span>
<xsl&#58;attribute name="dir">
<xsl&#58;value-of select="from/contact/metaContactDisplayName/@dir"/>
</xsl&#58;attribute>
<xsl&#58;value-of disable-output-escaping="yes" select="from/contact/metaContactDisplayName/@text"/>
</span>
<xsl&#58;text> </xsl&#58;text>
<xsl&#58;value-of disable-output-escaping="yes" select="body"/>
</span>
</xsl&#58;when>
<xsl&#58;when test="@direction='2'">
<!--internal message-->
<span>
<xsl&#58;attribute name="dir">
<xsl&#58;value-of select="body/@dir"/>
</xsl&#58;attribute>
<xsl&#58;attribute name="style">
<xsl&#58;if test="body/@bgcolor">
<xsl&#58;text>background-color&#58; </xsl&#58;text>
<xsl&#58;value-of select="body/@bgcolor"/>
<xsl&#58;text>; </xsl&#58;text>
</xsl&#58;if>
<xsl&#58;if test="body/@font">
<xsl&#58;text>font&#58; </xsl&#58;text>
<xsl&#58;value-of select="body/@font"/>
<xsl&#58;text>; </xsl&#58;text>
</xsl&#58;if>
<xsl&#58;text>font-size&#58; small; color&#58; #000000; padding&#58; 1px; border-width&#58; 1px; border-style&#58; solid; border-color&#58; #cccccc; </xsl&#58;text>
</xsl&#58;attribute>
<xsl&#58;value-of disable-output-escaping="yes" select="body"/>
</span>
</xsl&#58;when>
<xsl&#58;otherwise>
<xsl&#58;value-of disable-output-escaping="yes" select="body"/>
</xsl&#58;otherwise>
</xsl&#58;choose>
</div>
</div>
</div>
</xsl&#58;template>
</xsl&#58;stylesheet>[/code:1]

5

Thursday, August 12th 2004, 10:17am

How do you get the default font colors? I made a AIM looking style today (just installed KDE today and couldn't stand all the multiline chat styles), and i dont want to have to hardcode the colors for default chat.

6

Thursday, November 16th 2006, 5:46pm

time stamp be gone!

How do I ditch the time stamp? I turn my IM messages to text quite often, and that time stamp complicates the process...you have to hunt out each different number in the time stamp and delete it one at a time. That can get time consuming.