From 101c683aa1f600aa6a78e9d5aa27b7e0dc251d10 Mon Sep 17 00:00:00 2001 From: arnova Date: Fri, 28 Dec 2012 08:18:26 +0100 Subject: [PATCH 1/2] changed: Refactor CGUIMediaWindow::ShowShareErrorMessage() so it works with any path --- xbmc/windows/GUIMediaWindow.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index 136159179c7d4..d77605d8d97ca 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -1188,21 +1188,18 @@ bool CGUIMediaWindow::HaveDiscOrConnection(const CStdString& strPath, int iDrive // \brief Shows a standard errormessage for a given pItem. void CGUIMediaWindow::ShowShareErrorMessage(CFileItem* pItem) { - if (pItem->m_bIsShareOrDrive) - { - int idMessageText=0; - const CURL& url=pItem->GetAsUrl(); - const CStdString& strHostName=url.GetHostName(); - - if (pItem->m_iDriveType != CMediaSource::SOURCE_TYPE_REMOTE) // Local shares incl. dvd drive - idMessageText=15300; - else if (url.GetProtocol() == "smb" && strHostName.IsEmpty()) // smb workgroup - idMessageText=15303; - else // All other remote shares - idMessageText=15301; - - CGUIDialogOK::ShowAndGetInput(220, idMessageText, 0, 0); - } + int idMessageText = 0; + CURL url(pItem->GetPath()); + const CStdString& strHostName = url.GetHostName(); + + if (url.GetProtocol() == "smb" && strHostName.IsEmpty()) // smb workgroup + idMessageText = 15303; // Workgroup not found + else if (pItem->m_iDriveType == CMediaSource::SOURCE_TYPE_REMOTE || URIUtils::IsRemote(pItem->GetPath())) + idMessageText = 15301; // Could not connect to network server + else + idMessageText = 15300; // Path not found or invalid + + CGUIDialogOK::ShowAndGetInput(220, idMessageText, 0, 0); } // \brief The functon goes up one level in the directory tree From 40224df639af30c4efde19a03c14ad00b26f03b9 Mon Sep 17 00:00:00 2001 From: arnova Date: Fri, 28 Dec 2012 09:23:04 +0100 Subject: [PATCH 2/2] fixed: Properly fallback to root in case getdirectory fails in Update() + show error dialog (in line with a54cb0d795e6c519c0f62429b23ece0f1c22f4ba) --- xbmc/windows/GUIMediaWindow.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index d77605d8d97ca..9ae8fe93dd3d8 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -777,16 +777,13 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory, bool updateFilterPa if (!GetDirectory(directory, items)) { CLog::Log(LOGERROR,"CGUIMediaWindow::GetDirectory(%s) failed", strDirectory.c_str()); - // if the directory is the same as the old directory, then we'll return - // false. Else, we assume we can get the previous directory - if (strDirectory.Equals(strCurrentDirectory)) - return false; + // Try to return to the previous directory, if not the same + // else fallback to root + if (strDirectory.Equals(strCurrentDirectory) || !Update(m_history.RemoveParentPath())) + Update(""); // Fallback to root - // We assume, we can get the parent - // directory again, but we have to - // return false to be able to eg. show + // Return false to be able to eg. show // an error message. - Update(m_history.RemoveParentPath()); return false; }