SVN commit 1110404 by staniek: Forms *"Assign action" feature ported M +5 -1 core/kexiactionproxy.cpp M +7 -5 formeditor/kexiformeventhandler.cpp M +1 -1 formeditor/kexiformeventhandler.h M +2 -5 formeditor/widgetlibrary.cpp M +1 -1 formeditor/widgetlibrary.h M +1 -1 main/KexiMainWindow_p.h M +2 -0 plugins/forms/kexidbfactory.cpp M +1 -3 plugins/forms/kexiformmanager.cpp --- trunk/koffice/kexi/core/kexiactionproxy.cpp #1110403:1110404 @@ -87,6 +87,8 @@ , m_KAction_setEnabled_helper(new KAction_setEnabled_Helper(this)) , m_focusedChild(0) { +kDebug() << this; +kBacktrace(); m_signal_parent.setObjectName("signal_parent"); //m_sharedActionChildren.setAutoDelete(false); //TODO port logic to KDE4 //m_alternativeActions.setAutoDelete(true); //TODO port logic to KDE4 @@ -95,6 +97,7 @@ KexiActionProxy::~KexiActionProxy() { +kDebug() << this; qDeleteAll(m_signals); m_signals.clear(); //detach myself from every child @@ -184,7 +187,7 @@ QAction *a = client->action(action_name.toLatin1().constData()); if (!a) return; - plugSharedAction(a->objectName(), a, SLOT(activate())); + plugSharedAction(a->objectName(), a, SLOT(trigger())); //update availability setAvailable(a->objectName(), a->isEnabled()); @@ -276,6 +279,7 @@ void KexiActionProxy::takeActionProxyChild(KexiActionProxy* child) { +kDebug() << child; const int index = m_sharedActionChildren.indexOf(child); if (index != -1) m_sharedActionChildren.removeAt(index); --- trunk/koffice/kexi/formeditor/kexiformeventhandler.cpp #1110403:1110404 @@ -79,8 +79,9 @@ { } -void KexiFormEventAction::activate() +void KexiFormEventAction::trigger() { +kDebug() << m_actionName << m_objectName; KexiProject* project = KexiMainWindowIface::global()->project(); if (!project) return; @@ -164,18 +165,19 @@ KexiPart::Info* partInfo = data.decodeString(actionType, actionArg, ok); if (!ok) continue; +kDebug() << "actionType:" << actionType << "actionArg:" << actionArg; if (actionType == "kaction" || actionType == "currentForm") { QAction *action = KexiMainWindowIface::global()->actionCollection()->action( actionArg); if (!action) continue; - QObject::disconnect(widget, SIGNAL(clicked()), action, SLOT(activate())); //safety - QObject::connect(widget, SIGNAL(clicked()), action, SLOT(activate())); + QObject::disconnect(widget, SIGNAL(clicked()), action, SLOT(trigger())); //safety + QObject::connect(widget, SIGNAL(clicked()), action, SLOT(trigger())); } else if (partInfo) { //'open or execute' action KexiFormEventAction* action = new KexiFormEventAction(widget, actionType, actionArg, data.option); - QObject::disconnect(widget, SIGNAL(clicked()), action, SLOT(activate())); - QObject::connect(widget, SIGNAL(clicked()), action, SLOT(activate())); + QObject::disconnect(widget, SIGNAL(clicked()), action, SLOT(trigger())); + QObject::connect(widget, SIGNAL(clicked()), action, SLOT(trigger())); } } } --- trunk/koffice/kexi/formeditor/kexiformeventhandler.h #1110403:1110404 @@ -91,7 +91,7 @@ public slots: //! Activates the action. If the object supports executing (macro, script), //! it is executed; otherwise (table, query, form,...) it is opened in its data view. - virtual void activate(); + virtual void trigger(); private: QString m_actionName, m_objectName, m_actionOption; --- trunk/koffice/kexi/formeditor/widgetlibrary.cpp #1110403:1110404 @@ -364,18 +364,15 @@ //2.0 return actions; } -/* 2.0 void WidgetLibrary::addCustomWidgetActions(KActionCollection *col) { if (!col) return; foreach (WidgetFactory *factory, d->factories) { - factory->createCustomActions( - factory->m_guiClient - ? factory->m_guiClient->actionCollection() : col); + factory->createCustomActions(col); } -}*/ +} QWidget* WidgetLibrary::createWidget(const QByteArray &classname, QWidget *parent, const char *name, Container *c, --- trunk/koffice/kexi/formeditor/widgetlibrary.h #1110403:1110404 @@ -78,7 +78,7 @@ //prev ActionList createWidgetActions(KXMLGUIClient* client, KActionCollection *parent, //prev QObject *receiver, const char *slot); -//2.0 void addCustomWidgetActions(KActionCollection *col); + void addCustomWidgetActions(KActionCollection *col); //old /** //old * creates the XML for widget actions --- trunk/koffice/kexi/main/KexiMainWindow_p.h #1110403:1110404 @@ -856,7 +856,7 @@ m_findDialog = new KexiFindDialog(wnd); m_findDialog->setActions(action_edit_findnext, action_edit_findprev, action_edit_replace, action_edit_replace_all); - /* connect(m_findDialog, SIGNAL(findNext()), action_edit_findnext, SLOT(activate())); + /* connect(m_findDialog, SIGNAL(findNext()), action_edit_findnext, SLOT(trigger())); connect(m_findDialog, SIGNAL(find()), wnd, SLOT(slotEditFindNext())); connect(m_findDialog, SIGNAL(replace()), wnd, SLOT(slotEditReplaceNext())); connect(m_findDialog, SIGNAL(replaceAll()), wnd, SLOT(slotEditReplaceAll()));*/ --- trunk/koffice/kexi/plugins/forms/kexidbfactory.cpp #1110403:1110404 @@ -72,6 +72,7 @@ KexiDBFactory::KexiDBFactory(QObject *parent, const QVariantList &) : KFormDesigner::WidgetFactory(parent, "kexidb") + , m_assignAction(0) { { KexiDataAwareWidgetInfo *wi = new KexiDataAwareWidgetInfo(this); @@ -443,6 +444,7 @@ { if (classname == "QPushButton" || classname == "KPushButton" || classname == "KexiPushButton") { /*! @todo also call createMenuActions() for inherited factory! */ +kDebug() << m_assignAction; menu->addAction(m_assignAction); return true; } else if (classname == "KexiDBImageBox") { --- trunk/koffice/kexi/plugins/forms/kexiformmanager.cpp #1110403:1110404 @@ -164,8 +164,6 @@ //2.0 d->lib->createWidgetActions(client, d->collection, //2.0 this, SLOT(insertWidget(const QByteArray &))); - if (false) { - } #ifdef KFD_SIGSLOTS if (d->features & KFormDesigner::Form::EnableConnections) { // nothing @@ -222,7 +220,7 @@ styleAction->setMenuAccelsEnabled(true); #endif -//2.0 d->lib->addCustomWidgetActions(d->collection); + d->lib->addCustomWidgetActions(d->collection); #ifdef KEXI_DEBUG_GUI KConfigGroup generalGroup(KGlobal::config()->group("General"));