Permalink
Browse files

Merge pull request #1997 from arnova/fm_fixes_for_guimediawindow_too

Filemanager fixes for guimediawindow too
  • Loading branch information...
2 parents 5ee6a7a + 40224df commit c1fc3808e1b05ba47be01afe5a9f2ecb6330c859 @jmarshallnz jmarshallnz committed Feb 20, 2013
Showing with 17 additions and 23 deletions.
  1. +17 −23 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;
}
@@ -1167,21 +1164,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

0 comments on commit c1fc380

Please sign in to comment.