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.

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

1

Wednesday, June 8th 2005, 3:21pm

howto get hyperlinks and mailto:

does somebody know how to get the contents of a lineedit, a textlabel or a certain phrase in a kedit to become a hyperlink (its blue and underlined and when you click it it opens the page in knoqueror ;) ) or a mailto: link which opens your mail program to write a mail to the specified adress?
i know for example that both of these appear in kabout dialogs but i just cant figur out how to do it...
thanks
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Wednesday, June 8th 2005, 3:23pm

KDE has some enhanced widgets for that.

Cheers,
_
Qt/KDE Developer
Debian User

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

3

Wednesday, June 8th 2005, 9:39pm

hm your right kde does provide kurllabel but thats only a lable that emits a signal containing the url when leftclicked; what do i have to do to have the url opened in the standard browser? is there somekind of global slot that i can connect the signal to?
thanks
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

4

Wednesday, June 8th 2005, 10:37pm

Qt/KDE Developer
Debian User

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

5

Thursday, June 9th 2005, 12:25am

wow thanks that was easy...
i am still wondering how to do it for the email link though... if i preced the email address with a "mailto:" and open that in konqueror as an url it does in fact open kmail, but only after opening a blank konqueror window...
do you know an easier way?
thanks
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

6

Thursday, June 9th 2005, 10:40am

Quoted

Originally posted by soul_rebel
wow thanks that was easy...
i am still wondering how to do it for the email link though


Hmm, KRun should handle mailto: URIs as well.
Did you use

Source code

1
new KRun(mailtoURI);

or one of the static methods?

Cheers,
_
Qt/KDE Developer
Debian User

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

7

Thursday, June 9th 2005, 11:45am

i used a static method, and passed mimetype text/html (there was no mimetype for mailto links...) thats why he opened in konqueror first...
but it works the way you posted it! thank you very much
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

8

Thursday, June 9th 2005, 12:46pm

btw do you know of a way to have kurllabel look like a regular label?
the highlightedcolor property is very annoying, because my kurllabel is in a group with regular qlabels and when the group gets disbled nothing happens with the qlabel it still keeps its color (because it doesnt use paletteforegroundcolor but highlightedcolor, which isnt touched when the widget gets disabled).
do you know a way around this, can i somehow force the use of paletteforegroundcolor?
thanks for your help!
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

9

Thursday, June 9th 2005, 3:20pm

You could try setting a QColorGroup

Cheers,
_
Qt/KDE Developer
Debian User

soul_rebel

Beginner

  • "soul_rebel" started this thread

Posts: 21

Location: Germany

  • Send private message

10

Sunday, June 12th 2005, 3:35pm

hm yes but kurllabel already has a colorgroup, that i can modify, the only problem is if i set the kurllabels palette to a regular one the settings get overwritten once the mouse hovers over the widgets (because in kurllabels leaveevent palette::foreground is set to KGlobalSettings::linkColor()) ). i found a way around it though using a signal that leaveevent emits:

Source code

1
2
3
4
5
6
7
8
9
//in constructor
eWWW->setPalette(eName->palette());//get palette from regular qlabel
eWWW->setSelectedColor((QString)"blue");
eWWW->setUnderline(false);
eWWW->setFloat(true);
connect(eWWW, SIGNAL(leftURL()), this, SLOT(mouseLeftURL()));

//mouseleftURL()
eWWW->setPalette(eName->palette());

this way you will get a kurllabel that looks exactly like a qlabel but glows blue and becomes underlined when hovered by mouse.
thanks for your help
"As long as there is private property and while money is the standard of all things, I do not think that a nation can be governed either justly or happily..." - Raphael Hythloday in Utopia by Thomas More, 15th Century