本文整理汇总了C++中PWSprefs::SaveApplicationPreferences方法的典型用法代码示例。如果您正苦于以下问题:C++ PWSprefs::SaveApplicationPreferences方法的具体用法?C++ PWSprefs::SaveApplicationPreferences怎么用?C++ PWSprefs::SaveApplicationPreferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PWSprefs
的用法示例。
在下文中一共展示了PWSprefs::SaveApplicationPreferences方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnExit
int PwsafeApp::OnExit()
{
m_idleTimer->Stop();
recentDatabases().Save();
PWSprefs *prefs = PWSprefs::GetInstance();
if (!m_core.GetCurFile().empty())
prefs->SetPref(PWSprefs::CurrentFile, m_core.GetCurFile());
// Save Application related preferences
prefs->SaveApplicationPreferences();
// Save shortcuts, if changed
PWSMenuShortcuts::GetShortcutsManager()->SaveUserShortcuts();
PWSMenuShortcuts::DestroyShortcutsManager();
////@begin PwsafeApp cleanup
return wxApp::OnExit();
////@end PwsafeApp cleanup
}
示例2: OnInit
//.........这里部分代码省略.........
appInstance.IsAnotherRunning()))
{
wxMessageBox(_("Another instance of Password Safe is already running"), _("Password Safe"),
wxOK|wxICON_INFORMATION);
return false;
}
#if defined(__X__) || defined(__WXGTK__)
PWSclipboard::GetInstance()->UsePrimarySelection(prefs->GetPref(PWSprefs::UsePrimarySelectionForClipboard));
#endif
// here if we're the child
recentDatabases().Load();
if (cmd_closed || cmd_minimized) {
m_core.SetCurFile(L"");
}
if (cmd_silent) {
if ( wxTaskBarIcon::IsAvailable() ) {
// start silent implies use system tray.
// Note that if UseSystemTray is already true, then pwsafe will try to run silently anyway
PWSprefs::GetInstance()->SetPref(PWSprefs::UseSystemTray, true);
}
else {
// We don't want to bring up a UI if running silently
std::wcerr << L"There appears to be no system tray support in your current environment. pwsafe may not work as expected in silent mode." << std::endl;
}
}
m_appIcons.AddIcon(pwsafe16);
m_appIcons.AddIcon(pwsafe32);
m_appIcons.AddIcon(pwsafe48);
if (!m_helpController) { // helpController (re)created on language activation
std::wcerr << L"Could not initialize help subsystem." << std::endl;
if (!prefs->GetPref(PWSprefs::IgnoreHelpLoadError) && !cmd_silent) {
#if wxCHECK_VERSION(2,9,2)
wxRichMessageDialog dlg(NULL,
_("Could not initialize help subsystem. Help will not be available."),
_("Password Safe: Error initializing help"), wxCENTRE|wxOK|wxICON_EXCLAMATION);
dlg.ShowCheckBox(_("Don't show this warning again"));
dlg.ShowModal();
if (dlg.IsCheckBoxChecked()) {
prefs->SetPref(PWSprefs::IgnoreHelpLoadError, true);
prefs->SaveApplicationPreferences();
}
#else
wxMessageBox(_("Could not initialize help subsystem. Help will not be available."),
_("Password Safe: Error initializing help"), wxOK | wxICON_ERROR);
#endif
}
}
if (!cmd_closed && !cmd_silent && !cmd_minimized) {
// Get the file, r/w mode and password from user
// Note that file may be new
CSafeCombinationEntry* initWindow = new CSafeCombinationEntry(NULL, m_core);
int returnValue = initWindow->ShowModal();
initWindow->Destroy();
if (returnValue != wxID_OK) {
return false;
}
wxASSERT_MSG(!m_frame, wxT("Frame window created unexpectedly"));
m_frame = new PasswordSafeFrame(NULL, m_core);
m_frame->Load(initWindow->GetPassword());
}
else {
wxASSERT_MSG(!m_frame, wxT("Frame window created unexpectedly"));
m_frame = new PasswordSafeFrame(NULL, m_core);
}
RestoreFrameCoords();
if (!cmd_silent)
m_frame->Show();
if (cmd_minimized)
m_frame->Iconize();
else if (cmd_silent) {
// Hide UI enumerates top-level windows and its children and hide them,
// so we need to set top windows first and only then call hideUI
SetTopWindow(m_frame);
wxSafeYield();
m_frame->HideUI(false);
if (file_in_cmd) {
// set locked status if file was passed from command line
m_frame->SetTrayStatus(true);
}
else {
m_core.SetCurFile(L"");
m_frame->SetTrayClosed();
}
} else {
SetTopWindow(m_frame);
}
if (PWSprefs::GetInstance()->GetPref(PWSprefs::UseSystemTray))
m_frame->ShowTrayIcon();
return true;
}
示例3: UpdateCopyPreferences
//.........这里部分代码省略.........
m_OPTMD.ConfirmCopy == FALSE, true);
prefs->SetPref(PWSprefs::LockOnWindowLock,
m_OPTMD.LockOnWindowLock == TRUE, true);
prefs->SetPref(PWSprefs::CopyPasswordWhenBrowseToURL,
m_OPTMD.CopyPswdBrowseURL == TRUE, true);
prefs->SetPref(PWSprefs::UseSystemTray,
m_OPTMD.UseSystemTray == TRUE, true);
prefs->SetPref(PWSprefs::HideSystemTray,
m_OPTMD.HideSystemTray == TRUE, true);
prefs->SetPref(PWSprefs::MaxREItems,
m_OPTMD.MaxREItems, true);
prefs->SetPref(PWSprefs::MaxMRUItems,
m_OPTMD.MaxMRUItems, true);
if (m_OPTMD.MaxMRUItems == 0) {
// Put them on File menu where they don't take up any room
prefs->SetPref(PWSprefs::MRUOnFileMenu, true, true);
} else {
prefs->SetPref(PWSprefs::MRUOnFileMenu,
m_OPTMD.MRUOnFileMenu == TRUE, true);
}
prefs->SetPref(PWSprefs::DefaultOpenRO,
m_OPTMD.DefaultOpenRO == TRUE, true);
prefs->SetPref(PWSprefs::MultipleInstances,
m_OPTMD.MultipleInstances == TRUE, true);
// Now update database preferences
// In PropertyPage alphabetic order
prefs->SetPref(PWSprefs::SaveImmediately,
m_OPTMD.SaveImmediately == TRUE, true);
prefs->SetPref(PWSprefs::ShowPWDefault,
m_OPTMD.ShowPasswordInEdit == TRUE, true);
prefs->SetPref(PWSprefs::ShowUsernameInTree,
m_OPTMD.ShowUsernameInTree == TRUE, true);
prefs->SetPref(PWSprefs::ShowPasswordInTree,
m_OPTMD.ShowPasswordInTree == TRUE, true);
prefs->SetPref(PWSprefs::TreeDisplayStatusAtOpen,
m_OPTMD.TreeDisplayStatusAtOpen, true);
prefs->SetPref(PWSprefs::ShowNotesDefault,
m_OPTMD.NotesShowInEdit == TRUE, true);
prefs->SetPref(PWSprefs::MaintainDateTimeStamps,
m_OPTMD.MaintainDatetimeStamps == TRUE, true);
prefs->SetPref(PWSprefs::UseDefaultUser,
m_OPTMD.UseDefuser == TRUE, true);
prefs->SetPref(PWSprefs::DefaultUsername,
LPCWSTR(m_OPTMD.DefUsername), true);
if (m_OPTMD.AutotypeText.IsEmpty() || m_OPTMD.AutotypeText == DEFAULT_AUTOTYPE)
prefs->SetPref(PWSprefs::DefaultAutotypeString, L"", true);
else if (m_OPTMD.AutotypeText != DEFAULT_AUTOTYPE)
prefs->SetPref(PWSprefs::DefaultAutotypeString,
LPCWSTR(m_OPTMD.AutotypeText), true);
prefs->SetPref(PWSprefs::DefaultAutotypeDelay,
m_OPTMD.AutotypeDelay,
true);
prefs->SetPref(PWSprefs::SavePasswordHistory,
m_OPTMD.SavePWHistory == TRUE, true);
if (m_OPTMD.SavePWHistory == TRUE)
prefs->SetPref(PWSprefs::NumPWHistoryDefault,
m_OPTMD.PWHistoryNumDefault, true);
prefs->SetPref(PWSprefs::LockDBOnIdleTimeout,
m_OPTMD.LockOnIdleTimeout == TRUE, true);
prefs->SetPref(PWSprefs::IdleTimeout,
m_OPTMD.IdleTimeOut, true);
GetMainDlg()->SetHashIters(m_OPTMD.HashIters);
// Changing ExplorerTypeTree changes order of items,
// which DisplayStatus implicitly depends upon
if (m_save_bExplorerTypeTree != m_OPTMD.ExplorerTypeTree)
m_bSaveGroupDisplayState = m_bRefreshViews = true;
// If user has turned on/changed warnings of expired passwords - check now
if (m_OPTMD.PreExpiryWarn == TRUE &&
(m_save_bPreExpiryWarn == FALSE ||
m_save_iPreExpiryWarnDays != m_OPTMD.PreExpiryWarnDays))
m_bCheckExpired = m_bRefreshViews = true;
// Deal with shortcuts
prefs->SetPref(PWSprefs::HotKey,
m_OPTMD.AppHotKeyValue, true);
prefs->SetPref(PWSprefs::HotKeyEnabled,
m_OPTMD.AppHotKeyEnabled == TRUE, true);
if (m_pp_shortcuts->HaveShortcutsChanged())
m_bUpdateShortcuts = true;
// Now copy across application preferences
// Any changes via Database preferences done via call to UpdateGUI from Command
prefs->UpdateFromCopyPrefs(PWSprefs::ptApplication);
// Keep prefs file updated
prefs->SaveApplicationPreferences();
}