Exemplo n.º 1
0
/**
 * Emits the fileRequested() signal when a file name is selected in the file 
 * tree. An item is selected by either double-clicking it or by hittin 
 * "ENTER" when it is highlighted.
 * This slot is connected to the doubleClicked() and returnPressed() signals
 * of the KFileTreeView object.
 * @param	pItem	The selected tree item
 */
void FileView::slotTreeItemSelected(const KUrl& url)
{
	QFileInfo fileInfo = QFileInfo(url.pathOrUrl());

	if (! fileInfo.isDir())
		emit fileRequested(url.pathOrUrl(), 0);
}
Exemplo n.º 2
0
void FileNameHandler::resolve(std::tr1::shared_ptr<MetadataRequest> request, NameCallback callback) {
    URL url(request->getURI());
    assert(!url.empty());
    Filesystem::Path fileRequested(url.fullpath());

    std::tr1::shared_ptr<DiskManager::DiskRequest> read_req(
        new DiskManager::ReadRequest(fileRequested,
            std::tr1::bind(&FileNameHandler::onReadFinished, this, _1, request, callback)));
    DiskManager::getSingleton().addRequest(read_req);
}
Exemplo n.º 3
0
/**
 * Opens a file for editing when its entry is clicked in the file list.
 * @param	pItem	The clicked list item
 */
void FileList::processItemSelected(QListViewItem* pItem)
{
	QString sPath;

	// Get the file path (replace the root symbol, if required)
	sPath = pItem->text(2);
	if (sPath.startsWith("$"))
		sPath.replace("$", m_sRoot);
		
	// Submit a request to open the file for editing
	emit fileRequested(sPath, 0);
}
Exemplo n.º 4
0
/**
 * Emits the fileRequested() signal when a browser link is clicked.
 * This slot is connected to the urlClick() signal of the browser.
 * @param	sURL	The requested URL
 */
void MakeDlg::slotBrowserClicked(const QString& sURL)
{
	QString sFile;
	QString sLine;
	
	// Exract the file name and the line number from the URL
	sFile = sURL.section('&', 0, 0);
	sLine = sURL.section('&', 1, 1);
	
	// Add root path for relative paths
	if (!sFile.startsWith("/"))
		sFile = m_pRootURL->url() + "/" + sFile;
	
	// Emit the signal
	emit fileRequested(sFile, sLine.toUInt());
}
Exemplo n.º 5
0
void FileChunkHandler::cache_check_callback(const SparseData* data, std::tr1::shared_ptr<RemoteFileMetadata> file,
            std::tr1::shared_ptr<Chunk> chunk, ChunkCallback callback) {
    if (data) {
        mStats.downloaded++;
        std::tr1::shared_ptr<const DenseData> flattened = data->flatten();
        callback(flattened);
    } else {
        URL url(file->getURI());
        assert(!url.empty());
        Filesystem::Path fileRequested(url.fullpath());

        std::tr1::shared_ptr<DiskManager::DiskRequest> read_req(
            new DiskManager::ReadRequest(fileRequested,
                std::tr1::bind(&FileChunkHandler::onReadFinished, this, _1, file, chunk, callback)));
        DiskManager::getSingleton().addRequest(read_req);
    }
}