本文整理汇总了C++中BMailAccounts::CountAccounts方法的典型用法代码示例。如果您正苦于以下问题:C++ BMailAccounts::CountAccounts方法的具体用法?C++ BMailAccounts::CountAccounts怎么用?C++ BMailAccounts::CountAccounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMailAccounts
的用法示例。
在下文中一共展示了BMailAccounts::CountAccounts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BPopUpMenu
BPopUpMenu*
TPrefsWindow::_BuildAccountMenu(int32 account)
{
BPopUpMenu* menu = new BPopUpMenu("");
BMenuItem* item;
//menu->SetRadioMode(true);
BMailAccounts accounts;
if (accounts.CountAccounts() == 0) {
menu->AddItem(item = new BMenuItem(B_TRANSLATE("<no account found>"), NULL));
item->SetEnabled(false);
return menu;
}
BMessage* msg;
for (int32 i = 0; i < accounts.CountAccounts(); i++) {
BMailAccountSettings* settings = accounts.AccountAt(i);
item = new BMenuItem(settings->Name(), msg = new BMessage(P_ACCOUNT));
msg->AddInt32("id", settings->AccountID());
if (account == settings->AccountID())
item->SetMarked(true);
menu->AddItem(item);
}
return menu;
}
示例2:
void
MailDaemonApp::_InitAccounts()
{
BMailAccounts accounts;
for (int i = 0; i < accounts.CountAccounts(); i++)
_InitAccount(*accounts.AccountAt(i));
}
示例3: BMailAccountSettings
void
ConfigWindow::_LoadAccounts()
{
BMailAccounts accounts;
for (int32 i = 0; i < accounts.CountAccounts(); i++)
fAccounts.AddItem(new BMailAccountSettings(*accounts.AccountAt(i)));
for (int i = 0; i < fAccounts.CountItems(); i++) {
BMailAccountSettings* account = fAccounts.ItemAt(i);
_AddAccountToView(account);
}
}
示例4: BMessage
//.........这里部分代码省略.........
}
if (count > 0)
menu->AddSeparatorItem();
}
// Hack for R5's buggy Query Notification
#ifdef HAIKU_TARGET_PLATFORM_BEOS
menu->AddItem(new BMenuItem(
MDR_DIALECT_CHOICE("Refresh New Mail Count",
"未読メールカウントを更新"),
new BMessage(MD_REFRESH_QUERY)));
#endif
// The New E-mail query
if (fNewMessages > 0) {
BString string;
MDR_DIALECT_CHOICE(
string << fNewMessages << " new message"
<< (fNewMessages != 1 ? "s" : B_EMPTY_STRING),
string << fNewMessages << " 通の未読メッセージ");
_GetNewQueryRef(ref);
item = new BMenuItem(navMenu = new BNavMenu(string.String(),
B_REFS_RECEIVED, BMessenger(kTrackerSignature)),
msg = new BMessage(B_REFS_RECEIVED));
msg->AddRef("refs", &ref);
navMenu->SetNavDir(&ref);
menu->AddItem(item);
} else {
menu->AddItem(item = new BMenuItem(
MDR_DIALECT_CHOICE ("No new messages","未読メッセージなし"), NULL));
item->SetEnabled(false);
}
BMailAccounts accounts;
if (modifiers() & B_SHIFT_KEY) {
BMenu *accountMenu = new BMenu(
MDR_DIALECT_CHOICE ("Check for mails only","R) メール受信のみ"));
BFont font;
menu->GetFont(&font);
accountMenu->SetFont(&font);
for (int32 i = 0; i < accounts.CountAccounts(); i++) {
BMailAccountSettings* account = accounts.AccountAt(i);
BMessage* message = new BMessage(MD_CHECK_FOR_MAILS);
message->AddInt32("account", account->AccountID());
accountMenu->AddItem(new BMenuItem(account->Name(), message));
}
if (accounts.CountAccounts() == 0) {
item = new BMenuItem("<no accounts>", NULL);
item->SetEnabled(false);
accountMenu->AddItem(item);
}
accountMenu->SetTargetForItems(this);
menu->AddItem(new BMenuItem(accountMenu,
new BMessage(MD_CHECK_FOR_MAILS)));
// Not used:
// menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE (
// "Check For Mails Only","メール受信のみ"), new BMessage(MD_CHECK_FOR_MAILS)));
menu->AddItem(new BMenuItem(
MDR_DIALECT_CHOICE ("Send pending mails", "M) 保留メールを送信"),
new BMessage(MD_SEND_MAILS)));
} else {
menu->AddItem(item = new BMenuItem(
MDR_DIALECT_CHOICE ("Check for mail now", "C) メールチェック"),
new BMessage(MD_CHECK_SEND_NOW)));
if (accounts.CountAccounts() == 0)
item->SetEnabled(false);
}
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(
MDR_DIALECT_CHOICE ("Preferences", "P) メール環境設定") B_UTF8_ELLIPSIS,
new BMessage(MD_OPEN_PREFS)));
if (modifiers() & B_SHIFT_KEY) {
menu->AddItem(new BMenuItem(
MDR_DIALECT_CHOICE ("Shutdown mail services", "Q) 終了"),
new BMessage(B_QUIT_REQUESTED)));
}
// Reset Item Targets (only those which aren't already set)
for (int32 i = menu->CountItems(); i-- > 0;) {
item = menu->ItemAt(i);
if (item && (msg = item->Message()) != NULL) {
if (msg->what == B_REFS_RECEIVED)
item->SetTarget(tracker);
else
item->SetTarget(this);
}
}
return menu;
}
示例5: name
//.........这里部分代码省略.........
B_TRANSLATE("To:")) + 25);
r.top -= 1;
fToMenu = new QPopupMenu(B_TRANSLATE("To:"));
field = new BMenuField(r, "", "", fToMenu, true,
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
field->SetDivider(0.0);
field->SetEnabled(true);
AddChild(field);
}
// "From:" accounts Menu and Encoding Menu.
if (!fIncoming || resending) {
// Put the character set box on the right of the From field.
r.Set(windowRect.Width() - widestCharacterSet -
StringWidth(B_TRANSLATE("Encoding:")) - 2 * SEPARATOR_MARGIN,
y - 2, windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight);
BMenuField* encodingField = new BMenuField(r, "encoding",
B_TRANSLATE("Encoding:"), fEncodingMenu, true /* fixedSize */,
B_FOLLOW_TOP | B_FOLLOW_RIGHT,
B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP);
encodingField->SetDivider(encodingField->StringWidth(
B_TRANSLATE("Encoding:")) + 5);
AddChild(encodingField);
field = encodingField;
// And now the "from account" pop-up menu, on the left side, taking the
// remaining space.
fAccountMenu = new BPopUpMenu(B_EMPTY_STRING);
BMailAccounts accounts;
bool marked = false;
for (int32 i = 0; i < accounts.CountAccounts(); i++) {
BMailAccountSettings* account = accounts.AccountAt(i);
BString name = account->Name();
name << ": " << account->RealName() << " <"
<< account->ReturnAddress() << ">";
msg = new BMessage(kMsgFrom);
BMenuItem *item = new BMenuItem(name, msg);
msg->AddInt32("id", account->AccountID());
if (defaultAccount == account->AccountID()) {
item->SetMarked(true);
marked = true;
}
fAccountMenu->AddItem(item);
}
if (!marked) {
BMenuItem *item = fAccountMenu->ItemAt(0);
if (item != NULL) {
item->SetMarked(true);
fAccountID = item->Message()->FindInt32("id");
} else {
fAccountMenu->AddItem(
item = new BMenuItem(B_TRANSLATE("<none>"), NULL));
item->SetEnabled(false);
fAccountID = ~0UL;
}
// default account is invalid, set to marked
// TODO: do this differently, no casting and knowledge
// of TMailApp here....
if (TMailApp* app = dynamic_cast<TMailApp*>(be_app))
示例6:
_EXPORT int32
count_pop_accounts(void)
{
BMailAccounts accounts;
return accounts.CountAccounts();
}