[haiku-commits] haiku: hrev43645 - src/apps/mail

  • From: zharik@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 9 Jan 2012 23:04:33 +0100 (CET)

hrev43645 adds 3 changesets to branch 'master'
old head: b63d0f0c4454c5435b6a481072fc615dabbf8b93
new head: 1516a674a25dbfd762b3a723a220126508a8e2c7

----------------------------------------------------------------------------

a7c3ac5: "Close and Leave As ***" menu handling improved.
  
  * Check for real e-mail status before activating corresponding
    "Close and Leave as <Status>" popup menu entries and modifying them
    correspondently;
  * That was implemented as GCI 2011 task. Fixes #5251.
  
  Signed-off-by: Siarzhuk Zharski <zharik@xxxxxx>

975f024: Fix [Read|Unread] buttons behaviour
  
  * Allow displaying of "Read" button only for Incoming e-mails.
    Fixes #4773;
  * Move to the next message after pressing "Unread" button that
    is consistent with corresponding "Unread" button case.
    Fixes #4774;
  * Those problems were fixed during completing GCI 2011 task.
  
  Signed-off-by: Siarzhuk Zharski <zharik@xxxxxx>

1516a67: Placement of user splell_check directories fixed
  
  * User collected dictionaries and indexes are moved under
    ~/config/data/spell_check/ folder. Fixes #7887.
  * This fix was made during completing GCI 2011 task.
  
  Signed-off-by: Siarzhuk Zharski <zharik@xxxxxx>

                             [ Aleksas Pantechovskis <alexp.frl@xxxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 67 insertions(+), 17 deletions(-)
src/apps/mail/MailApp.cpp    |   57 ++++++++++++++++++++++++++++----------
src/apps/mail/MailWindow.cpp |   26 ++++++++++++++++-
src/apps/mail/MailWindow.h   |    1 +

############################################################################

Commit:      a7c3ac5527c418be35139f0a174839d79873629c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a7c3ac5
Author:      Aleksas Pantechovskis <alexp.frl@xxxxxxxxx>
Date:        Mon Jan  9 22:55:29 2012 UTC
Committer:   Siarzhuk Zharski <zharik@xxxxxx>
Commit-Date: Mon Jan  9 22:55:29 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/5251

"Close and Leave As ***" menu handling improved.

* Check for real e-mail status before activating corresponding
  "Close and Leave as <Status>" popup menu entries and modifying them
  correspondently;
* That was implemented as GCI 2011 task. Fixes #5251.

Signed-off-by: Siarzhuk Zharski <zharik@xxxxxx>

----------------------------------------------------------------------------

diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp
index fc8ccfa..f3a723b 100644
--- a/src/apps/mail/MailWindow.cpp
+++ b/src/apps/mail/MailWindow.cpp
@@ -157,6 +157,7 @@ TMailWindow::TMailWindow(BRect rect, const char* title, 
TMailApp* app,
        fRef(NULL),
        fFieldState(0),
        fPanel(NULL),
+       fLeaveStatusMenu(NULL),
        fSendButton(NULL),
        fSaveButton(NULL),
        fPrintButton(NULL),
@@ -244,7 +245,9 @@ TMailWindow::TMailWindow(BRect rect, const char* title, 
TMailApp* app,
                read_read_attr(file, flag);
 
                if (flag == B_UNREAD) {
-                       subMenu->AddItem(item = new 
BMenuItem(B_TRANSLATE("Leave as New"),
+                       subMenu->AddItem(item = new BMenuItem(
+                               B_TRANSLATE_COMMENT("Leave as 'New'",
+                               "Do not translate New - this is non-localizable 
e-mail status"),
                                new BMessage(kMsgQuitAndKeepAllStatus), 'W', 
B_SHIFT_KEY));
                } else {
                        BString status;
@@ -287,6 +290,8 @@ TMailWindow::TMailWindow(BRect rect, const char* title, 
TMailApp* app,
                        new BMessage(M_CLOSE_CUSTOM)));
 #endif
                menu->AddItem(subMenu);
+
+               fLeaveStatusMenu = subMenu;
        } else {
                menu->AddSeparatorItem();
                menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
@@ -906,6 +911,22 @@ TMailWindow::MenusBeginning()
 //     fUndo->SetLabel((isRedo)
 //     ? kRedoStrings[undoState] : kUndoStrings[undoState]);
        fUndo->SetEnabled(undoState != B_UNDO_UNAVAILABLE);
+
+       if (fLeaveStatusMenu != NULL && fRef != NULL) {
+               BFile file(fRef, B_READ_ONLY);
+               BString status;
+               file.ReadAttrString(B_MAIL_ATTR_STATUS, &status);
+
+               BMenuItem* LeaveStatus = 
fLeaveStatusMenu->FindItem(B_QUIT_REQUESTED);
+               if (LeaveStatus == NULL)
+                       LeaveStatus = 
fLeaveStatusMenu->FindItem(kMsgQuitAndKeepAllStatus);
+
+               if (LeaveStatus != NULL && status.Length() > 0) {
+                       BString label;
+                       label.SetToFormat(B_TRANSLATE("Leave as '%s'"), 
status.String());
+                       LeaveStatus->SetLabel(label.String());
+               }
+       }
 }
 
 
diff --git a/src/apps/mail/MailWindow.h b/src/apps/mail/MailWindow.h
index c5ad179..00f91e1 100644
--- a/src/apps/mail/MailWindow.h
+++ b/src/apps/mail/MailWindow.h
@@ -163,6 +163,7 @@ class TMailWindow : public BWindow {
                                BMenu*                  fSaveAddrMenu;
 
                                BMenu*                  fQueryMenu;
+                               BMenu*                  fLeaveStatusMenu;
                
                                ButtonBar*              fButtonBar;
                                BmapButton*             fSendButton;

############################################################################

Commit:      975f024407b96be285833c318abab1c003770cfb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=975f024
Author:      Aleksas Pantechovskis <alexp.frl@xxxxxxxxx>
Date:        Mon Jan  9 22:56:16 2012 UTC
Committer:   Siarzhuk Zharski <zharik@xxxxxx>
Commit-Date: Mon Jan  9 22:56:16 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/4773
Ticket:      https://dev.haiku-os.org/ticket/4774

Fix [Read|Unread] buttons behaviour

* Allow displaying of "Read" button only for Incoming e-mails.
  Fixes #4773;
* Move to the next message after pressing "Unread" button that
  is consistent with corresponding "Unread" button case.
  Fixes #4774;
* Those problems were fixed during completing GCI 2011 task.

Signed-off-by: Siarzhuk Zharski <zharik@xxxxxx>

----------------------------------------------------------------------------

diff --git a/src/apps/mail/MailWindow.cpp b/src/apps/mail/MailWindow.cpp
index f3a723b..e204cb8 100644
--- a/src/apps/mail/MailWindow.cpp
+++ b/src/apps/mail/MailWindow.cpp
@@ -1478,6 +1478,7 @@ TMailWindow::MessageReceived(BMessage *msg)
                case M_UNREAD:
                        MarkMessageRead(fRef, B_SEEN);
                        _UpdateReadButton();
+                       PostMessage(M_NEXTMSG);
                        break;
                case M_READ:
                        wasReadMsg = true;
@@ -3190,7 +3191,7 @@ TMailWindow::_UpdateReadButton()
        if (fApp->ShowButtonBar()) {
                fButtonBar->RemoveButton(fReadButton);
                fReadButton = NULL;
-               if (!fAutoMarkRead)
+               if (!fAutoMarkRead && fIncoming)
                        _AddReadButton();
        }
        UpdateViews();

############################################################################

Revision:    hrev43645
Commit:      1516a674a25dbfd762b3a723a220126508a8e2c7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=1516a67
Author:      Aleksas Pantechovskis <alexp.frl@xxxxxxxxx>
Date:        Mon Jan  9 23:00:00 2012 UTC
Committer:   Siarzhuk Zharski <zharik@xxxxxx>
Commit-Date: Mon Jan  9 23:00:00 2012 UTC

Ticket:      https://dev.haiku-os.org/ticket/7887

Placement of user splell_check directories fixed

* User collected dictionaries and indexes are moved under
  ~/config/data/spell_check/ folder. Fixes #7887.
* This fix was made during completing GCI 2011 task.

Signed-off-by: Siarzhuk Zharski <zharik@xxxxxx>

----------------------------------------------------------------------------

diff --git a/src/apps/mail/MailApp.cpp b/src/apps/mail/MailApp.cpp
index 6f81998..90a9544 100644
--- a/src/apps/mail/MailApp.cpp
+++ b/src/apps/mail/MailApp.cpp
@@ -464,23 +464,37 @@ TMailApp::ReadyToRun()
        // Load dictionaries
        BPath indexDir;
        BPath dictionaryDir;
+       BPath userDictionaryDir;
+       BPath userIndexDir;
        BPath dataPath;
        BPath indexPath;
        BDirectory directory;
        BEntry entry;
 
-       // Locate user settings directory
+       // Locate dictionaries directory
        find_directory(B_SYSTEM_DATA_DIRECTORY, &indexDir, true);
        indexDir.Append("spell_check");
        dictionaryDir = indexDir;
 
+       //Locate user dictionary directory
+       find_directory(B_USER_CONFIG_DIRECTORY, &userIndexDir, true);
+       userIndexDir.Append("data/spell_check");
+       userDictionaryDir = userIndexDir;
+
+       // Create directory if needed
+       directory.CreateDirectory(userIndexDir.Path(),  NULL);
+
        // Setup directory paths
        indexDir.Append(kIndexDirectory);
        dictionaryDir.Append(kDictDirectory);
+       userIndexDir.Append(kIndexDirectory);
+       userDictionaryDir.Append(kDictDirectory);
 
        // Create directories if needed
        directory.CreateDirectory(indexDir.Path(), NULL);
        directory.CreateDirectory(dictionaryDir.Path(), NULL);
+       directory.CreateDirectory(userIndexDir.Path(), NULL);
+       directory.CreateDirectory(userDictionaryDir.Path(), NULL);
 
        dataPath = dictionaryDir;
        dataPath.Append("words");
@@ -500,14 +514,6 @@ TMailApp::ReadyToRun()
                        BNodeInfo(&copy).SetType("text/plain");
                }
 
-               // Create user dictionary if it does not exist
-               dataPath = dictionaryDir;
-               dataPath.Append("user");
-               if (!BEntry(dataPath.Path()).Exists()) {
-                       BFile user(dataPath.Path(), B_WRITE_ONLY | 
B_CREATE_FILE);
-                       BNodeInfo(&user).SetType("text/plain");
-               }
-
                // Load dictionaries
                directory.SetTo(dictionaryDir.Path());
 
@@ -518,12 +524,6 @@ TMailApp::ReadyToRun()
                        && directory.GetNextEntry(&entry) != B_ENTRY_NOT_FOUND) 
{
                        dataPath.SetTo(&entry);
 
-                       // Identify the user dictionary
-                       if (strcmp("user", dataPath.Leaf()) == 0) {
-                               gUserDictFile = new BFile(dataPath.Path(), 
B_WRITE_ONLY | B_OPEN_AT_END);
-                               gUserDict = gDictCount;
-                       }
-
                        indexPath = indexDir;
                        leafName.SetTo(dataPath.Leaf());
                        leafName.Append(kMetaphone);
@@ -536,6 +536,33 @@ TMailApp::ReadyToRun()
                        indexPath.Append(leafName.String());
                        gExactWords[gDictCount] = new Words(dataPath.Path(), 
indexPath.Path(), false);
                        gDictCount++;
+               }               
+
+               // Create user dictionary if it does not exist
+               dataPath = userDictionaryDir;
+               dataPath.Append("user");
+               if (!BEntry(dataPath.Path()).Exists()) {
+                       BFile user(dataPath.Path(), B_WRITE_ONLY | 
B_CREATE_FILE);
+                       BNodeInfo(&user).SetType("text/plain");
+               }
+
+               // Load user dictionary
+               if (BEntry(userDictionaryDir.Path()).Exists()) {
+                       gUserDictFile = new BFile(dataPath.Path(), B_WRITE_ONLY 
| B_OPEN_AT_END);
+                       gUserDict = gDictCount;
+
+                       indexPath = userIndexDir;
+                       leafName.SetTo(dataPath.Leaf());
+                       leafName.Append(kMetaphone);
+                       indexPath.Append(leafName.String());
+                       gWords[gDictCount] = new Words(dataPath.Path(), 
indexPath.Path(), true);
+
+                       indexPath = userIndexDir;
+                       leafName.SetTo(dataPath.Leaf());
+                       leafName.Append(kExact);
+                       indexPath.Append(leafName.String());
+                       gExactWords[gDictCount] = new Words(dataPath.Path(), 
indexPath.Path(), false);
+                       gDictCount++;
                }
        }
 


Other related posts: