本文整理汇总了C++中UserPtr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ UserPtr::reset方法的具体用法?C++ UserPtr::reset怎么用?C++ UserPtr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPtr
的用法示例。
在下文中一共展示了UserPtr::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleURI
bool UserPropertiesHandler::handleURI(URI& uri)
{
bool addUser = uri.action == "add_user";
bool editUser = uri.action == "edit_user";
if (!addUser && !editUser)
return false;
wxWindow* w = getParentWindow(uri);
ServerPtr server;
UserPtr user;
wxString title(_("Modify User"));
if (addUser)
{
server = extractMetadataItemPtrFromURI<Server>(uri);
if (!server)
return true;
title = _("Create New User");
user.reset(new User(server));
}
else
{
user = extractMetadataItemPtrFromURI<User>(uri);
if (!user)
return true;
#ifdef __WXGTK__
if (user->getUsername() == "SYSDBA")
{
showWarningDialog(w, _("The password for the SYSDBA user should not be changed here."),
_("The appropriate way to change the password of the SYSDBA user is to run the changeDBAPassword.sh script in Firebird's bin directory.\n\nOtherwise the scripts will not be updated."),
AdvancedMessageDialogButtonsOk(), config(), "DIALOG_warn_sysdba_change",
_("Do not show this information again"));
}
#endif
server = user->getServer();
if (!server)
return true;
}
UserDialog d(w, title, addUser);
d.setUser(user);
if (d.ShowModal() == wxID_OK)
{
ProgressDialog pd(w, _("Connecting to Server..."), 1);
pd.doShow();
IBPP::Service svc;
if (!getService(server.get(), svc, &pd, true)) // true = need SYSDBA password
return true;
try
{
IBPP::User u;
user->assignTo(u);
if (addUser)
svc->AddUser(u);
else
svc->ModifyUser(u);
server->notifyObservers();
}
catch(IBPP::Exception& e)
{
wxMessageBox(e.what(), _("Error"),
wxOK | wxICON_WARNING);
}
}
return true;
}