[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kexi
From: Jarosław Staniek <staniek () kde ! org>
Date: 2010-04-05 23:22:38
Message-ID: 20100405232238.97C53AC857 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1111538 by staniek:
Forms
*make the form's toolbar take less space - most buttons have no labels
M +1 -0 CMakeLists.txt
M +3 -0 core/KexiMainWindowIface.h
M +1 -1 core/KexiWindow.cpp
M +5 -0 main/KexiMainWindow.cpp
M +3 -0 main/KexiMainWindow.h
M +46 -26 plugins/forms/kexiformmanager.cpp
M +10 -6 plugins/forms/kexiformview.cpp
--- trunk/koffice/kexi/CMakeLists.txt #1111537:1111538
@@ -16,6 +16,7 @@
-DKEXI_SCRIPTS_SUPPORT
# temporary for 2.2:
-DKEXI_NO_AUTOFIELD_WIDGET
+ -DKEXI_NO_FORM_LAYOUTS
-DKEXI_NO_FORM_SPRING_ELEMENT
-DKEXI_NO_OBJECTTREEVIEW
)
--- trunk/koffice/kexi/core/KexiMainWindowIface.h #1111537:1111538
@@ -271,6 +271,9 @@
//! @todo replace with the final Actions API
virtual void addToolBarAction(const QString& toolBarName, QAction *action) = 0;
+//! @todo replace with the final Actions API
+ virtual KToolBar *toolBar(const QString& name) const = 0;
+
/*! Updates info label of the property editor by reusing properties provided
by the current property set.
Read documentation of KexiPropertyEditorView class for information about accepted properties.
--- trunk/koffice/kexi/core/KexiWindow.cpp #1111537:1111538
@@ -662,7 +662,7 @@
res = newView->afterSwitchFrom(
designModePreloadedForTextModeHack ? Kexi::NoViewMode : prevViewMode);
proposeOpeningInTextViewModeBecauseOfProblems
- = data()->proposeOpeningInTextViewModeBecauseOfProblems;
+ = data()->proposeOpeningInTextViewModeBecauseOfProblems;
if (!res) {
removeView(newViewMode);
delete newView;
--- trunk/koffice/kexi/main/KexiMainWindow.cpp #1111537:1111538
@@ -5233,6 +5233,11 @@
Q_UNUSED(item);
}
+KToolBar *KexiMainWindow::toolBar(const QString& name) const
+{
+ return d->tabbedToolBar->toolBar(name);
+}
+
void KexiMainWindow::appendWidgetToToolbar(const QString& name, QWidget* widget)
{
d->tabbedToolBar->appendWidgetToToolbar(name, widget);
--- trunk/koffice/kexi/main/KexiMainWindow.h #1111537:1111538
@@ -204,6 +204,9 @@
// see KexiMainWindowIface
virtual void addToolBarAction(const QString& toolBarName, QAction *action);
+ // see KexiMainWindowIface
+ virtual KToolBar *toolBar(const QString& name) const;
+
public slots:
/*! Inherited from KMdiMainFrm: we need to do some tasks before child is closed.
Just calls closeWindow(). Use closeWindow() if you need, not this one. */
--- trunk/koffice/kexi/plugins/forms/kexiformmanager.cpp #1111537:1111538
@@ -24,11 +24,13 @@
#include "kexiformview.h"
#include "kexidatasourcepage.h"
+#include <QToolButton>
#include <KAction>
#include <KToggleAction>
#include <KActionCollection>
#include <KPageDialog>
#include <KTextEdit>
+#include <KToolBar>
//2.0 #include <formeditor/formmanager.h>
//2.0 #include <formeditor/widgetpropertyset.h>
@@ -44,13 +46,11 @@
#include <koproperty/Property.h>
#include <widget/kexicustompropertyfactory.h>
#include <core/KexiMainWindowIface.h>
+#include <kexiutils/SmallToolButton.h>
class KexiFormManagerPrivate {
public:
KexiFormManagerPrivate() : part(0)
-#ifdef KEXI_DEBUG_GUI
- , uiCodeDialog(0)
-#endif
, q(this)
{
features = KFormDesigner::Form::NoFeatures;
@@ -63,7 +63,7 @@
}
~KexiFormManagerPrivate() {
#ifdef KEXI_DEBUG_GUI
- delete uiCodeDialog;
+ delete static_cast<QObject*>(uiCodeDialog);
#endif
}
KexiFormPart* part;
@@ -72,7 +72,7 @@
KFormDesigner::ObjectTreeView *treeView;
#ifdef KEXI_DEBUG_GUI
//! For debugging purposes
- KPageDialog *uiCodeDialog;
+ QPointer<KPageDialog> uiCodeDialog;
KTextEdit *currentUICodeDialogEditor;
KTextEdit *originalUICodeDialogEditor;
#endif
@@ -239,29 +239,32 @@
formActions
<< "edit_pointer"
<< QString() //sep
- << "library_widget_KexiDBAutoField"
- << "library_widget_KexiDBLabel"
- << "library_widget_KexiPictureLabel"
- << "library_widget_KexiDBImageBox"
- << "library_widget_KexiDBLineEdit"
- << "library_widget_KexiDBTextEdit"
- << "library_widget_KPushButton"
- << "library_widget_KexiDBComboBox"
- << "library_widget_KexiDBCheckBox"
- << "library_widget_Spacer"
- << "library_widget_Line"
- << "library_widget_KexiFrame"
- << "library_widget_QGroupBox"
- << "library_widget_KFDTabWidget"
- << "library_widget_Spring"
+#ifndef KEXI_NO_AUTOFIELD_WIDGET
+ << ":library_widget_KexiDBAutoField"
+#endif
+ << ":library_widget_KexiDBLabel"
+ << ":library_widget_KexiDBImageBox"
+ << ":library_widget_KexiDBLineEdit"
+ << ":library_widget_KexiDBTextEdit"
+ << ":library_widget_KPushButton"
+ << ":library_widget_KexiDBComboBox"
+ << ":library_widget_KexiDBCheckBox"
+#ifndef KEXI_NO_FORM_LAYOUTS
+ << ":library_widget_Spacer"
+#endif
+ << ":library_widget_Line"
+ << ":library_widget_KexiFrame"
+ << ":library_widget_QGroupBox"
+ << ":library_widget_KFDTabWidget"
+#ifndef KEXI_NO_FORM_SPRING_ELEMENT
+ << ":library_widget_Spring"
+#endif
<< QString() //sep
-#ifdef KEXI_DEBUG_GUI
- << "show_form_ui"
-#endif
;
KexiMainWindowIface *win = KexiMainWindowIface::global();
- foreach( const QString& actionName, formActions ) {
+ foreach( const QString& actionName_, formActions ) {
QAction *a;
+ const QString actionName(actionName_.startsWith(':') ? actionName_.mid(1) : actionName_);
if (actionName.isEmpty()) {
a = new QAction(this);
a->setSeparator(true);
@@ -269,11 +272,28 @@
else {
a = d->widgetActionGroup->action(actionName);
}
- win->addToolBarAction("form", a);
+ if (actionName_.startsWith(':')) { // icon only
+ KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form"));
+ btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ win->appendWidgetToToolbar("form", btn);
+ }
+ else {
+ win->addToolBarAction("form", a);
+ }
}
+
+ QSet<QString> iconOnlyActions;
+ iconOnlyActions << "widget_assign_action" << "show_form_ui";
const QList<QAction*> actions( d->collection->actions() );
foreach( QAction *a, actions ) {
- win->addToolBarAction("form", a);
+ if (iconOnlyActions.contains(a->objectName())) { // icon only
+ KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form"));
+ btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ win->appendWidgetToToolbar("form", btn);
+ }
+ else {
+ win->addToolBarAction("form", a);
+ }
}
}
}
--- trunk/koffice/kexi/plugins/forms/kexiformview.cpp #1111537:1111538
@@ -1439,20 +1439,24 @@
void KexiFormView::updateActionsInternal()
{
const QWidget* selectedWidget = form()->selectedWidget();
+ //kDebug() << selectedWidget << (viewMode()==Kexi::DesignViewMode) << widget_assign_action;
+ QByteArray wClass;
+ if (selectedWidget) {
+ wClass = selectedWidget->metaObject()->className();
+ //kDebug() << wClass;
+ }
QAction *widget_assign_action = KexiFormManager::self()->action("widget_assign_action");
- //kDebug() << selectedWidget << (viewMode()==Kexi::DesignViewMode) << widget_assign_action;
if (widget_assign_action) {
- QByteArray wClass;
- if (selectedWidget) {
- wClass = selectedWidget->metaObject()->className();
- //kDebug() << wClass;
- }
widget_assign_action->setEnabled(
viewMode()==Kexi::DesignViewMode
&& selectedWidget
&& (wClass == "QPushButton" || wClass == "KPushButton" || wClass == "KexiPushButton")
);
}
+#ifdef KEXI_DEBUG_GUI
+ QAction *show_form_ui_action = KexiFormManager::self()->action("show_form_ui");
+ show_form_ui_action->setEnabled(viewMode()==Kexi::DesignViewMode);
+#endif
}
#include "kexiformview.moc"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic