当前位置: 首页>>代码示例>>C++>>正文


C++ TrackerSettings::AskBeforeDeleteFile方法代码示例

本文整理汇总了C++中TrackerSettings::AskBeforeDeleteFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TrackerSettings::AskBeforeDeleteFile方法的具体用法?C++ TrackerSettings::AskBeforeDeleteFile怎么用?C++ TrackerSettings::AskBeforeDeleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TrackerSettings的用法示例。


在下文中一共展示了TrackerSettings::AskBeforeDeleteFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
TrashSettingsView::RecordRevertSettings()
{
	TrackerSettings settings;

	fDontMoveFilesToTrash = settings.DontMoveFilesToTrash();
	fAskBeforeDeleteFile = settings.AskBeforeDeleteFile();
}
开发者ID:RTOSkit,项目名称:haiku,代码行数:8,代码来源:SettingsViews.cpp

示例2: _SCRIPTING_ONLY

bool
BPoseView::DeleteProperty(BMessage *_SCRIPTING_ONLY(specifier),
	int32 _SCRIPTING_ONLY(form), const char *_SCRIPTING_ONLY(property),
	BMessage *_SCRIPTING_ONLY(reply))
{
#if _SUPPORTS_FEATURE_SCRIPTING
	status_t error = B_OK;
	bool handled = false;

	if (strcmp(property, kPropertySelection) == 0) {
		// deleting on a selection is handled as removing a part of the selection
		// not to be confused with deleting a selected item

		if (form == (int32)B_ENTRY_SPECIFIER) {
			entry_ref ref;
			// select poses specified by entries
			for (int32 index = 0; specifier->FindRef("refs", index, &ref)
				== B_OK; index++) {

				int32 poseIndex;
				BPose *pose = FindPose(&ref, form, &poseIndex);

				if (!pose) {
					error = B_ENTRY_NOT_FOUND;
					break;
				}

				RemovePoseFromSelection(pose);
			}
			handled = true;

		} else if (form == B_INDEX_SPECIFIER) {
			// move all poses specified by index to Trash
			int32 specifyingIndex;
			for (int32 index = 0; specifier->FindInt32("index", index,
				&specifyingIndex) == B_OK; index++) {
				BPose *pose = PoseAtIndex(specifyingIndex);

				if (!pose) {
					error = B_BAD_INDEX;
					break;
				}

				RemovePoseFromSelection(pose);
			}
			handled = true;
		} else
			return false;

	} else if (strcmp(property, kPropertyEntry) == 0) {
		// deleting entries is handled by moving entries to trash
	
		// build a list of entries, specified by the specifier
		BObjectList<entry_ref> *entryList = new BObjectList<entry_ref>();
			// list will be deleted for us by the trashing thread		

		if (form == (int32)B_ENTRY_SPECIFIER) {
			// move all poses specified by entry_ref to Trash
			entry_ref ref;
			for (int32 index = 0; specifier->FindRef("refs", index, &ref)
				== B_OK; index++)
				entryList->AddItem(new entry_ref(ref));

		} else if (form == (int32)B_INDEX_SPECIFIER) {
			// move all poses specified by index to Trash
			int32 specifyingIndex;
			for (int32 index = 0; specifier->FindInt32("index", index, &specifyingIndex)
				== B_OK; index++) {
				BPose *pose = PoseAtIndex(specifyingIndex);

				if (!pose) {
					error = B_BAD_INDEX;
					break;
				}

				entryList->AddItem(new entry_ref(*pose->TargetModel()->EntryRef()));
			}
		} else
			return false;

		if (error == B_OK) {
			TrackerSettings settings;
			if (!settings.DontMoveFilesToTrash()) {
				// move the list we build into trash, don't make the trashing task
				// select the next item
				MoveListToTrash(entryList, false, false);
			} else
				Delete(entryList, false, settings.AskBeforeDeleteFile());
		}

		handled = true;
	}

	if (error != B_OK)
		reply->AddInt32("error", error);

	return handled;
#else
	return false;
#endif
//.........这里部分代码省略.........
开发者ID:Ithamar,项目名称:cosmoe,代码行数:101,代码来源:PoseViewScripting.cpp


注:本文中的TrackerSettings::AskBeforeDeleteFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。