Hi all!

This is my first e-mail on the list allthough I've been lurking around
for quite a while. I read the call for new Kopete developers and I
thought I'd like to help.

I got QT4 based Kopete compiling and running on my PC and just looked
around for something to fix. As things are pretty, umm, non-perfect
there were lots of things I noticed :)

One such was that "send" button is always enabled no matter if there
was anything typed or not. After adding a few debug prints I saw that
the reason was that ChatView::m_editPart.text() always contains some
text, even when nothing is typed, like this:

<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt;
font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0;
text-indent:0px;">a</p></body></html>


I browsed around the code and came up with a really simple fix (diff attatched):
in kopete/kopete/chatwindow/chattexteditpart.cpp line 243 I had to
replace text().isEmpty() with text(Qt::PlainText).isEmpty() so it
would ignore all of the HTML markup and return true when nothing is
typed. Crude but seems to work.

I did notice there was a comment somewhere talking about replacing the
whole text edit part with something from QT so my fix might not really
be worth it if it gets replaced.


I haven't actually searched the bugzilla so I don't know if there were
any bugs connected to this.

Anyway, as this is my first ever KDE modification I'd like some people
to review this and perhaps tell me what direction should I look when I
want to do something else with Kopete.


-- 
Kalle Last
Index: kopete/kopete/chatwindow/chattexteditpart.cpp
===================================================================
--- kopete/kopete/chatwindow/chattexteditpart.cpp	(revision 720261)
+++ kopete/kopete/chatwindow/chattexteditpart.cpp	(working copy)
@@ -240,7 +240,7 @@
 	if ( !m_session ) return false;
 
 	// can't send if there's nothing *to* send...
-	if ( text().isEmpty() )
+	if ( text(Qt::PlainText).isEmpty() )
 		return false;
 
 	Kopete::ContactPtrList members = m_session->members();
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to