On Mon, 14 Jan 2008 22:15:16 +0100, Olivier Goffart <[EMAIL PROTECTED]> wrote:
> Le dimanche 13 janvier 2008, Roman Jarosz a écrit :
>> Hi,
>>
>> I've managed to move StatusRootAction, StatusGroupAction, StatusAction and
>> StatusEditAction from libkopete to kopete/statusmenu/ ( better dir name
>> idea are welcome :) )
>>
>> Also I had to move createAccountStatusActions to StatusRootAction and
>> changed it to static.
>>
>> And to be able to iterate over registered statuses in
>> createAccountStatusActions I've added RegisteredStatusMap
>> registeredStatusMap( Protocol *protocol ) const; to OnlineStatusManager and
>> moved
>>
>> struct RegisteredStatusStruct
>> {
>> QString caption;
>> OnlineStatusManager::Categories categories;
>> OnlineStatusManager::Options options;
>> };
>> typedef QMap< OnlineStatus , RegisteredStatusStruct > RegisteredStatusMap;
>> to OnlineStatusManager header file.
>
> Another possibility would be to add theses 3 field to the OnlineStatus
> itself... is it a good idea ? and then return a simple list of
> OnlineStatus.
This would also remove one new function from OnlineStatusManager which returns
category for given OnlineStatus
OnlineStatusManager::Categories OnlineStatusManager::category( const
OnlineStatus& status )
I think it's good idea.
>>
>> Also I found another problem that some accounts don't want to have status
>> menu and they bypass it in code so I've added hack that looks like this
>>
>> KActionMenu *menu = a->actionMenu();
>> if( menu )
>> {
>> QList<QAction *> actionList = menu->menu()->actions();
>> // Hack to check if we should add status actions
>> if ( actionList.count() > 1 && !actionList.at(0)->isEnabled() &&
>> actionList.at(1)->isSeparator() )
>> Kopete::StatusRootAction::createAccountStatusActions( a, menu,
>> actionList.at(1) );
>>
>> popup->addAction( menu );
>> }
>>
>> This checks if first action in menu is title and second is separator. If
>> it's true then we should add menu. The question is if I should use this
>> hack or add argument to Account::actionMenu() which will indicate if we
>> should or shouldn't add status menu.
>
> This is not good.
> Why would a protocol not have such status ?
GaduGadu -> I think it's using old API
WPAccount -> same here
JabberTransport -> I think it's because transport can't change status, but you
should know better.
> Maybe it's still using the old API.
> Please don't use such hack.
>
The problem is that I still need the hack so I can add status menu before
separator and not before
title which is also action. (I need the pointer to separator)
I think the best would be to do it this way
// First create empty menu.
KActionMenu *menu = new KActionMenu( accountId(), this );
// Add status menu if account wants it
if ( !account->hasCustomStatusMenu() ) // virtual function or property which
would return true if account wants custom status menu
Kopete::StatusRootAction::createAccountStatusActions( a, menu );
// and add custom account actions
account->actionMenu( menu ); //probably change the name createActionMenu ||
fillActionMenu
This way we could normally append the status menu (no need to find separator)
if account wants it
and the actionMenu will be almost the same.
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel