本文整理汇总了C++中BMailSettings::DaemonAutoStarts方法的典型用法代码示例。如果您正苦于以下问题:C++ BMailSettings::DaemonAutoStarts方法的具体用法?C++ BMailSettings::DaemonAutoStarts怎么用?C++ BMailSettings::DaemonAutoStarts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMailSettings
的用法示例。
在下文中一共展示了BMailSettings::DaemonAutoStarts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changedAccounts
void
ConfigWindow::_SaveSettings()
{
// collect changed accounts
BMessage changedAccounts(BPrivate::kMsgAccountsChanged);
for (int32 i = 0; i < fAccounts.CountItems(); i++) {
BMailAccountSettings* account = fAccounts.ItemAt(i);
if (account && account->HasBeenModified())
changedAccounts.AddInt32("account", account->AccountID());
}
for (int32 i = 0; i < fToDeleteAccounts.CountItems(); i++) {
BMailAccountSettings* account = fToDeleteAccounts.ItemAt(i);
changedAccounts.AddInt32("account", account->AccountID());
}
// cleanup account directory
for (int32 i = 0; i < fToDeleteAccounts.CountItems(); i++) {
BMailAccountSettings* account = fToDeleteAccounts.ItemAt(i);
BEntry entry(account->AccountFile());
entry.Remove();
delete account;
}
fToDeleteAccounts.MakeEmpty();
// Apply and save general settings
BMailSettings settings;
if (fSaveSettings) {
bigtime_t interval = 0;
if (fCheckMailCheckBox->Value() == B_CONTROL_ON) {
// figure out time interval
float floatInterval;
sscanf(fIntervalControl->Text(), "%f", &floatInterval);
interval = bigtime_t(60000000L * floatInterval);
}
settings.SetAutoCheckInterval(interval);
settings.SetDaemonAutoStarts(!fAccounts.IsEmpty());
// status mode (alway, fetching/retrieving, ...)
int32 index = fStatusModeField->Menu()->IndexOf(
fStatusModeField->Menu()->FindMarked());
settings.SetShowStatusWindow(index);
settings.Save();
}
// Save accounts
if (fSaveSettings) {
for (int i = 0; i < fAccounts.CountItems(); i++)
fAccounts.ItemAt(i)->Save();
}
BMessenger messenger(B_MAIL_DAEMON_SIGNATURE);
if (messenger.IsValid()) {
// server should reload general settings
messenger.SendMessage(BPrivate::kMsgSettingsUpdated);
// notify server about changed accounts
messenger.SendMessage(&changedAccounts);
}
// Start/stop the mail_daemon depending on the settings
BMailDaemon daemon;
if (fSaveSettings) {
if (settings.DaemonAutoStarts() && !daemon.IsRunning())
daemon.Launch();
else if (!settings.DaemonAutoStarts() && daemon.IsRunning())
daemon.Quit();
}
}