[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] /: Reports: fix bug: no indication of selected toolbox
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2011-11-30 22:58:56
Message-ID: 20111130225856.AB059A60A6 () git ! kde ! org
[Download RAW message or body]
Git commit d130ba63ab62717565fd88caa61e5aa1d91ed786 by Jaroslaw Staniek.
Committed on 30/11/2011 at 23:54.
Pushed by staniek into branch 'master'.
Reports: fix bug: no indication of selected toolbox action for report element
BUG:285583
Also:
Reports: After inserting element, respective toolbox action is deselected
DIGEST: Reports: fixed bug 285583: no indication of selected toolbox action
M +6 -0 kexi/doc/dev/CHANGELOG-Kexi-js
M +3 -1 kexi/plugins/reports/kexireportdesignview.cpp
M +5 -1 kexi/plugins/reports/kexireportdesignview.h
M +24 -5 kexi/plugins/reports/kexireportpart.cpp
M +6 -4 kexi/plugins/reports/kexireportpart.h
M +2 -3 libs/koreport/common/KoReportPluginManager.cpp
M +1 -2 libs/koreport/common/KoReportPluginManager.h
M +25 -21 libs/koreport/wrtembed/KoReportDesigner.cpp
M +10 -9 libs/koreport/wrtembed/KoReportDesigner.h
http://commits.kde.org/calligra/d130ba63ab62717565fd88caa61e5aa1d91ed786
diff --git a/kexi/doc/dev/CHANGELOG-Kexi-js b/kexi/doc/dev/CHANGELOG-Kexi-js
index a046419..e3617e4 100644
--- a/kexi/doc/dev/CHANGELOG-Kexi-js
+++ b/kexi/doc/dev/CHANGELOG-Kexi-js
@@ -114,6 +114,12 @@ TODO: remove MainWindow.HoverCloseButtonForTabs setting and \
instead go with FF i \
http://www.conetrees.com/2009/03/blog/usability-spotter-4-usability-issue-google-chrome-tab-selection-through-the-mouse/
TODO: remove left-hand close button (later will be used for window list as in FF)
+2011-11-30
+Reports
+*Fix bug: no indication of selected toolbox action for report element
+BUG:285583
+*After inserting element, respective toolbox action is deselected
+
2011-11-27..29
Main Window
*set close buttons on view tabs always visible
diff --git a/kexi/plugins/reports/kexireportdesignview.cpp \
b/kexi/plugins/reports/kexireportdesignview.cpp index 5aea456..3cf1439 100644
--- a/kexi/plugins/reports/kexireportdesignview.cpp
+++ b/kexi/plugins/reports/kexireportdesignview.cpp
@@ -1,6 +1,7 @@
/*
* Kexi Report Plugin
-* Copyright (C) 2007-2009 by Adam Pigg (adam@piggz.co.uk)
+* Copyright (C) 2007-2009 by Adam Pigg <adam@piggz.co.uk>
+* Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -157,6 +158,7 @@ tristate KexiReportDesignView::afterSwitchFrom(Kexi::ViewMode \
mode)
m_reportDesigner = new KoReportDesigner(this, tempData()->reportDefinition);
m_sourceSelector->setConnectionData(tempData()->connectionDefinition);
}
+ connect(m_reportDesigner, SIGNAL(itemInserted(QString)), this, \
SIGNAL(itemInserted(QString)));
m_scrollArea->setWidget(m_reportDesigner);
diff --git a/kexi/plugins/reports/kexireportdesignview.h \
b/kexi/plugins/reports/kexireportdesignview.h index e152659..a893028 100644
--- a/kexi/plugins/reports/kexireportdesignview.h
+++ b/kexi/plugins/reports/kexireportdesignview.h
@@ -1,6 +1,7 @@
/*
* Kexi Report Plugin
-* Copyright (C) 2007-2009 by Adam Pigg (adam@piggz.co.uk)
+* Copyright (C) 2007-2009 by Adam Pigg <adam@piggz.co.uk>
+* Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -44,6 +45,9 @@ public:
void triggerAction(const QString &);
+signals:
+ void itemInserted(const QString& entity);
+
private:
KoReportDesigner *m_reportDesigner;
KoProperty::Set *m_propertySet;
diff --git a/kexi/plugins/reports/kexireportpart.cpp \
b/kexi/plugins/reports/kexireportpart.cpp index 28be422..72b96cf 100644
--- a/kexi/plugins/reports/kexireportpart.cpp
+++ b/kexi/plugins/reports/kexireportpart.cpp
@@ -1,6 +1,7 @@
/*
* Kexi Report Plugin
- * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
+ * Copyright (C) 2007-2008 by Adam Pigg <adam@piggz.co.uk>
+ * Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -36,12 +37,15 @@
class KexiReportPart::Private
{
public:
- Private() {
+ Private() : toolboxActionGroup(0)
+ {
ksrc = 0;
}
~Private() {
}
KexiSourceSelector *ksrc;
+ QActionGroup toolboxActionGroup;
+ QMap<QString, QAction*> toolboxActionsByName;
};
KexiReportPart::KexiReportPart(QObject *parent, const QVariantList &l)
@@ -77,6 +81,7 @@ KexiView* KexiReportPart::createView(QWidget *parent, KexiWindow* \
window, } else if (viewMode == Kexi::DesignViewMode) {
view = new KexiReportDesignView(parent, d->ksrc);
connect(d->ksrc, SIGNAL(setData(KoReportData*)), view, \
SLOT(slotSetData(KoReportData*))); + connect(view, \
SIGNAL(itemInserted(QString)), this, SLOT(slotItemInserted(QString))); }
return view;
}
@@ -84,12 +89,14 @@ KexiView* KexiReportPart::createView(QWidget *parent, KexiWindow* \
window, void KexiReportPart::initPartActions()
{
KexiMainWindowIface *win = KexiMainWindowIface::global();
- QList<QAction*> reportActions = KoReportDesigner::actions(this);
+ QList<QAction*> reportActions = \
KoReportDesigner::actions(&d->toolboxActionGroup);
foreach(QAction* action, reportActions) {
- connect(action, SIGNAL(triggered()), this, SLOT(slotActionTriggered()));
+ connect(action, SIGNAL(triggered(bool)), this, \
SLOT(slotToolboxActionTriggered(bool))); win->addToolBarAction("report", action);
+ d->toolboxActionsByName.insert(action->objectName(), action);
}
+
}
QString KexiReportPart::loadReport(const QString& name)
@@ -160,8 +167,10 @@ void KexiReportPart::setupCustomPropertyPanelTabs(KTabWidget \
*tab) tab->setTabToolTip(tab->indexOf(d->ksrc), i18n("Data Source"));
}
-void KexiReportPart::slotActionTriggered()
+void KexiReportPart::slotToolboxActionTriggered(bool checked)
{
+ if (!checked)
+ return;
QObject *theSender = sender();
if (!theSender)
return;
@@ -184,4 +193,14 @@ void KexiReportPart::slotActionTriggered()
}
}
+void KexiReportPart::slotItemInserted(const QString& entity)
+{
+ Q_UNUSED(entity);
+ // uncheck toolbox action after it is used
+ QAction * a = d->toolboxActionGroup.checkedAction();
+ if (a) {
+ a->setChecked(false);
+ }
+}
+
#include "kexireportpart.moc"
diff --git a/kexi/plugins/reports/kexireportpart.h \
b/kexi/plugins/reports/kexireportpart.h index cc26db3..b4521b4 100644
--- a/kexi/plugins/reports/kexireportpart.h
+++ b/kexi/plugins/reports/kexireportpart.h
@@ -1,6 +1,7 @@
/*
* Kexi Report Plugin
- * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
+ * Copyright (C) 2007-2008 by Adam Pigg <adam@piggz.co.uk>
+ * Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -61,13 +62,14 @@ public:
/*! true, if \a document member has changed in previous view. Used on view \
switching.
Check this flag to see if we should refresh data for DataViewMode. */
- bool reportSchemaChangedInPreviousView :
- 1;
+ bool reportSchemaChangedInPreviousView;
QString name;
};
private slots:
- void slotActionTriggered();
+ void slotToolboxActionTriggered(bool checked);
+ //! Unchecks toolbox action for @a entity after it is used.
+ void slotItemInserted(const QString& entity);
private:
QString loadReport(const QString&);
diff --git a/libs/koreport/common/KoReportPluginManager.cpp \
b/libs/koreport/common/KoReportPluginManager.cpp index f35f86c..c2b877a 100644
--- a/libs/koreport/common/KoReportPluginManager.cpp
+++ b/libs/koreport/common/KoReportPluginManager.cpp
@@ -26,8 +26,7 @@
#include <KService>
#include <KServiceTypeTrader>
#include <KIconLoader>
-
-#include <QAction>
+#include <KToggleAction>
//Include the static items
#include "../items/label/KoReportLabelPlugin.h"
@@ -70,7 +69,7 @@ QList<QAction*> KoReportPluginManager::actions()
foreach(KoReportPluginInterface* plugin, plugins) {
KoReportPluginInfo *info = plugin->info();
if (info) {
- QAction *act = new QAction(KIcon(info->icon()), info->name(), this);
+ KToggleAction *act = new KToggleAction(KIcon(info->icon()), \
info->name(), this); act->setObjectName(info->className());
//Store the order priority in the user data field
diff --git a/libs/koreport/common/KoReportPluginManager.h \
b/libs/koreport/common/KoReportPluginManager.h index a89f194..73b03b0 100644
--- a/libs/koreport/common/KoReportPluginManager.h
+++ b/libs/koreport/common/KoReportPluginManager.h
@@ -21,8 +21,8 @@
#ifndef KOREPORTPLUGINMANAGER_H
#define KOREPORTPLUGINMANAGER_H
-#include <QObject>
#include <KoReportPluginInterface.h>
+#include <QAction>
class KoReportPluginManagerPrivate;
@@ -36,7 +36,6 @@ class KoReportPluginManager : public QObject
QList<QAction*> actions();
private:
-
KoReportPluginManagerPrivate *const d;
KoReportPluginManager();
diff --git a/libs/koreport/wrtembed/KoReportDesigner.cpp \
b/libs/koreport/wrtembed/KoReportDesigner.cpp index f42db07..60bedda 100644
--- a/libs/koreport/wrtembed/KoReportDesigner.cpp
+++ b/libs/koreport/wrtembed/KoReportDesigner.cpp
@@ -1,7 +1,8 @@
/*
* OpenRPT report writer and rendering engine
- * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
- * Copyright (C) 2007-2010 by Adam Pigg (adam@piggz.co.uk)
+ * Copyright (C) 2001-2007 by OpenMFG, LLC <info@openmfg.com>
+ * Copyright (C) 2007-2010 by Adam Pigg <adam@piggz.co.uk>
+ * Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -48,6 +49,7 @@
#include <kaction.h>
#include <KLocale>
#include <KDebug>
+#include <KToggleAction>
#include <kross/core/manager.h>
//! Also add public method for runtime?
@@ -877,8 +879,10 @@ void KoReportDesigner::sectionMouseReleaseEvent(ReportSceneView \
* v, QMouseEvent }
if (item) {
item->setVisible(true);
- if (v && v->designer())
+ if (v && v->designer()) {
v->designer()->setModified(true);
+ }
+ emit itemInserted(m_sectionData->insertItem);
}
m_sectionData->mouseAction = ReportWriterSectionData::MA_None;
@@ -1169,15 +1173,20 @@ bool KoReportDesigner::isEntityNameUnique(const QString &n, \
KoReportItemBase* ig return unique;
}
-QList<QAction*> KoReportDesigner::actions(QObject* parent)
+static bool actionPriortyLessThan(QAction* act1, QAction* act2)
{
- KoReportPluginManager* manager = KoReportPluginManager::self();
- QAction *act;
- QList<QAction*> actList;
+ if (act1->data().toInt() > 0 && act1->data().toInt() > 0) {
+ return act1->data().toInt() < act2->data().toInt();
+ }
+ return false;
+}
- actList = manager->actions();
+QList<QAction*> KoReportDesigner::actions(QActionGroup* group)
+{
+ KoReportPluginManager* manager = KoReportPluginManager::self();
+ QList<QAction*> actList = manager->actions();
- act = new QAction(KIcon("line"), i18n("Line"), parent);
+ KToggleAction *act = new KToggleAction(KIcon("line"), i18n("Line"), group);
act->setObjectName("report:line");
act->setData(9);
actList << act;
@@ -1189,28 +1198,23 @@ QList<QAction*> KoReportDesigner::actions(QObject* parent)
//It finds the first plugin based on the priority in userdata
//The lowest oriority a plugin can have is 10
//And inserts a separator before it.
+ bool sepInserted = false;
foreach(QAction *a, actList) {
++i;
- if(a->data().toInt() >= 10) {
- QAction *sep = new QAction("separator", parent);
+ if (!sepInserted && a->data().toInt() >= 10) {
+ QAction *sep = new QAction("separator", group);
sep->setSeparator(true);
actList.insert(i-1, sep);
- break;
+ sepInserted = true;
+ }
+ else {
+ group->addAction(a);
}
}
return actList;
}
-bool KoReportDesigner::actionPriortyLessThan(QAction* act1, QAction* act2)
-{
- if (act1->data().toInt() > 0 && act1->data().toInt() > 0) {
- return act1->data().toInt() < act2->data().toInt();
- }
-
- return false;
-}
-
void KoReportDesigner::setSectionCursor(const QCursor& c)
{
if (m_pageFooterAny)
diff --git a/libs/koreport/wrtembed/KoReportDesigner.h \
b/libs/koreport/wrtembed/KoReportDesigner.h index 930f6b0..fcdefd9 100644
--- a/libs/koreport/wrtembed/KoReportDesigner.h
+++ b/libs/koreport/wrtembed/KoReportDesigner.h
@@ -1,7 +1,8 @@
/*
* OpenRPT report writer and rendering engine
- * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
- * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
+ * Copyright (C) 2001-2007 by OpenMFG, LLC <info@openmfg.com>
+ * Copyright (C) 2007-2008 by Adam Pigg <adam@piggz.co.uk>
+ * Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,16 +22,16 @@
#include <qwidget.h>
#include <qstring.h>
-
#include <qcolor.h>
#include <qmap.h>
#include <QVBoxLayout>
#include <QCloseEvent>
+#include <kdebug.h>
+
#include <krreportdata.h>
#include <koproperty/Set.h>
#include <koproperty/Property.h>
-#include <kdebug.h>
#include <KoReportItemBase.h>
#include "koreport_export.h"
#include "KoReportData.h"
@@ -38,6 +39,7 @@
class ReportGridOptions;
class QDomDocument;
class QGraphicsScene;
+class QActionGroup;
class KoRuler;
class KoZoomHandler;
class QGridLayout;
@@ -244,9 +246,9 @@ public:
/**
@brief Returns a list of actions that represent the entities that can be \
inserted into the report.
- Actions are created as children of @a parent.
- @return list of QActions */
- static QList<QAction*> actions(QObject* parent);
+ Actions are created as children of @a group and belong to the group.
+ @return list of actions */
+ static QList<QAction*> actions(QActionGroup* group);
public slots:
@@ -332,8 +334,6 @@ private:
ReportWriterSectionData *m_sectionData;
unsigned int selectionCount() const;
- static bool actionPriortyLessThan(QAction* act1, QAction* act2);
-
void setSectionCursor(const QCursor&);
void unsetSectionCursor();
@@ -350,6 +350,7 @@ signals:
void propertySetChanged();
void dirty();
void reportDataChanged();
+ void itemInserted(const QString& entity);
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic