Version: 1.0.0_devel (using KDE KDE 3.2.2) Installed from: RedHat RPMs OS: Linux Perhaps I'm jus too dense, but I can't figure out how to rename existing windows. Seems like one should be able to, though.
CVS commit by arwalker: Add ability to rename an existing window, from the Window->Rename... menu item. CCMAIL: 88351-done@bugs.kde.org M +35 -6 kst.cpp 1.228 M +5 -1 kst.h 1.107 --- kdeextragear-2/kst/kst/kst.cpp #1.227:1.228 @@ -210,4 +210,10 @@ void KstApp::addNewWindowMenu() { int id = windowMenu()->insertItem(i18n("&New..."), this, SLOT(slotFileNewWindow()), 0, -1, 0); windowMenu()->setWhatsThis(id, i18n("Create a new plot window.")); + + id = windowMenu()->insertItem(i18n("&Rename..."), this, SLOT(slotFileRenameWindow()), 0, -1, 0); + windowMenu()->setWhatsThis(id, i18n("Rename an existing plot window.")); + if (!activeView()) { + windowMenu()->setItemEnabled(id, false); + } } @@ -1414,4 +1420,20 @@ void KstApp::slotFileNewWindow() { +void KstApp::slotFileRenameWindow() { + KstViewWindow *vw = dynamic_cast<KstViewWindow*>(activeWindow()); + + if (vw) { + QString name = windowName(true, vw->caption()); + + if (!name.isEmpty() && vw->caption() != name) { + vw->setCaption(name); + vw->setTabCaption(name); + updateDialogsForWindow(); + doc->setModified(); + } + } +} + + QString KstApp::newWindow(const QString& name_in) { KstViewWindow *w = new KstViewWindow; @@ -1433,8 +1455,7 @@ QString KstApp::newWindow(const QString& -QString KstApp::newWindow(bool prompt) { +QString KstApp::windowName(bool prompt, const QString& nameOriginal) { bool ok = false; - QString name = defaultTag; - QString nameUsed; + QString name = nameOriginal; do { @@ -1443,5 +1464,5 @@ QString KstApp::newWindow(bool prompt) { QRegExpValidator val(exp, 0L); name = KLineEditDlg::getText(i18n("Enter a name for the new window:"), name, &ok, 0L, &val).stripWhiteSpace(); - if (ok && (name==defaultTag)) { + if (ok && name==defaultTag) { name = KST::suggestWinName(); } @@ -1462,5 +1483,13 @@ QString KstApp::newWindow(bool prompt) { } while(true); - nameUsed = newWindow(name); + return name; +} + + +QString KstApp::newWindow(bool prompt) { + bool ok = false; + QString nameUsed; + + nameUsed = newWindow(windowName(prompt, defaultTag)); return nameUsed; --- kdeextragear-2/kst/kst/kst.h #1.106:1.107 @@ -111,4 +111,5 @@ class KstApp : public KMdiMainFrm { Kst2DPlotMap& plotHolderWhileOpeningDocument(); + QString windowName(bool prompt, const QString& nameOriginal); QString newWindow(const QString& name); QString newWindow(bool prompt = true); @@ -190,7 +191,10 @@ class KstApp : public KMdiMainFrm { void slotConfigureKeys(); - /** open a new application window by creating a new instance of KstApp */ + /** open a new application window */ void slotFileNewWindow(); + /** rename aa existing application window */ + void slotFileRenameWindow(); + /** clears the document in the view and creates a new document */ void slotFileNew();