Hi Olivier,
Olivier Goffart wrote:
Hi, this patch is better then the current behaviour, and should be commited,
because the wrong icons are a bug.
But the scaling is wrong. You force 22x22 and 11x11
That shouldn't be a problem as the systray icon size is fixed to 22x22.
You're still right of course ;-)
The correct fix is to use QIcon instead of QPixmap, and have a QIconEngine.
I think that Kopete::OnlineStatus should be used here, as it already have all
the internals to create QIcons for corrects status. Maybe it will be easy to
add support for the global status in here.
Good point, I tried that approach but it looked rather ugly:
kopeteonlinestatus* uses overlay icons custom to protocols and these
overlay icons look bad on top of the kopete icon.
Therefore I changed it to a similar approach used by the identity status
widget in kopetewindow.cpp, see the patch attached. Visually that means
the same result except that the overlay icons are a bit smaller and an
overlay icon is used for offline (instead of graying out the kopete
icon). Ok to commit?
Regards,
Dennis
diff --git a/kopete/kopete/systemtray.cpp b/kopete/kopete/systemtray.cpp
index a39c508..59e95c2 100644
--- a/kopete/kopete/systemtray.cpp
+++ b/kopete/kopete/systemtray.cpp
@@ -233,56 +233,34 @@ void KopeteSystemTray::slotReevaluateAccountStates()
if ( mIsBlinking )
return;
-
- //kDebug(14010) ;
- bool bOnline = false;
- bool bAway = false;
- bool bOffline = false;
- Kopete::Contact *c = 0;
-
- QListIterator<Kopete::Account *> it(Kopete::AccountManager::self()->accounts());
- while ( it.hasNext() )
+ Kopete::OnlineStatus highestStatus;
+ foreach ( Kopete::Account *account, Kopete::AccountManager::self()->accounts())
{
- c = it.next()->myself();
- if (!c)
- continue;
-
- if (c->onlineStatus().status() == Kopete::OnlineStatus::Online)
- {
- bOnline = true; // at least one contact is online
- }
- else if (c->onlineStatus().status() == Kopete::OnlineStatus::Away
- || c->onlineStatus().status() == Kopete::OnlineStatus::Invisible)
- {
- bAway = true; // at least one contact is away or invisible
- }
- else // this account must be offline (or unknown, which I don't know how to handle)
+ if ( account->myself() && account->myself()->onlineStatus() > highestStatus )
{
- bOffline = true;
+ highestStatus = account->myself()->onlineStatus();
}
}
- if (!bOnline && !bAway && !bOffline) // special case, no accounts defined (yet)
- bOffline = true;
-
- if (bAway)
- {
- if (!bOnline && !bOffline) // none online and none offline -> all away
- setIcon(loadIcon("kopete_all_away"));
- else
- setIcon(loadIcon("kopete_some_away"));
- }
- else if(bOnline)
- {
- /*if(bOffline) // at least one offline and at least one online -> some accounts online
- setIcon(loadIcon("kopete_some_online"));
- else*/ // none offline and none away -> all online
- setIcon(mKopeteIcon);
- }
- else // none away and none online -> all offline
+ switch ( highestStatus.status() )
{
- //kDebug(14010) << "All Accounts offline!";
- setIcon(loadIcon("kopete_offline"));
+ case Kopete::OnlineStatus::Unknown:
+ case Kopete::OnlineStatus::Offline:
+ case Kopete::OnlineStatus::Connecting:
+ setIcon(KIcon( "kopete", KIconLoader::global(),
+ QStringList() << QString() << "user-offline" ));
+ break;
+ case Kopete::OnlineStatus::Invisible:
+ setIcon(KIcon( "kopete", KIconLoader::global(),
+ QStringList() << QString() << "user-invisible" ));
+ break;
+ case Kopete::OnlineStatus::Away:
+ setIcon(KIcon( "kopete", KIconLoader::global(),
+ QStringList() << QString() << "user-away" ));
+ break;
+ case Kopete::OnlineStatus::Online:
+ setIcon(KIcon( "kopete" ) );
+ break;
}
}
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel