From kdevelop-bugs Tue Jan 02 00:17:55 2007 From: Jens Dagerbo Date: Tue, 02 Jan 2007 00:17:55 +0000 To: kdevelop-bugs Subject: [Bug 86361] switch to buffer doesn't differentiate between buffers Message-Id: <20070102001755.31053.qmail () ktown ! kde ! org> X-MARC-Message: https://marc.info/?l=kdevelop-bugs&m=118306962311668 ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=86361 jens.dagerbo swipnet se changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED ------- Additional Comments From jens.dagerbo swipnet se 2007-01-02 01:17 ------- 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 parts_map; - QStringList part_list; - QPtrList 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(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 )