[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Sun Oct 30 02:40:07 CEST 2005
SVN commit 475645 by staikos:
bring this up to the times so that we can use it as a replacement for
dataobjectdialog.h. It just needs some work on editMultiple and some UI work
and it should be ready.
M +10 -1 kstdatadialog.ui
M +99 -7 kstdatadialog.ui.h
--- trunk/extragear/graphics/kst/kst/kstdatadialog.ui #475644:475645
@@ -109,10 +109,13 @@
</connections>
<includes>
<include location="local" impldecl="in declaration">kstdataobject.h</include>
+ <include location="local" impldecl="in declaration">kstdatacollection.h</include>
<include location="local" impldecl="in implementation">kstdatadialog.ui.h</include>
</includes>
<variables>
<variable>bool _newDialog;</variable>
+ <variable>bool _multiple;</variable>
+ <variable>bool _editMultipleMode;</variable>
<variable>KstDataObjectPtr _dp;</variable>
</variables>
<slots>
@@ -120,15 +123,21 @@
<slot>close()</slot>
<slot>reject()</slot>
<slot>init()</slot>
- <slot>showNew()</slot>
+ <slot specifier="virtual">show()</slot>
<slot>showEdit( const QString & field )</slot>
<slot returnType="bool">newObject()</slot>
<slot returnType="bool">editObject()</slot>
+ <slot returnType="bool">multiple()</slot>
+ <slot>toggleEditMultiple()</slot>
</slots>
<functions>
+ <function access="protected">setMultiple(bool multiple)</function>
+ <function access="protected">closeEvent(QCloseEvent *e)</function>
+ <function access="protected" specifier="pure virtual">cleanup()</function>
<function access="protected" specifier="pure virtual" returnType="QString">objectName()</function>
<function access="protected" specifier="pure virtual">fillFieldsForEdit()</function>
<function access="protected" specifier="pure virtual">fillFieldsForNew()</function>
+ <function access="protected" specifier="pure virtual">populateEditMultiple()</function>
<function access="protected" specifier="pure virtual" returnType="KstDataObjectPtr">findObject( const QString & name )</function>
</functions>
<layoutdefaults spacing="6" margin="11"/>
--- trunk/extragear/graphics/kst/kst/kstdatadialog.ui.h #475644:475645
@@ -13,13 +13,21 @@
void KstDataDialog::ok()
{
+ _ok->setEnabled(false);
+ _cancel->setEnabled(false);
if (_newDialog || _dp == 0L) {
if (newObject()) {
close();
+ } else {
+ _ok->setEnabled(true);
+ _cancel->setEnabled(true);
}
} else {
if (editObject()) {
close();
+ } else {
+ _ok->setEnabled(true);
+ _cancel->setEnabled(true);
}
}
}
@@ -41,20 +49,34 @@
void KstDataDialog::init()
{
+ _dp = 0L;
_newDialog = false;
+ _multiple = false;
+ _editMultipleMode = false;
}
-void KstDataDialog::showNew()
+void KstDataDialog::show()
{
_newDialog = true;
_dp = 0L;
fillFieldsForNew();
+ if (_multiple) {
+ /*
+ _editMultiple->hide();
+ _editMultipleWidget->hide();
+ _tagName->setEnabled(true);
+ */
+ _editMultipleMode = false;
+ }
+
setCaption(i18n("New %1").arg(objectName()));
- show();
+ QDialog::show();
raise();
+ _ok->setEnabled(true);
+ _cancel->setEnabled(true);
}
@@ -64,15 +86,30 @@
_dp = findObject(field);
if (!_dp) {
- showNew();
+ show();
return;
}
+ if (_multiple) {
+ /*
+ _editMultiple->show();
+ _editMultiple->setText(i18n("Edit Multiple >>"));
+ _editMultipleWidget->hide();
+ */
+ _editMultipleMode = false;
+ }
+
+ /*
+ _tagName->setEnabled(true);
+ */
+
fillFieldsForEdit();
setCaption(i18n("Edit %1").arg(objectName()));
- show();
+ QDialog::show();
raise();
+ _ok->setEnabled(true);
+ _cancel->setEnabled(true);
}
@@ -97,9 +134,7 @@
KstDataObjectPtr KstDataDialog::findObject( const QString & name )
{
- Q_UNUSED(name)
- // Designer support for pure virtuals appears to be broken
- return 0L;
+ return *KST::dataObjectList.findTag(name);
}
@@ -115,3 +150,60 @@
// Designer support for pure virtuals appears to be broken
return false;
}
+
+
+void KstDataDialog::populateEditMultiple()
+{
+ // Designer support for pure virtuals appears to be broken
+}
+
+
+bool KstDataDialog::multiple()
+{
+ return _multiple;
+}
+
+
+void KstDataDialog::setMultiple(bool multiple)
+{
+ _multiple = multiple;
+}
+
+
+void KstDataDialog::toggleEditMultiple()
+{
+ if (_multiple) {
+ if (_editMultipleMode) {
+ cleanup();
+ showEdit(_dp->tagName()); // redisplay the edit dialog
+ } else {
+ _editMultipleMode = true;
+ /*
+ _editMultipleWidget->objectList->clear();
+ */
+ // fill in list of objects and prepare the fields for multiple edit
+ populateEditMultiple();
+ /*
+ _editMultipleWidget->show();
+ _editMultiple->setText(i18n("Edit Multiple <<"));
+ */
+ adjustSize();
+ resize(minimumSizeHint());
+ setFixedHeight(height());
+ }
+ }
+}
+
+
+void KstDataDialog::closeEvent(QCloseEvent *e)
+{
+ cleanup();
+ QWidget::closeEvent(e);
+}
+
+
+void KstDataDialog::cleanup()
+{
+}
+
+// vim: ts=8 sw=4 noet
More information about the Kst
mailing list