From 7235a5a7dd75883384e19ce6a58c9c38b92d964b Mon Sep 17 00:00:00 2001 From: "Alexander G.M. Smith" Date: Sun, 11 Sep 2005 17:50:53 +0000 Subject: [PATCH] Turn off the drafts live-query menu update when viewing existing e-mail messages. It limits the number of open windows to an annoyingly small quantity and makes opening mail files slow. That's because EACH window starts up a bunch of queries to find drafts, one for each disk volume. Comments about design alternatives to this kludge welcome. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14158 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bemail/Mail.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/apps/bemail/Mail.cpp b/src/apps/bemail/Mail.cpp index 21e410dbc3..9152f1686c 100644 --- a/src/apps/bemail/Mail.cpp +++ b/src/apps/bemail/Mail.cpp @@ -1221,13 +1221,24 @@ TMailWindow::TMailWindow(BRect rect, const char *title, const entry_ref *ref, co "New Mail Message", "N) 新規メッセージ作成"), msg, 'N')); item->SetTarget(be_app); - QueryMenu *queryMenu; - queryMenu = new QueryMenu(MDR_DIALECT_CHOICE ("Open Draft", "O) ドラフトを開く"), false); - queryMenu->SetTargetForItems(be_app); + // Cheap hack - only show the drafts menu when composing messages. Insert + // a "true || " in the following IF statement if you want the old BeMail + // behaviour. The difference is that without live draft menu updating you + // can open around 100 e-mails (the BeOS maximum number of open files) + // rather than merely around 20, since each open draft-monitoring query + // sucks up one file handle per mounted BFS disk volume. Plus mail file + // opening speed is noticably improved! Possible ToDo: change this to pop + // up a Tracker query for drafts rather than populating the menu item with + // file names, then we can always have a draft menu turned on. - queryMenu->SetPredicate("MAIL:draft==1"); - menu->AddItem(queryMenu); + if (!fIncoming) { + QueryMenu *queryMenu; + queryMenu = new QueryMenu(MDR_DIALECT_CHOICE ("Open Draft", "O) ドラフトを開く"), false); + queryMenu->SetTargetForItems(be_app); + queryMenu->SetPredicate("MAIL:draft==1"); + menu->AddItem(queryMenu); + } menu->AddSeparatorItem(); if (!resending && fIncoming) { @@ -2786,7 +2797,7 @@ void TMailWindow::Print() { BPrintJob print(Title()); - + if (!print_settings) { if (print.Settings()) { @@ -2966,7 +2977,7 @@ TMailWindow::Reply(entry_ref *ref, TMailWindow *window, uint32 type) fHeaderView->fCc->SetText(fMail->CC()); fHeaderView->fSubject->SetText(fMail->Subject()); - int32 chainID; + int32 chainID; BFile file(window->fRef, B_READ_ONLY); if (file.ReadAttr("MAIL:reply_with", B_INT32_TYPE, 0, &chainID, 4) < B_OK) chainID = -1;