示例#1
0
void TreeWidgetEditor::fillContentsFromTreeWidget(QTreeWidget *treeWidget)
{
    m_updating = true;
    copyContents(treeWidget, ui.treeWidget);

    ui.listWidget->clear();

    QTreeWidgetItem *headerItem = ui.treeWidget->headerItem();
    int colCount = ui.treeWidget->columnCount();
    for (int col = 0; col < colCount; col++) {
        QListWidgetItem *item = new QListWidgetItem(ui.listWidget);
        item->setFlags(item->flags() | Qt::ItemIsEditable);
        item->setText(headerItem->text(col));
        item->setIcon(headerItem->icon(col));
        item->setData(QAbstractFormBuilder::resourceRole(), headerItem->data(col, QAbstractFormBuilder::resourceRole()));
    }

    if (colCount > 0) {
        ui.listWidget->setCurrentRow(0);
        if (ui.treeWidget->topLevelItemCount() > 0)
            ui.treeWidget->setCurrentItem(ui.treeWidget->topLevelItem(0));
    }
    m_updating = false;
    updateEditor();
}
TCObject *TCSortedStringArray::copy(void) const
{
	TCStringArray *newSortedStringArray =
		new TCSortedStringArray(count, caseSensitive);

	copyContents(newSortedStringArray);
	return newSortedStringArray;
}
示例#3
0
/**
 * OPERATORS
 */
CategoryMap& CategoryMap::operator =(const CategoryMap& rhs)
{
	if (this != &rhs)
	{
		delete[] subCategories;
		delete[] categories;
		copyContents(rhs);
	}
	return *this;
}
示例#4
0
void JurisdictionMap::copyContents(const JurisdictionMap& other) {
    copyContents(other._rootOctalCode, other._endNodes);
}
示例#5
0
// Copy constructor
JurisdictionMap::JurisdictionMap(const JurisdictionMap& other) : _rootOctalCode(NULL) {
    copyContents(other);
}
示例#6
0
// standard assignment
// copy assignment 
JurisdictionMap& JurisdictionMap::operator=(const JurisdictionMap& other) {
    copyContents(other);
    return *this;
}
示例#7
0
// move assignment
NetworkPacket& NetworkPacket::operator=(NetworkPacket&& other) {
    copyContents(other.getNode(), other.getByteArray());
    return *this;
}
示例#8
0
// move, same as copy, but other packet won't be used further
NetworkPacket::NetworkPacket(NetworkPacket && packet) {
    copyContents(packet.getNode(), packet.getByteArray());
}
示例#9
0
NetworkPacket::NetworkPacket(const SharedNodePointer& node, const QByteArray& packet) {
    copyContents(node, packet);
};
示例#10
0
static int traverseDirs(const shared_ptr<EncFS_Root> &rootInfo, 
                        std::string volumeDir, std::string destDir,
                        const std::set<std::string>& toWrite )
{
    bool fake = toWrite.empty();
    
    if(!endsWith(volumeDir, '/'))
	volumeDir.append("/");
    if(!endsWith(destDir, '/'))
	destDir.append("/");

    std::string test_string = volumeDir;
    if (endsWith(test_string, '/') &&
        test_string.length() != 1) {
        test_string = test_string.substr(0, test_string.length()-1);
    }
    /* Abort if we're in export mode and this directory
     * doesn't need to be written
     */
    if (!toWrite.empty() &&
        toWrite.find(test_string) == toWrite.end()) {
        return EXIT_SUCCESS;
    }

    // Lookup directory node so we can create a destination directory
    // with the same permissions
    {
        struct stat st;
        shared_ptr<FileNode> dirNode = 
            rootInfo->root->lookupNode( volumeDir.c_str(), "encfsctl" );
        if(dirNode->getAttr(&st))
            return EXIT_FAILURE;

        // In fake mode, we always create rw:
        mode_t srcmode = st.st_mode;
        if (fake)
            srcmode = S_IRWXU;
        if (mkdir(destDir.c_str(), srcmode) == -1) {
            if (errno == EACCES /* sic! */ || errno == EROFS || errno == ENOSPC) {
                std::ostringstream out;
                out << "Not creating " << destDir << ": "
                    << strerror(errno);
                LOGE(out.str().c_str());
                return EXIT_FAILURE;
            }
        }
    }
    // show files in directory
    DirTraverse dt = rootInfo->root->openDir(volumeDir.c_str());
    if(dt.valid())
    {
        for(std::string name = dt.nextPlaintextName(); !name.empty(); 
            name = dt.nextPlaintextName())
        {
            bool skip = !toWrite.empty() && toWrite.find(volumeDir+name) == toWrite.end();

            // Recurse to subdirectories
            if(name != "." && name != ".." && !skip)
            {
                std::string plainPath = volumeDir + name;
                std::string cpath = rootInfo->root->cipherPath(plainPath.c_str());
                std::string destName = destDir + name;

                /*std::ostringstream out;
                out << "Decoding " << cpath << " to " << plainPath << " in " << destName;
                LOGI(out.str().c_str()); */
                
                int r = EXIT_SUCCESS;
                struct stat stBuf;
                if( !lstat( cpath.c_str(), &stBuf ))
                {
                    if( S_ISDIR( stBuf.st_mode ) )
                    {
                        r = traverseDirs(rootInfo, (plainPath + '/').c_str(), 
                                         destName + '/', toWrite);
                    } else if( S_ISLNK( stBuf.st_mode ))
                    {
                        r = copyLink( stBuf, rootInfo, cpath, destName );
                    } else
                    {
                        r = copyContents(rootInfo, plainPath.c_str(), 
                                         destName.c_str(), fake);
                    }
                } else
                {
                    r = EXIT_FAILURE;
                }
                if(r != EXIT_SUCCESS)
                    return r;
            }
        }
    }
    return EXIT_SUCCESS;
}
示例#11
0
CategoryMap::CategoryMap(const CategoryMap& rhs)
{
	copyContents(rhs);
}