Пример #1
0
void CBoxeeBrowseMenuDirectory::CreateProvidersButtons(const CFileItemList& sourceList, CFileItemList& itemsList)
{
    for (int i=0; i<sourceList.Size(); i++)
    {
        CFileItemPtr sourceItem(new CFileItem());
        sourceItem->SetLabel(sourceList.Get(i)->GetLabel());
        sourceItem->m_strPath = "boxeeui://movies/?category=store&provider=";
        sourceItem->m_strPath += sourceList.Get(i)->GetProperty("sourceid");
        sourceItem->SetProperty("isClickable",true);
        itemsList.Add(sourceItem);
    }
}
Пример #2
0
void CBoxeeBrowseMenuDirectory::CreateSourcesButtons(const VECSOURCES& Sources, CFileItemList& itemsList)
{
    // NOTE: currently handling only "video" sources

    for (VECSOURCES::const_iterator it = Sources.begin(); it != Sources.end(); it++)
    {
        CFileItemPtr sourceItem(new CFileItem());
        sourceItem->SetLabel(it->strName);
        sourceItem->m_strPath = "boxeeui://movies/?category=local&source=";
        sourceItem->m_strPath += it->strPath;
        sourceItem->SetProperty("isClickable",true);
        itemsList.Add(sourceItem);
    }
}
Пример #3
0
/*! MOVE - move a file or directory to another directory
*/
void QwsClientSocket::handleMessageMOVE(const QwMessage &message)
{
    resetIdleTimer();

    // Update the source file to see if it exists
    QwsFile sourceFile;
    sourceFile.localFilesRoot = filesRootPath;
    sourceFile.setRemotePath(message.stringArg(0));
    if (!sourceFile.loadFromLocalPath()) {
        // Check if the file to move exists
        sendError(Qw::ErrorFileOrDirectoryNotFound);
        return;
    }
    qDebug() << this << "Renaming source:" << sourceFile.localPath();

    // Update the destination (dir or file)
    QwsFile destinationFile;
    destinationFile.localFilesRoot = filesRootPath;
    destinationFile.setRemotePath(message.stringArg(1));

    // Check if we are within the root
    if (!destinationFile.isWithinLocalRoot()) {
        qDebug() << this << "Preventing move outside of jail:" << destinationFile.remotePath();
        sendError(Qw::ErrorFileOrDirectoryNotFound);
        return;
    }

    // Check if the target already exists
    if (destinationFile.loadFromLocalPath()) {
        sendError(Qw::ErrorFileOrDirectoryNotFound);
        return;
    }
    qDebug() << this << "Renaming target:" << destinationFile.localPath();
    QFile sourceItem(sourceFile.localPath());
    if (!sourceItem.rename(destinationFile.localPath())) {
        sendError(Qw::ErrorFileOrDirectoryNotFound);
        return;
    }
}