Example #1
0
void DesktopButton::dropEvent(QDropEvent *ev)
{
    KURL dPath(KGlobalSettings::desktopPath());
    KFileItem item(dPath, QString::fromLatin1("inode/directory"), KFileItem::Unknown);
    KonqOperations::doDrop(&item, dPath, ev, this);
    PanelButton::dropEvent(ev);
}
std::string urdf_traverser::helpers::fileExtension(const char* file)
{
    boost::filesystem::path dPath(file);
    std::string extension = dPath.extension().string();
    extension.erase(0, 1);
    return extension;
}
void
ExpanderWindow::RefsReceived(BMessage* msg)
{
	entry_ref ref;
	int32 i = 0;
	int8 destination_folder = 0x63;
	fSettings.FindInt8("destination_folder", &destination_folder);

	while (msg->FindRef("refs", i++, &ref) == B_OK) {
		BEntry entry(&ref, true);
		BPath path(&entry);
		BNode node(&entry);

		if (node.IsFile()) {
			fSourceChanged = true;
			fSourceRef = ref;
			fSourceText->SetText(path.Path());
			if (destination_folder == 0x63) {
				BPath parent;
				path.GetParent(&parent);
				fDestText->SetText(parent.Path());
				get_ref_for_path(parent.Path(), &fDestRef);
			} else if (destination_folder == 0x65) {
				fSettings.FindRef("destination_folder_use", &fDestRef);
				BEntry dEntry(&fDestRef, true);
				BPath dPath(&dEntry);
				fDestText->SetText(dPath.Path());
			}

			BEntry dEntry(&fDestRef, true);
			if (dEntry.Exists()) {
				fExpandButton->SetEnabled(true);
				fExpandItem->SetEnabled(true);
			}

			if (fShowContents->Value() == B_CONTROL_ON) {
				StopListing();
				StartListing();
			} else {
				fShowContents->SetEnabled(true);
				fShowItem->SetEnabled(true);
			}

			bool fromApp;
			if (msg->FindBool("fromApp", &fromApp) == B_OK) {
				AutoExpand();
			} else
				AutoListing();
		} else if (node.IsDirectory()) {
			fDestRef = ref;
			fDestText->SetText(path.Path());
		}
	}
}
std::string urdf_traverser::helpers::getPath(const char * file)
{
    boost::filesystem::path dPath(file);
    return dPath.parent_path().string();
}
std::string urdf_traverser::helpers::getFilenameWithoutExtension(const char* file)
{
    boost::filesystem::path dPath(file);
    return dPath.stem().string();
}
std::string urdf_traverser::helpers::getFilename(const char* file)
{
    boost::filesystem::path dPath(file);
    return dPath.filename().string();
}