本文整理汇总了C++中BFilePanel::GetPanelDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ BFilePanel::GetPanelDirectory方法的具体用法?C++ BFilePanel::GetPanelDirectory怎么用?C++ BFilePanel::GetPanelDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFilePanel
的用法示例。
在下文中一共展示了BFilePanel::GetPanelDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: result
filter_result
DCCFileFilter::HandleButton (BMessage *)
{
filter_result result (B_DISPATCH_MESSAGE);
BTextControl *paneltext (dynamic_cast<BTextControl *>(
panel->Window()->FindView ("text view")));
if (paneltext)
{
BDirectory dir;
struct stat s;
entry_ref ref;
BEntry entry;
panel->GetPanelDirectory (&ref);
dir.SetTo (&ref);
if (entry.SetTo (&dir, paneltext->Text()) == B_NO_ERROR
&& entry.GetStat (&s) == B_NO_ERROR
&& S_ISREG (s.st_mode))
{
if (vision_app->GetBool ("dccAutoAccept"))
{
BMessage msg (M_FILE_PANEL_ALERT);
msg.AddInt32 ("which", 2);
panel->Window()->PostMessage (&msg);
result = B_SKIP_MESSAGE;
}
else
{
BString buffer;
BAlert *alert;
buffer << "The file \""
<< paneltext->Text()
<< "\" already exists in the specified folder. "
"Do you want to continue the transfer?";
alert = new BAlert (
"DCC Request",
buffer.String(),
"Cancel",
"Replace",
"Resume",
B_WIDTH_AS_USUAL,
B_OFFSET_SPACING,
B_WARNING_ALERT);
alert->Go (new BInvoker (
new BMessage (M_FILE_PANEL_ALERT),
panel->Window()));
result = B_SKIP_MESSAGE;
}
}
}
return result;
}
示例2: dir
filter_result
DCCFileFilter::HandleAlert (BMessage *msg)
{
BTextControl *text (dynamic_cast<BTextControl *>(
panel->Window()->FindView ("text view")));
int32 which;
msg->FindInt32 ("which", &which);
if (which == 0 || text == 0)
{
return B_SKIP_MESSAGE;
}
entry_ref ref;
panel->GetPanelDirectory (&ref);
if (which == 2)
{
BDirectory dir (&ref);
BFile file (&dir, text->Text(), B_READ_ONLY);
BEntry entry (&dir, text->Text());
BPath path;
off_t position;
file.GetSize (&position);
entry.GetPath (&path);
send_msg.AddString ("path", path.Path());
send_msg.AddInt64 ("pos", position);
send_msg.what = M_ADD_RESUME_DATA;
}
else
{
send_msg.AddRef ("directory", &ref);
send_msg.AddString ("name", text->Text());
}
panel->Messenger().SendMessage (&send_msg);
BMessage cmsg (B_CANCEL);
cmsg.AddPointer ("source", panel);
panel->Messenger().SendMessage (&cmsg);
return B_SKIP_MESSAGE;
}