[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi/plugins/forms
From:       Jarosław Staniek <staniek () kde ! org>
Date:       2009-05-10 22:54:19
Message-ID: 1241996059.348670.10919.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 966327 by staniek:

Forms
* "Data Source" tab
** set object class/name in the header also on form loading
** use the clear buttons of KLineEdit instead of additional buttons in the form data \
source and field data source combo boxes



 M  +30 -15    kexidatasourcepage.cpp  
 M  +6 -2      kexidatasourcepage.h  
 M  +1 -0      kexiformview.cpp  


--- trunk/koffice/kexi/plugins/forms/kexidatasourcepage.cpp #966326:966327
@@ -1,5 +1,5 @@
 /* This file is part of the KDE project
-   Copyright (C) 2005-2008 Jarosław Staniek <staniek@kde.org>
+   Copyright (C) 2005-2009 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 Library General Public
@@ -19,9 +19,9 @@
 
 #include "kexidatasourcepage.h"
 
-#include <qlabel.h>
-#include <qtooltip.h>
-#include <q3header.h>
+#include <QLabel>
+#include <QLineEdit>
+#include <QToolTip>
 #include <QVBoxLayout>
 #include <QHBoxLayout>
 
@@ -88,6 +88,7 @@
     m_widgetDSLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
     hlyr->addWidget(m_widgetDSLabel);
 
+#if 0 //2.0: clear button is available in the combobox itself
     m_clearWidgetDSButton = new KexiSmallToolButton(
         KIcon("edit-clear-locationbar-rtl"), QString(), contents);
     m_clearWidgetDSButton->setObjectName("clearWidgetDSButton");
@@ -96,10 +97,13 @@
     hlyr->addWidget(m_clearWidgetDSButton);
     connect(m_clearWidgetDSButton, SIGNAL(clicked()),
             this, SLOT(clearWidgetDataSourceSelection()));
+#endif
 
     m_sourceFieldCombo = new KexiFieldComboBox(contents);
     m_sourceFieldCombo->setObjectName("sourceFieldCombo");
     m_widgetDSLabel->setBuddy(m_sourceFieldCombo);
+    connect(m_sourceFieldCombo->lineEdit(), SIGNAL(clearButtonClicked()),
+        this, SLOT(clearWidgetDataSourceSelection()));
     contentsVlyr->addWidget(m_sourceFieldCombo);
 
     /* m_dataSourceSeparator = new Q3Frame(contents);
@@ -127,6 +131,7 @@
     hlyr->addWidget(m_gotoButton);
     connect(m_gotoButton, SIGNAL(clicked()), this, SLOT(slotGotoSelected()));
 
+#if 0 //2.0: clear button is available in the combobox itself
     m_clearDSButton = new KexiSmallToolButton(
         KIcon("edit-clear-locationbar-rtl"), QString(), contents);
     m_clearDSButton->setObjectName("clearDSButton");
@@ -134,10 +139,13 @@
     m_clearDSButton->setToolTip(i18n("Clear form's data source"));
     hlyr->addWidget(m_clearDSButton);
     connect(m_clearDSButton, SIGNAL(clicked()), this, \
SLOT(clearDataSourceSelection())); +#endif
 
     m_dataSourceCombo = new KexiDataSourceComboBox(contents);
     m_dataSourceCombo->setObjectName("dataSourceCombo");
     m_dataSourceLabel->setBuddy(m_dataSourceCombo);
+    connect(m_dataSourceCombo->lineEdit(), SIGNAL(clearButtonClicked()),
+        this, SLOT(clearDataSourceSelection()));
     contentsVlyr->addWidget(m_dataSourceCombo);
 
 #ifdef KEXI_NO_AUTOFIELD_WIDGET
@@ -242,12 +250,13 @@
         return;
     m_insideClearDataSourceSelection = true;
     if (alsoClearComboBox && !m_dataSourceCombo->selectedName().isEmpty())
-        m_dataSourceCombo->setDataSource("", "");
+        m_dataSourceCombo->setDataSource(QString(), QString());
 // if (!m_dataSourceCombo->currentText().isEmpty()) {
 //  m_dataSourceCombo->setCurrentText("");
 //  emit m_dataSourceCombo->dataSourceSelected();
 // }
-    m_clearDSButton->setEnabled(false);
+/*2.0: clear button is available in the combobox itself
+    m_clearDSButton->setEnabled(false);*/
     m_gotoButton->setEnabled(false);
 #ifndef KEXI_NO_AUTOFIELD_WIDGET
     m_addField->setEnabled(false);
@@ -259,11 +268,12 @@
 void KexiDataSourcePage::clearWidgetDataSourceSelection()
 {
     if (!m_sourceFieldCombo->currentText().isEmpty()) {
-        m_sourceFieldCombo->setEditText("");
+//2.0        m_sourceFieldCombo->setEditText(QString());
         m_sourceFieldCombo->setFieldOrExpression(QString());
         slotFieldSelected();
     }
-    m_clearWidgetDSButton->setEnabled(false);
+/*2.0: clear button is available in the combobox itself
+    m_clearWidgetDSButton->setEnabled(false);*/
 }
 
 void KexiDataSourcePage::slotGotoSelected()
@@ -339,11 +349,12 @@
         }
     }
     if (!dataSourceFound) {
-        m_sourceFieldCombo->setTableOrQuery("", true);
+        m_sourceFieldCombo->setTableOrQuery(QString(), true);
     }
     //if (m_sourceFieldCombo->hasFocus())
 //  m_dataSourceCombo->setFocus();
