Re: [kopete-devel] KDE/kdenetwork/kopete/libkopete

2009-07-07 Thread Matt Rogers
On Tuesday 07 July 2009 12:19:58 am Raphael Kubo da Costa wrote:
 2009/7/5 Matt Rogers ma...@kde.org:
  On Sunday 05 July 2009 03:56:45 pm Raphael Kubo da Costa wrote:
  2009/7/5 Roman Jarosz kedge...@gmail.com:
   SVN commit 991636 by rjarosz:
  
   Bring back online/offline notifications  were lost during
   model/view merge. BUG: 190658
  
  
  
M  +105 -2kopetemetacontact.cpp
M  +2 -0  kopetemetacontact.h
M  +1 -0  kopetemetacontact_p.h
 
  Shouldn't this be backported despite some string additions, since it's
  fixing a somewhat serious bug?
 
   --- trunk/KDE/kdenetwork/kopete/libkopete/kopetemetacontact.cpp
   #991635:991636 @@ -21,6 +21,7 @@
#include kopetemetacontact.h
#include kopetemetacontact_p.h
  
   +#include QTextDocument
  
#include kabc/addressbook.h
#include kabc/addressee.h
   @@ -29,6 +30,7 @@
#include klocale.h
#include kmessagebox.h
#include kdeversion.h
   +#include knotification.h
  
#include kabcpersistence.h
#include kopetecontactlist.h
   @@ -40,6 +42,8 @@
#include kopetegroup.h
#include kopeteglobal.h
#include kopeteuiglobal.h
   +#include kopetebehaviorsettings.h
   +#include kopeteemoticons.h
  
namespace Kopete {
  
   @@ -151,7 +155,6 @@
  }
}
  
   -
