Bug 86361 - switch to buffer doesn't differentiate between buffers with same file name
Summary: switch to buffer doesn't differentiate between buffers with same file name
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-01 00:30 UTC by Dan Keshet
Modified: 2007-01-02 01:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Keshet 2004-08-01 00:30:39 UTC
Version:            (using KDE KDE 3.2.3)
Installed from:    Debian testing/unstable Packages

When you have multiple file names open, the auto-completed names of the buffer in "switch to buffer" are the exact same, meaning that you don't have choice of which buffer to switch to.  This could be fixed by copying Emacs ("Install.py *2*") or by including the path ("Install.py (in /home/dkesh)").
Comment 1 Jens Dagerbo 2005-01-16 14:11:49 UTC
How about we remove this thing? It has usability issues, and is pretty much completely covered by the FileList and QuickOpen-File features.
Comment 2 Dan Keshet 2005-01-17 18:38:31 UTC
Maybe it's because I  migrated from emacs, but this is pretty much the *only* way I switch between buffers.  Many of my projects have subfolders up to 3 levels deep, in which much of my work is done, so QuickOpen-File involves more keystrokes, esp. when I'm rapidly cycling between files.  And when I have 40-50 files open (which is typical), many with similar prefixes, the menu is very hard to deal with, esp. by keystrokes.

Please don't remove this feature! :)
Comment 3 Jens Dagerbo 2007-01-02 01:17:52 UTC
SVN commit 618662 by dagerbo:

# Improve "switch to.." dialog
# Make it possible to differentiate between several files with the same name

BUG: 86361

 M  +7 -6      Makefile.am  
 M  +7 -29     partcontroller.cpp  
 A             switchtodialog.cpp   [License: GPL (v2+)]
 A             switchtodialog.h   [License: GPL (v2+)]
 A             switchtodialogbase.ui  


--- branches/kdevelop/3.4/src/Makefile.am #618661:618662
@@ -13,11 +13,11 @@
 	$(top_builddir)/lib/widgets/libkdevwidgets.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la \
 	$(top_builddir)/src/newui/libd.la $(LIB_KHTML) -lktexteditor
 libkdevshell_la_SOURCES = api.cpp core.cpp documentationpart.cpp \
-	editorproxy.cpp generalinfowidget.cpp languageselectwidget.cpp mainwindowshare.cpp \
-	partcontroller.cpp plugincontroller.cpp projectmanager.cpp \
-	projectsession.cpp splashscreen.cpp statusbar.cpp toplevel.cpp generalinfowidgetbase.ui \
-	mimewarningdialog.ui shellextension.cpp simplemainwindow.cpp multibuffer.cpp \
-	pluginselectdialogbase.ui pluginselectdialog.cpp pluginselectdialog.h
+	editorproxy.cpp generalinfowidget.cpp generalinfowidgetbase.ui languageselectwidget.cpp \
+	mainwindowshare.cpp mimewarningdialog.ui multibuffer.cpp partcontroller.cpp \
+	plugincontroller.cpp pluginselectdialog.cpp pluginselectdialog.h pluginselectdialogbase.ui \
+	projectmanager.cpp projectsession.cpp shellextension.cpp simplemainwindow.cpp \
+	splashscreen.cpp statusbar.cpp switchtodialog.cpp switchtodialogbase.ui toplevel.cpp
 
 bin_PROGRAMS = kdevelop kdevassistant
 
@@ -46,7 +46,7 @@
 	generalinfowidget.h languageselectwidget.h mainwindowshare.h \
 	partcontroller.h plugincontroller.h projectmanager.h projectsession.h shellextension.h \
 	splashscreen.h statusbar.h toplevel.h generalinfowidgetbase.h mimewarningdialog.h \
-	settingswidget.h simplemainwindow.h multibuffer.h
+	settingswidget.h simplemainwindow.h multibuffer.h switchtodialog.h
 
 DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces kdevextensions
 DOXYGEN_PROJECTNAME = KDevelop Generic Shell
@@ -55,3 +55,4 @@
 profilesdatadir = $(kde_datadir)/kdevelop/profiles
 profilesdata_DATA = projectprofiles
 AM_CXXFLAGS = -w
+
--- branches/kdevelop/3.4/src/partcontroller.cpp #618661:618662
@@ -65,6 +65,8 @@
 #include "multibuffer.h"
 #include "partcontroller.h"
 
+#include "switchtodialog.h"
+
 class QDomDocument;
 
 PartController *PartController::s_instance = 0;
@@ -316,7 +318,7 @@
 			}
 		}
 
-		if ( !done && ( !url.isValid() || !KIO::NetAccess::exists(url, false, 0) ))
+ 		if ( !done && ( !url.isValid() || !KIO::NetAccess::exists(url, false, 0) ))
 		{
 			// Not found - prompt the user to find it?
 			kdDebug(9000) << "cannot find URL: " << url.url() << endl;
@@ -1311,35 +1313,11 @@
 
 void PartController::slotSwitchTo()
 {
-    QMap<QString,KParts::ReadOnlyPart*> parts_map;
-    QStringList part_list;
-    QPtrList<KParts::Part> pl = *parts();
-    KParts::Part *part;
-    for(part=pl.first();part;part=pl.next()) {
-        kdDebug(9000) << "Part..." << endl;
-	if (part->inherits("KParts::ReadOnlyPart")) {
-	    KParts::ReadOnlyPart *ro_part = static_cast<KParts::ReadOnlyPart*>(part);
-            QString name = ro_part->url().fileName();
-	    part_list.append(name);
-            parts_map[name] = ro_part;
-            kdDebug(9000) << "Found part for URL " << ro_part->url().prettyURL() << endl;
+	SwitchToDialog dlg( openURLs() );
+	if ( dlg.exec() == QDialog::Accepted )
+	{
+		editDocument( dlg.selectedUrl() );
 	}
-    }
-
-    KDialogBase dialog(KDialogBase::Plain, i18n("Switch To"), KDialogBase::Ok|KDialogBase::Cancel,
-		       KDialogBase::Ok, 0, "Switch to", true);
-    QGridLayout *grid = new QGridLayout( dialog.plainPage(), 2, 1, 10, 10);
-    KLineEdit *editbox = new KLineEdit(dialog.plainPage());
-    grid->addWidget(new QLabel( i18n("Switch to buffer:"), dialog.plainPage() ), 0, 0);
-    grid->addWidget(editbox, 1, 0);
-    editbox->completionObject()->setItems( part_list );
-    editbox->setFocus();
-    int result = dialog.exec();
-    if (result==KDialogBase::KDialogBase::Accepted) {
-        if (parts_map.contains(editbox->text())) {
-            activatePart(parts_map[editbox->text()]);
-        }
-    }
 }
 
 void PartController::showPart( KParts::Part* part, const QString& name, const QString& shortDescription )