[bt-devel] Cleanup for KHTML and KDE/Qt Porting

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Mon Feb 16 08:48:20 MST 2009


Quoting Gary Holmlund <gary.holmlund at gmail.com>:

> I think we should create a BtActionCollection to replace
> KActionCollection. I does not have to do much now, but if we loose the
> collection concept it will be harder to add the shortcut editor later.
>
> I think the implementation of this class interface will  do  everything
> we need to replace  KActionCollection for now. This assumes that the
> KAction's have been changed to QAction's.
>
> class BtActionCollection : public QObject
> {
>    Q_OBJECT
> public:
>    BtActionCollection(QObject* parent);
>    ~BtActionCollection();
>    addAction(const QString& name, QAction* action);
> private:
>    QMap<QString, QAction*> m_actions;
> };

I have had something similar in mind. However, after thinking about  
this for couple of days I have come to a conclusion that it doesn't  
matter whether we drop it out now or not. The display windows create  
the same actions in two functions: in a static function which doesn't  
use members, and in a member function which uses  member data.

The static function adds new actions to the given actioncollection.  
Those actions have a key string (like in your QMap), icons, tr():ed  
strings and keyboard shortcuts. The old shortcut editor knew each  
window type and got the actions from this static function. The real  
display window actions are created in another function.

We don't have to use the same mechanism because we don't use the KDE  
shortcut editor (which used KActionCollection IIRC). All we need is a  
way to know which shortcuts are configurable and a way to add their  
data (icon, tr():ed text and the shortcut) to the shortcut editor, and  
then of course a way to save the shortcuts and update the display  
windows accordingly.

At the same time I have planned a new config system. I'll try to  
implement it so that it can be used for creating the actions without  
messing up the old system. Then people can see if it's good or not.

This takes time, of course, and I don't necessarily have much of it.  
It may be better to take the sipmlest route: port KActionCollection to  
BtActionCollection, port KActions to QActions. I just have wanted to  
first create a system which makes creating (and at the same time  
porting) the actions much easier. But in the current reality we may  
have to just go forwards with what we have.

--Eeli Kaikkonen




More information about the bt-devel mailing list