-    m_clearDSButton->setEnabled(dataSourceFound);
+/*2.0: clear button is available in the combobox itself
+    m_clearDSButton->setEnabled(dataSourceFound);*/
     m_gotoButton->setEnabled(dataSourceFound);
     if (dataSourceFound) {
         slotFieldListViewSelectionChanged();
@@ -370,7 +381,8 @@
     if (field)
         dataType = field->type();
 
-    m_clearWidgetDSButton->setEnabled(!m_sourceFieldCombo->fieldOrExpression().isEmpty());
 +/*2.0: clear button is available in the combobox itself
+    m_clearWidgetDSButton->setEnabled(!m_sourceFieldCombo->fieldOrExpression().isEmpty());*/
  
     emit dataSourceFieldOrExpressionChanged(
         m_sourceFieldCombo->fieldOrExpression(),
@@ -424,9 +436,11 @@
             m_noDataSourceAvailableLabel->hide();
             m_sourceFieldCombo->setFieldOrExpression(dataSource);
             m_sourceFieldCombo->setEnabled(true);
-            m_clearWidgetDSButton->setEnabled(!m_sourceFieldCombo->currentText().isEmpty());
 +/*2.0: clear button is available in the combobox itself
+            m_clearWidgetDSButton->setEnabled(!m_sourceFieldCombo->currentText().isEmpty());*/
  m_widgetDSLabel->show();
-            m_clearWidgetDSButton->show();
+/*2.0: clear button is available in the combobox itself
+            m_clearWidgetDSButton->show();*/
             m_sourceFieldCombo->show();
 //   m_dataSourceSeparator->hide();
             updateSourceFieldWidgetsAvailability();
@@ -446,13 +460,14 @@
         //make 'No data source could be assigned' label's height the same as the \
                'source field' combo+label
         m_noDataSourceAvailableLabel->setMinimumHeight(m_widgetDSLabel->height()
                 + m_sourceFieldCombo->height()/*-m_dataSourceSeparator->height()*/);
-        m_sourceFieldCombo->setEditText("");
+        m_sourceFieldCombo->setEditText(QString());
     }
 
     if (isForm || !hasDataSourceProperty) {
         //no source field can be set
         m_widgetDSLabel->hide();
-        m_clearWidgetDSButton->hide();
+/*2.0: clear button is available in the combobox itself
+        m_clearWidgetDSButton->hide();*/
         m_sourceFieldCombo->hide();
     }
 }
--- trunk/koffice/kexi/plugins/forms/kexidatasourcepage.h #966326:966327
@@ -1,5 +1,5 @@
 /* This file is part of the KDE project
-   Copyright (C) 2005-2008 Jarosław Staniek <staniek@kde.org>
+   Copyright (C) 2005-2009 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 Library General Public
@@ -92,7 +92,11 @@
     QLabel *m_dataSourceLabel, *m_noDataSourceAvailableLabel,
     *m_widgetDSLabel, *m_availableFieldsLabel,
     *m_mousePointerLabel, *m_availableFieldsDescriptionLabel;
-    QToolButton *m_clearWidgetDSButton, *m_clearDSButton, *m_gotoButton, \
*m_addField; +/*2.0: clear button is available in the combobox itself
+    QToolButton *m_clearWidgetDSButton;*/
+/*2.0: clear button is available in the combobox itself
+    QToolButton *m_clearDSButton;*/
+    QToolButton *m_gotoButton, *m_addField;
 //  QFrame *m_dataSourceSeparator;
     QString m_noDataSourceAvailableSingleText;
     QString m_noDataSourceAvailableMultiText;
--- trunk/koffice/kexi/plugins/forms/kexiformview.cpp #966326:966327
@@ -379,6 +379,7 @@
         m_delayedFormContentsResizeOnShow = 3;
     }
 
+    slotPropertySetSwitched(); // this prepares the data source page
     updateDataSourcePage();
 
     if (!newForm && viewMode() == Kexi::DesignViewMode) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic