On Mon, 27 Oct 2008 05:00:41 +0100, Matt Rogers <[EMAIL PROTECTED]> wrote:
> On Sunday 26 October 2008 16:54:00 Roman Jarosz wrote: >> Hi, >> >> some jabber (gtalk) clients don't send delivery message back so >> the sending notification is turning forever in chat window (bug 173599). >> >> I've created patch which allows to suppress the sending notification. >> >> Is it ok to commit? I'm asking because I've added code into >> Kopete::Contact >> so other protocols can use it too in future. >> >> Regards, >> Roman > > There isn't a diff attached. It looks like the output of svn st > instead... Oh right :), here is the diff.
Index: libkopete/kopetecontact.h =================================================================== --- libkopete/kopetecontact.h (revision 876270) +++ libkopete/kopetecontact.h (working copy) @@ -366,8 +366,18 @@ */ void setPhoto(const QString &photoPath); + /** + * Returns true if sending notification should be suppressed. + */ + bool suppressSendingNotification() const; + public slots: /** + * Disable sending notification. + */ + void setSuppressSendingNotification(bool suppress); + + /** * This should typically pop up a KopeteChatWindow */ void startChat(); Index: libkopete/kopetecontact.cpp =================================================================== --- libkopete/kopetecontact.cpp (revision 876270) +++ libkopete/kopetecontact.cpp (working copy) @@ -769,7 +769,16 @@ setProperty( Kopete::Global::Properties::self()->photo(), photoPath ); } +void Kopete::Contact::setSuppressSendingNotification( bool suppress ) +{ + setProperty( Kopete::Global::Properties::self()->suppressSendingNotification(), suppress ); +} +bool Kopete::Contact::suppressSendingNotification() const +{ + return property( Kopete::Global::Properties::self()->suppressSendingNotification() ).value().toBool(); +} + } //END namespace Kopete #include "kopetecontact.moc" Index: libkopete/kopeteglobal.h =================================================================== --- libkopete/kopeteglobal.h (revision 876270) +++ libkopete/kopeteglobal.h (working copy) @@ -129,6 +129,10 @@ * If it's a QString, it should points to the path the image is stored. */ const PropertyTmpl &photo() const; + /** + * @return default template for a sending notification suppression. + */ + const PropertyTmpl &suppressSendingNotification() const; /** * @return a map of all registered PropertyTmpl object Index: libkopete/kopeteglobal.cpp =================================================================== --- libkopete/kopeteglobal.cpp (revision 876270) +++ libkopete/kopeteglobal.cpp (working copy) @@ -67,6 +67,7 @@ mSelf->workMobilePhone(); mSelf->nickName(); mSelf->photo(); + mSelf->suppressSendingNotification(); } return mSelf; @@ -213,6 +214,11 @@ i18n("Photo"), QString(), true); } +const PropertyTmpl &Properties::suppressSendingNotification() const +{ + return createProp(QLatin1String("suppressSendingNotification"), + i18n("Suppress Sending Notification"), QString(), true); +} const PropertyTmpl &Properties::createProp(const QString &key, const QString &label, const QString &icon, bool persistent) const Index: kopete/chatwindow/chatmessagepart.cpp =================================================================== --- kopete/chatwindow/chatmessagepart.cpp (revision 876270) +++ kopete/chatwindow/chatmessagepart.cpp (working copy) @@ -432,7 +432,11 @@ if ( (*it).id() == messageId ) { (*it).setState( state ); - changeMessageStateElement( messageId, state ); + if ( suppressSendingState( (*it) ) ) + changeMessageStateElement( messageId, Kopete::Message::StateUnknown ); + else + changeMessageStateElement( messageId, state ); + break; } } @@ -571,7 +575,12 @@ if ( message.type() == Kopete::Message::TypeNormal ) { if ( message.direction() == Kopete::Message::Outbound ) - changeMessageStateElement( message.id(), message.state() ); + { + if ( suppressSendingState( message ) ) + changeMessageStateElement( message.id(), Kopete::Message::StateUnknown ); + else + changeMessageStateElement( message.id(), message.state() ); + } } else if ( message.type() == Kopete::Message::TypeFileTransferRequest ) { @@ -1447,6 +1456,12 @@ d->chatFont = settings->chatFont(); } +bool ChatMessagePart::suppressSendingState( const Kopete::Message& message ) const +{ + return ( message.state() == Kopete::Message::StateSending && !message.to().isEmpty() + && message.to().first()->suppressSendingNotification() ); +} + void HTMLEventListener::handleEvent( DOM::Event &event ) { DOM::HTMLInputElement element = event.currentTarget(); Index: kopete/chatwindow/chatmessagepart.h =================================================================== --- kopete/chatwindow/chatmessagepart.h (revision 876270) +++ kopete/chatwindow/chatmessagepart.h (working copy) @@ -281,6 +281,8 @@ void readChatFont(); + bool suppressSendingState( const Kopete::Message& message ) const; + class Private; Private *d; }; Index: protocols/jabber/jabbercontact.cpp =================================================================== --- protocols/jabber/jabbercontact.cpp (revision 876270) +++ protocols/jabber/jabbercontact.cpp (working copy) @@ -39,6 +39,7 @@ #include <kfiledialog.h> #include <kaction.h> #include <kactionmenu.h> +#include <ktoggleaction.h> #include <kicon.h> #include <kstandarddirs.h> #include <kio/netaccess.h> @@ -243,11 +244,17 @@ } + KAction *actionSuppressSendingNotification = new KToggleAction( this ); + actionSuppressSendingNotification->setIcon( (KIcon("preferences-desktop-notification") ) ); + actionSuppressSendingNotification->setText( i18n ("Suppress Sending Notification") ); + actionSuppressSendingNotification->setChecked( suppressSendingNotification() ); + connect(actionSuppressSendingNotification, SIGNAL(triggered(bool)), this, SLOT(setSuppressSendingNotification(bool))); + actions->append( actionAuthorization ); actions->append( actionSetAvailability ); actions->append( actionSelectResource ); + actions->append( actionSuppressSendingNotification ); - #if 0 KAction *testAction = new KAction(i18n("Test action"), this); actionJingleAudioCall->setEnabled( true );
_______________________________________________ kopete-devel mailing list kopete-devel@kde.org https://mail.kde.org/mailman/listinfo/kopete-devel