void MetaContact::removeContact(Contact *c, bool deleted)
{
  if( !d-contacts.contains( c ) )
   @@ -433,7 +436,7 @@
  {
  Contact *c = it.next();
  unsigned long int i = c-idleTime();
   -   if( c-isOnline()  i  time || time == 0 )
   +   if( (c-isOnline()  i  time) || time == 0 )
  {
  time = i;
  }
   @@ -577,6 +580,9 @@
{
  updateOnlineStatus();
  emit contactStatusChanged( c, status );
   +
   +   if ( c != c-account()-myself() )
   +   onlineStatusNotification( c );
}
  
void MetaContact::setDisplayName( const QString name )
   @@ -1228,8 +1234,105 @@
  return d-contacts;
}
  
   +void MetaContact::onlineStatusNotification( Kopete::Contact * c )
   +{
   +   // comparing the status of the previous and new preferred
   contact is the determining factor in deciding to notify +
   Kopete::OnlineStatus newNotifyOnlineStatus;
  
   +   Kopete::Contact * pc = preferredContact();
   +   if ( pc )
   +   newNotifyOnlineStatus = pc-onlineStatus();
   +   else // the last child contact has gone offline or otherwise
   unreachable, so take the changed contact's online status +
   newNotifyOnlineStatus = c-onlineStatus();
  
   +   // ensure we are not suppressing notifications, because
   connecting or disconnected +   if (
   !c-account()-suppressStatusNotification() 
   c-account()-isConnected() +
   c-account()-myself()-onlineStatus().status() !=
   OnlineStatus::Connecting +
   (Kopete::BehaviorSettings::self()-enableEventsWhileAway() ||
   !c-account()-isAway()) ) +   {
   +   // figure out what's happened
   +   enum ChangeType { noChange, noEvent, signedIn,
   changedStatus, signedOut }; +   ChangeType t = noChange;
   +
   +   // first, exclude changes due to blocking or
   subscription changes at the protocol level +   if (
   d-notifyOnlineStatus.status() == Kopete::OnlineStatus::Unknown ||
   newNotifyOnlineStatus.status() == Kopete::OnlineStatus::Unknown ) +
   {
   +   t = noEvent; // This means the contact's
   changed from or to unknown - due to a protocol state change, not a
   contact state change +   }
   +   else
   +   { // we're dealing with a genuine contact state change
   +   if ( d-notifyOnlineStatus.status() ==
   Kopete::OnlineStatus::Offline ) +   {
   +   if ( newNotifyOnlineStatus.status() !=
   Kopete::OnlineStatus::Offline ) +   {
   +   t = signedIn;   // contact has
   gone from offline to something else, it's a sign-in +
 }
   +   }
   +   else if ( d-notifyOnlineStatus.status() ==
   Kopete::OnlineStatus::Online + ||
   d-notifyOnlineStatus.status() == Kopete::OnlineStatus::Away +
 || d-notifyOnlineStatus.status() ==
   Kopete::OnlineStatus::Invisible) +   {
   +   if ( newNotifyOnlineStatus.status() ==
   Kopete::OnlineStatus::Offline ) +   {
   +   t = signedOut;  // contact has
   gone from an online state to an offline state, it's a sign out +
 }
   +   else if ( d-notifyOnlineStatus 
   newNotifyOnlineStatus || d-notifyOnlineStatus 

Re: [kopete-devel] KDE/kdenetwork/kopete/libkopete

2009-07-05 Thread Raphael Kubo da Costa
2009/7/5 Roman Jarosz kedge...@gmail.com:
 SVN commit 991636 by rjarosz:

 Bring back online/offline notifications  were lost during model/view 
 merge.
 BUG: 190658



  M  +105 -2    kopetemetacontact.cpp
  M  +2 -0      kopetemetacontact.h
  M  +1 -0      kopetemetacontact_p.h
Shouldn't this be backported despite some string additions, since it's
fixing a somewhat serious bug?


 --- trunk/KDE/kdenetwork/kopete/libkopete/kopetemetacontact.cpp #991635:991636
 @@ -21,6 +21,7 @@
  #include kopetemetacontact.h
  #include kopetemetacontact_p.h

 +#include QTextDocument

  #include kabc/addressbook.h
  #include kabc/addressee.h
 @@ -29,6 +30,7 @@
  #include klocale.h
  #include kmessagebox.h
  #include kdeversion.h
 +#include knotification.h

  #include kabcpersistence.h
  #include kopetecontactlist.h
 @@ -40,6 +42,8 @@
  #include kopetegroup.h
  #include kopeteglobal.h
  #include kopeteuiglobal.h
 +#include kopetebehaviorsettings.h
 +#include kopeteemoticons.h

  namespace Kopete {

 @@ -151,7 +155,6 @@
        }
  }

 -
  void MetaContact::removeContact(Contact *c, bool deleted)
  {
        if( !d-contacts.contains( c ) )
 @@ -433,7 +436,7 @@
        {
                Contact *c = it.next();
                unsigned long int i = c-idleTime();
 -               if( c-isOnline()  i  time || time == 0 )
 +               if( (c-isOnline()  i  time) || time == 0 )
                {
                        time = i;
                }
 @@ -577,6 +580,9 @@
  {
        updateOnlineStatus();
        emit contactStatusChanged( c, status );
 +
 +       if ( c != c-account()-myself() )
 +               onlineStatusNotification( c );
  }

  void MetaContact::setDisplayName( const QString name )
 @@ -1228,8 +1234,105 @@
        return d-contacts;
  }

 +void MetaContact::onlineStatusNotification( Kopete::Contact * c )
 +{
 +       // comparing the status of the previous and new preferred contact is 
 the determining factor in deciding to notify
 +       Kopete::OnlineStatus newNotifyOnlineStatus;

 +       Kopete::Contact * pc = preferredContact();
 +       if ( pc )
 +               newNotifyOnlineStatus = pc-onlineStatus();
 +       else // the last child contact has gone offline or otherwise 
 unreachable, so take the changed contact's online status
 +               newNotifyOnlineStatus = c-onlineStatus();

 +       // ensure we are not suppressing notifications, because connecting or 
 disconnected
 +       if ( !c-account()-suppressStatusNotification()  
 c-account()-isConnected()
 +             c-account()-myself()-onlineStatus().status() != 
 OnlineStatus::Connecting
 +             (Kopete::BehaviorSettings::self()-enableEventsWhileAway() || 
 !c-account()-isAway()) )
 +       {
 +               // figure out what's happened
 +               enum ChangeType { noChange, noEvent, signedIn, changedStatus, 
 signedOut };
 +               ChangeType t = noChange;
 +
 +               // first, exclude changes due to blocking or subscription 
 changes at the protocol level
 +               if ( d-notifyOnlineStatus.status() == 
 Kopete::OnlineStatus::Unknown || newNotifyOnlineStatus.status() == 
 Kopete::OnlineStatus::Unknown )
 +               {
 +                       t = noEvent; // This means the contact's changed from 
 or to unknown - due to a protocol state change, not a contact state change
 +               }
 +               else
 +               { // we're dealing with a genuine contact state change
 +                       if ( d-notifyOnlineStatus.status() == 
 Kopete::OnlineStatus::Offline )
 +                       {
 +                               if ( newNotifyOnlineStatus.status() != 
 Kopete::OnlineStatus::Offline )
 +                               {
 +                                       t = signedIn;   // contact has gone 
 from offline to something else, it's a sign-in
 +                               }
 +                       }
 +                       else if ( d-notifyOnlineStatus.status() == 
 Kopete::OnlineStatus::Online
 +                                 || d-notifyOnlineStatus.status() == 
 Kopete::OnlineStatus::Away
 +                                 || d-notifyOnlineStatus.status() == 
 Kopete::OnlineStatus::Invisible)
 +                       {
 +                               if ( newNotifyOnlineStatus.status() == 
 Kopete::OnlineStatus::Offline )
 +                               {
 +                                       t = signedOut;  // contact has gone 
 from an online state to an offline state, it's a sign out
 +                               }
 +                               else if ( d-notifyOnlineStatus  
 newNotifyOnlineStatus || d-notifyOnlineStatus  newNotifyOnlineStatus ) // 
 operator!= is useless because it's an identity operator, not an equivalence 
 operator
 +                               {
 +                                       // contact has changed online states, 
 it's a status change,
 +                                       // and the preferredContact 

Re: [kopete-devel] KDE/kdenetwork/kopete/libkopete

2009-07-05 Thread Matt Rogers
On Sunday 05 July 2009 03:56:45 pm Raphael Kubo da Costa wrote:
 2009/7/5 Roman Jarosz kedge...@gmail.com:
  SVN commit 991636 by rjarosz:
 
  Bring back online/offline notifications  were lost during model/view
  merge. BUG: 190658
 
 
 
   M  +105 -2kopetemetacontact.cpp
   M  +2 -0  kopetemetacontact.h
   M  +1 -0  kopetemetacontact_p.h

 Shouldn't this be backported despite some string additions, since it's
 fixing a somewhat serious bug?

  --- trunk/KDE/kdenetwork/kopete/libkopete/kopetemetacontact.cpp
  #991635:991636 @@ -21,6 +21,7 @@
   #include kopetemetacontact.h
   #include kopetemetacontact_p.h
 
  +#include QTextDocument
 
   #include kabc/addressbook.h
   #include kabc/addressee.h
  @@ -29,6 +30,7 @@
   #include klocale.h
   #include kmessagebox.h
   #include kdeversion.h
  +#include knotification.h
 
   #include kabcpersistence.h
   #include kopetecontactlist.h
  @@ -40,6 +42,8 @@
   #include kopetegroup.h
   #include kopeteglobal.h
   #include kopeteuiglobal.h
  +#include kopetebehaviorsettings.h
  +#include kopeteemoticons.h
 
   namespace Kopete {
 
  @@ -151,7 +155,6 @@
 }
   }
 
  -
   void MetaContact::removeContact(Contact *c, bool deleted)
   {
 if( !d-contacts.contains( c ) )
  @@ -433,7 +436,7 @@
 {
 Contact *c = it.next();
 unsigned long int i = c-idleTime();
  -   if( c-isOnline()  i  time || time == 0 )
  +   if( (c-isOnline()  i  time) || time == 0 )
 {
 time = i;
 }
  @@ -577,6 +580,9 @@
   {
 updateOnlineStatus();
 emit contactStatusChanged( c, status );
  +
  +   if ( c != c-account()-myself() )
  +   onlineStatusNotification( c );
   }
 
   void MetaContact::setDisplayName( const QString name )
  @@ -1228,8 +1234,105 @@
 return d-contacts;
   }
 
  +void MetaContact::onlineStatusNotification( Kopete::Contact * c )
  +{
  +   // comparing the status of the previous and new preferred contact
  is the determining factor in deciding to notify +  
  Kopete::OnlineStatus newNotifyOnlineStatus;
 
  +   Kopete::Contact * pc = preferredContact();
  +   if ( pc )
  +   newNotifyOnlineStatus = pc-onlineStatus();
  +   else // the last child contact has gone offline or otherwise
  unreachable, so take the changed contact's online status +  
  newNotifyOnlineStatus = c-onlineStatus();
 
  +   // ensure we are not suppressing notifications, because
  connecting or disconnected +   if (
  !c-account()-suppressStatusNotification() 
  c-account()-isConnected() +
  c-account()-myself()-onlineStatus().status() !=
  OnlineStatus::Connecting +
  (Kopete::BehaviorSettings::self()-enableEventsWhileAway() ||
  !c-account()-isAway()) ) +   {
  +   // figure out what's happened
  +   enum ChangeType { noChange, noEvent, signedIn,
  changedStatus, signedOut }; +   ChangeType t = noChange;
  +
  +   // first, exclude changes due to blocking or subscription
  changes at the protocol level +   if (
  d-notifyOnlineStatus.status() == Kopete::OnlineStatus::Unknown ||
  newNotifyOnlineStatus.status() == Kopete::OnlineStatus::Unknown ) +  
  {
  +   t = noEvent; // This means the contact's changed
  from or to unknown - due to a protocol state change, not a contact state
  change +   }
  +   else
  +   { // we're dealing with a genuine contact state change
  +   if ( d-notifyOnlineStatus.status() ==
  Kopete::OnlineStatus::Offline ) +   {
  +   if ( newNotifyOnlineStatus.status() !=
  Kopete::OnlineStatus::Offline ) +   {
  +   t = signedIn;   // contact has
  gone from offline to something else, it's a sign-in +
}
  +   }
  +   else if ( d-notifyOnlineStatus.status() ==
  Kopete::OnlineStatus::Online + ||
  d-notifyOnlineStatus.status() == Kopete::OnlineStatus::Away +  
|| d-notifyOnlineStatus.status() ==
  Kopete::OnlineStatus::Invisible) +   {
  +   if ( newNotifyOnlineStatus.status() ==
  Kopete::OnlineStatus::Offline ) +   {
  +   t = signedOut;  // contact has
  gone from an online state to an offline state, it's a sign out +
}
  +   else if ( d-notifyOnlineStatus 
  newNotifyOnlineStatus || d-notifyOnlineStatus  newNotifyOnlineStatus )
  // operator!= is useless because it's an identity operator, not an
  equivalence operator +   {
  +