예제 #1
0
void CGUIDialogBoxeeShare::OnInitWindow()
{
  CGUIWindow::OnInitWindow();

  m_strText = GetDefaultShareText();
  
  // Send the item to the special container to allow skin access
  CFileItemPtr itemPtr(new CFileItem(m_item));
  CGUIMessage winmsg(GUI_MSG_LABEL_ADD, GetID(), HIDDEN_CONTAINER, 0, 0, itemPtr);
  g_windowManager.SendMessage(winmsg);
  
  CGUIEditControl* editControl = (CGUIEditControl*)GetControl(EDIT_CONTROL);
  if (editControl)
  {
    editControl->SetLabel2(m_strText);
    CGUIWindow* activeWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
    if (activeWindow)
    {
      CStdString leftToInput = BOXEE::BXUtils::IntToString(editControl->GetMaxInputSize() - (int)editControl->GetLabel2().size());
      activeWindow->SetProperty(LEFT_TO_INPUT_SIZE,leftToInput);
    }
  }

  // Set the user profile thumb - start
  CProfile profile = g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex];

  CFileItemPtr item(new CFileItem(profile.getName()));
  CStdString strLabel;

  if (profile.getDate().IsEmpty())
    strLabel = g_localizeStrings.Get(20113);
  else
    strLabel.Format(g_localizeStrings.Get(20112),profile.getDate());

  item->SetLabel2(strLabel);
  item->SetThumbnailImage(profile.getThumb());
  item->SetCachedPictureThumb();
  if (profile.getThumb().IsEmpty() || profile.getThumb().Equals("-"))
    item->SetThumbnailImage("unknown-user.png");

  item->SetLabelPreformated(true);

  CGUIMessage winmsg2(GUI_MSG_LABEL_ADD, GetID(), USER_INFO_CONTAINER, 0, 0, item);
  g_windowManager.SendMessage(winmsg2);

  UpdateShareDialog();

  SET_CONTROL_FOCUS(SHARE_BTN,0);
}
예제 #2
0
bool CGUIPassword::IsProfileLockUnlocked(int iProfile, bool& bCanceled, bool prompt)
{
  if (g_passwordManager.bMasterUser)
    return true;
  int iProfileToCheck=iProfile;
  if (iProfile == -1)
    iProfileToCheck = CProfilesManager::Get().GetCurrentProfileIndex();
  if (iProfileToCheck == 0)
    return IsMasterLockUnlocked(prompt,bCanceled);
  else
  {
    CProfile *profile = CProfilesManager::Get().GetProfile(iProfileToCheck);
    if (!profile)
      return false;

    if (!prompt)
      return (profile->getLockMode() == LOCK_MODE_EVERYONE);

    if (profile->getDate().empty() &&
       (CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE ||
        profile->getLockMode() == LOCK_MODE_EVERYONE))
    {
      // user hasn't set a password and this is the first time they've used this account
      // so prompt for password/settings
      if (CGUIDialogProfileSettings::ShowForProfile(iProfileToCheck, true))
        return true;
    }
    else
       if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
        return CheckLock(profile->getLockMode(),profile->getLockCode(),20095,bCanceled);
  }

  return true;
}