[Kst] kdeextragear-2/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Sat Aug 14 01:24:31 CEST 2004
CVS commit by rchern:
Check all windows for duplicate plot names when creating plots from the plot dialog
CCMAIL:87146-done at bugs.kde.org
M +23 -12 kstplotdialog_i.cpp 1.75
--- kdeextragear-2/kst/kst/kstplotdialog_i.cpp #1.74:1.75
@@ -529,9 +529,16 @@ void KstPlotDialogI::new_I() {
}
- // FIXME: might want to ensure that the plot name is not in any other window
- /** verify that the plotname is unique */
- if (c) {
- KstViewObjectPtr obj = static_cast<KstViewWindow*>(c)->view()->findChild(Name->text());
- if (obj) {
+ KstApp *app = KstApp::inst();
+ KMdiIterator<KMdiChildView*> *iter;
+ QString name = Name->text();
+ //check the name
+ KstViewObjectPtr rc;
+ iter = app->createIterator();
+ while (iter->currentItem()) {
+ KMdiChildView *childview = iter->currentItem();
+ KstViewWindow *viewwindow = dynamic_cast<KstViewWindow*>(childview);
+ if (viewwindow) {
+ rc = viewwindow->view()->findChild(name);
+ if (rc) {
QString message = i18n("Could not create a new plot.\n"
"%1: not a unique plot name.\n"
@@ -540,7 +547,11 @@ void KstPlotDialogI::new_I() {
KMessageBox::sorry(this, message);
Name->setFocus();
+ app->deleteIterator(iter);
return;
}
}
+ iter->next();
+ }
+ app->deleteIterator(iter);
Kst2DPlotPtr plot = static_cast<KstViewWindow*>(c)->view()->createPlot<Kst2DPlot>(Name->text());
More information about the Kst
mailing list