Skip to content

Commit

Permalink
Mail: don't require a subject to save a draft (#9218)
Browse files Browse the repository at this point in the history
Also :
 * if the body of message changes, ask to save draft when closing window
 * disable save button when successfully saving draft
  • Loading branch information
stpere committed Dec 13, 2012
1 parent 53b234e commit 4b84a0b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/apps/mail/MailWindow.cpp
Expand Up @@ -1691,6 +1691,8 @@ TMailWindow::QuitRequested()
|| strlen(fHeaderView->fSubject->Text())
|| (fHeaderView->fCc && strlen(fHeaderView->fCc->Text()))
|| (fHeaderView->fBcc && strlen(fHeaderView->fBcc->Text()))
|| (fContentView->fTextView
&& strlen(fContentView->fTextView->Text()))
|| (fEnclosuresView != NULL
&& fEnclosuresView->fList->CountItems()))) {
if (fResending) {
Expand Down Expand Up @@ -2550,8 +2552,13 @@ TMailWindow::SaveAsDraft()
{
char fileName[B_FILE_NAME_LENGTH];
// save as some version of the message's subject
strlcpy(fileName, fHeaderView->fSubject->Text(),
sizeof(fileName));
if (strlen(fHeaderView->fSubject->Text()) == 0)
strlcpy(fileName, B_TRANSLATE("Untitled"),
sizeof(fileName));
else
strlcpy(fileName, fHeaderView->fSubject->Text(),
sizeof(fileName));

uint32 originalLength = strlen(fileName);

// convert /, \ and : to -
Expand Down Expand Up @@ -2648,6 +2655,8 @@ TMailWindow::SaveAsDraft()
fDraft = true;
fChanged = false;

fSaveButton->SetEnabled(false);

return B_OK;
}

Expand Down

0 comments on commit 4b84a0b

Please sign in to comment.