Bug 84761 - Plots with duplicate names can be created
Summary: Plots with duplicate names can be created
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Rick Chern
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-08 21:01 UTC by Rick Chern
Modified: 2004-07-13 02:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Chern 2004-07-08 21:01:07 UTC
Version:           0.98-devel (using KDE KDE 3.2.1)
Installed from:    RedHat RPMs
Compiler:          gcc (GCC) 3.3.2 20031022 
OS:                Linux

Autogenerated plot names don't seem to check existing plot names.

How to reproduce:
- start Kst
- go to Plots->Edit Plots, enter P1 for Unique plot name, click "Apply as New"
- enter name for new window if prompted
- start Data Wizard, and create at least one plot with any data

Go to Plots->Edit Plots, and there will be two plots with name P1 

Expected Behaviour: Autogenerated plot name does not duplicate existing plot name.

Is this because KST::suggestPlotName only uses a counter to generate plot names, and does not check existing plot names?
Comment 1 Rick Chern 2004-07-13 02:05:52 UTC
CVS commit by rchern:

Make datawizard create plots in the same way as the data object dialogs, through KstViewWindow


M +6 -6 datawizard.ui.h 1.57


--- kdeextragear-2/kst/kst/datawizard.ui.h #1.56:1.57
@@ -527,5 +527,5 @@ void DataWizard::finished()
// Generate the plots
if (_onePlot->isChecked()) {
- Kst2DPlotPtr p = w->view()->createPlot<Kst2DPlot>(KST::suggestPlotName());
+ Kst2DPlotPtr p = dynamic_cast<Kst2DPlot*>(w->view()->findChild(w->createPlot<Kst2DPlot>(KST::suggestPlotName())).data());
plots.append(p.data());
if (_radioButtonPlotDataPSD->isChecked()) {
@@ -535,5 +535,5 @@ void DataWizard::finished()
w = static_cast<KstViewWindow*>(app->findWindow(n));
}
- Kst2DPlotPtr p = w->view()->createPlot<Kst2DPlot>(KST::suggestPlotName());
+ Kst2DPlotPtr p = dynamic_cast<Kst2DPlot*>(w->view()->findChild(w->createPlot<Kst2DPlot>(KST::suggestPlotName())).data());
plots.append(p.data());
}
@@ -542,5 +542,5 @@ void DataWizard::finished()
if (_radioButtonPlotDataPSD->isChecked()) {
for (uint i = 0; i < l.count(); ++i) {
- p = w->view()->createPlot<Kst2DPlot>(KST::suggestPlotName());
+ p = dynamic_cast<Kst2DPlot*>(w->view()->findChild(w->createPlot<Kst2DPlot>(KST::suggestPlotName())).data());
plots.append(p.data());
}
@@ -552,5 +552,5 @@ void DataWizard::finished()
}
for (uint i = 0; i < l.count(); ++i) {
- p = w->view()->createPlot<Kst2DPlot>(KST::suggestPlotName());
+ p = dynamic_cast<Kst2DPlot*>(w->view()->findChild(w->createPlot<Kst2DPlot>(KST::suggestPlotName())).data());
plots.append(p.data());
}
@@ -569,5 +569,5 @@ void DataWizard::finished()
if (_radioButtonPlotDataPSD->isChecked()) {
for (int i = 0; i < _plotNumber->value(); ++i) {
- p = w->view()->createPlot<Kst2DPlot>(KST::suggestPlotName());
+ p = dynamic_cast<Kst2DPlot*>(w->view()->findChild(w->createPlot<Kst2DPlot>(KST::suggestPlotName())).data());
plots.append(p.data());
}
@@ -578,5 +578,5 @@ void DataWizard::finished()
}
for (int i = 0; i < _plotNumber->value(); ++i) {
- p = w->view()->createPlot<Kst2DPlot>(KST::suggestPlotName());
+ p = dynamic_cast<Kst2DPlot*>(w->view()->findChild(w->createPlot<Kst2DPlot>(KST::suggestPlotName())).data());
plots.append(p.data());
}