Summary: | Can't open two files with the same name (but from different directories) in the editor | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Amilcar do Carmo Lucas <a.lucas> |
Component: | general | Assignee: | KDevelop Developers <kdevelop-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Amilcar do Carmo Lucas
2003-03-26 10:35:05 UTC
Just to confirm this bug on today's cvs. Subject: kdevelop/src CVS commit by rodda: Fix bug 56429: unable to open files with same name in different directories. CCMAIL:56429-done@bugs.kde.org M +11 -6 partcontroller.cpp 1.76 --- kdevelop/src/partcontroller.cpp #1.75:1.76 @@ -157,9 +157,12 @@ void PartController::setEncoding(const Q void PartController::editDocument(const KURL &inputUrl, int lineNum) { + kdDebug(9000) << k_funcinfo << inputUrl.prettyURL() << " linenum " << lineNum << endl; + KURL url = inputUrl; bool localUrl = url.url().startsWith("file:/"); // Make sure the URL exists - if (!url.isValid() || (!localUrl && !KIO::NetAccess::exists(url))) { + // KDE 3.0 compatibility hack: use KIO::NetAccess for everything >= KDE 3.1 + if (!url.isValid() || (localUrl ? !QFile(url.path()).exists() : !KIO::NetAccess::exists(url))) { // Try to find this file in the current project's list instead KDevProject* project = API::getInstance()->project(); @@ -178,5 +181,5 @@ void PartController::editDocument(const localUrl = url.url().startsWith("file:/"); - if (!url.isValid() || (!localUrl && !KIO::NetAccess::exists(url))) { + if (!url.isValid() || (localUrl ? !QFile(url.path()).exists() : !KIO::NetAccess::exists(url))) { // See if this url is relative to the current project's directory url = project->projectDirectory() + "/" + url.url(); @@ -184,5 +187,5 @@ void PartController::editDocument(const localUrl = url.url().startsWith("file:/"); - if (!url.isValid() || (!localUrl && !KIO::NetAccess::exists(url))) { + if (!url.isValid() || (localUrl ? !QFile(url.path()).exists() : !KIO::NetAccess::exists(url))) { // Here perhaps we should prompt the user to find the file? return; @@ -190,4 +193,6 @@ void PartController::editDocument(const } + // We now have a url that exists ;) + url.cleanPath(true); @@ -390,5 +395,5 @@ QPopupMenu *PartController::contextPopup -static bool urlIsEqual(const KURL &a, const KURL &b) +/*static bool urlIsEqual(const KURL &a, const KURL &b) { if (a.isLocalFile() && b.isLocalFile()) @@ -404,5 +409,5 @@ static bool urlIsEqual(const KURL &a, co return a == b; -} +}*/ KParts::Part *PartController::partForURL(const KURL &url) @@ -412,5 +417,5 @@ KParts::Part *PartController::partForURL { KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(it.current()); - if (ro_part && urlIsEqual(url, ro_part->url())) + if (ro_part && url == ro_part->url()) return ro_part; } |