本文整理汇总了C++中wt::WPushButton::removeChild方法的典型用法代码示例。如果您正苦于以下问题:C++ WPushButton::removeChild方法的具体用法?C++ WPushButton::removeChild怎么用?C++ WPushButton::removeChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wt::WPushButton
的用法示例。
在下文中一共展示了WPushButton::removeChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transaction
void
ShareEdit::refresh(void)
{
if (!wApp->internalPathMatches("/share-edit"))
return;
clear();
std::string editUUID = wApp->internalPathNextPart("/share-edit/");
Wt::Dbo::Transaction transaction(FsApp->getDboSession());
Database::Share::pointer share = Database::Share::getByEditUUID(FsApp->getDboSession(), editUUID);
if (!share || !boost::filesystem::exists(share->getPath()))
{
FS_LOG(UI, ERROR) << "Edit UUID '" << editUUID << "' not found";
displayNotFound();
return;
}
FS_LOG(UI, INFO) << "[" << share->getDownloadUUID() << "] Editing share from " << wApp->environment().clientAddress();
Wt::WTemplate *t = addNew<Wt::WTemplate>(tr("template-share-edit"));
t->addFunction("tr", &Wt::WTemplate::Functions::tr);
if (!share->getDesc().empty())
{
t->setCondition("if-desc", true);
t->bindString("file-desc", Wt::WString::fromUTF8(share->getDesc()));
}
t->bindString("file-name", Wt::WString::fromUTF8(share->getFileName()));
t->bindString("file-size", sizeToString(share->getFileSize()));
t->bindString("expiry-date-time", share->getExpiryTime().toString() + " UTC");
auto hits = std::to_string(share->getHits());
if (share->getMaxHits() > 0)
hits += " / " + std::to_string(share->getMaxHits());
t->bindString("hits", hits);
t->bindWidget("download-link", createShareDownloadAnchor(share));
Wt::WPushButton* deleteBtn = t->bindNew<Wt::WPushButton>("delete-btn", tr("msg-delete"));
deleteBtn->clicked().connect([=] ()
{
auto messageBox = deleteBtn->addChild(std::make_unique<Wt::WMessageBox>(tr("msg-share-delete"),
tr("msg-confirm-action"),
Wt::Icon::Question,
Wt::StandardButton::Yes | Wt::StandardButton::No));
messageBox->setModal(true);
messageBox->buttonClicked().connect([=] (Wt::StandardButton btn)
{
if (btn == Wt::StandardButton::Yes)
{
Wt::Dbo::Transaction transaction(FsApp->getDboSession());
Database::Share::pointer share = Database::Share::getByEditUUID(FsApp->getDboSession(), editUUID);
if (share)
{
FS_LOG(UI, INFO) << "[" << share->getDownloadUUID() << "] Deleting share from " << wApp->environment().clientAddress();
share.modify()->destroy();
share.remove();
}
displayRemoved();
}
deleteBtn->removeChild(messageBox);
});
messageBox->show();
});
}