* Add General section in Preference/Behavior
 * Don't prompt at quit option under General section
 * Show confirmation dialog on quit (if enabled)

Misc
 * Replace +/- in preferences Accounts with Add/Del
This commit is contained in:
Ivan Gualandri 2015-10-02 04:17:54 +00:00
parent fb5f1c38cf
commit b4d9d575a9
6 changed files with 35 additions and 5 deletions

View File

@ -125,9 +125,14 @@ MainWindow::Start()
bool
MainWindow::QuitRequested()
{
BAlert* alert = new BAlert("Closing", "Are you sure you wan to quit?", "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
int32 button_index = alert->Go();
int32 button_index = 0;
if(!CayaPreferences::Item()->DisableQuitConfirm)
{
BAlert* alert = new BAlert("Closing", "Are you sure you wan to quit?", "Yes", "No", NULL, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
button_index = alert->Go();
}
if(button_index == 0) {
fListView->MakeEmpty();
fServer->Quit();

View File

@ -35,7 +35,8 @@ CayaPreferencesData::CayaPreferencesData()
NotifyProtocolStatus(true),
NotifyContactStatus(false),
NotifyNewMessage(true),
HideOffline(true)
HideOffline(true),
DisableQuitConfirm(true)
{
}
@ -100,6 +101,7 @@ CayaPreferencesData::Flatten(BPositionIO* flatData) const
_AddBool(flatData, NotifyProtocolStatus);
_AddBool(flatData, NotifyContactStatus);
_AddBool(flatData, NotifyNewMessage);
_AddBool(flatData, DisableQuitConfirm);
// Replicant
_AddBool(flatData, HideCayaDeskbar);
@ -167,6 +169,7 @@ CayaPreferencesData::Unflatten(type_code code, BPositionIO* flatData)
NotifyProtocolStatus = _ReadBool(flatData);
NotifyContactStatus = _ReadBool(flatData);
NotifyNewMessage = _ReadBool(flatData);
DisableQuitConfirm = _ReadBool(flatData);
// Replicant
HideCayaDeskbar = _ReadBool(flatData);

View File

@ -35,6 +35,7 @@ public:
bool HideCayaDeskbar;
bool DisableReplicant;
bool DisableQuitConfirm;
bool IgnoreEmoticons;

View File

@ -31,6 +31,7 @@ const uint32 kNotifyContactStatus = 'NTcl';
const uint32 kNotifyNewMessage = 'NTms';
const uint32 kMarkUnreadWindow = 'MKuw';
const uint32 kHideOffline = 'HiOf';
const uint32 kDisablePrompt = 'DiPr';
PreferencesBehavior::PreferencesBehavior()
@ -85,6 +86,12 @@ PreferencesBehavior::PreferencesBehavior()
fNotifyNewMessage = new BCheckBox("EnableMessageNotify",
"Enable message notifications", new BMessage(kNotifyNewMessage));
fGeneral = new BStringView("onGeneral", "General");
fGeneral->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
fGeneral->SetFont(be_bold_font);
fDisableQuitConfirm = new BCheckBox("DisableQuitConfirm",
"Don't ask confirmation at Quit", new BMessage(kDisablePrompt));
const float spacing = be_control_look->DefaultItemSpacing();
SetLayout(new BGroupLayout(B_HORIZONTAL, spacing));
@ -100,6 +107,11 @@ PreferencesBehavior::PreferencesBehavior()
.Add(fPlaySoundOnMessageReceived)
. SetInsets(spacing * 2, spacing, spacing, spacing)
.End()
.Add(fGeneral)
.AddGroup(B_VERTICAL, spacing)
.Add(fDisableQuitConfirm)
. SetInsets(spacing * 2, spacing, spacing, spacing)
.End()
.Add(fNotifications)
.AddGroup(B_VERTICAL, spacing)
.Add(fNotifyProtocols)
@ -124,6 +136,7 @@ PreferencesBehavior::AttachedToWindow()
fNotifyProtocols->SetTarget(this);
fNotifyContactStatus->SetTarget(this);
fNotifyNewMessage->SetTarget(this);
fDisableQuitConfirm->SetTarget(this);
fHideOffline->SetValue(
CayaPreferences::Item()->HideOffline);
@ -141,6 +154,8 @@ PreferencesBehavior::AttachedToWindow()
CayaPreferences::Item()->NotifyContactStatus);
fNotifyNewMessage->SetValue(
CayaPreferences::Item()->NotifyNewMessage);
fDisableQuitConfirm->SetValue(
CayaPreferences::Item()->DisableQuitConfirm);
}
@ -180,6 +195,10 @@ PreferencesBehavior::MessageReceived(BMessage* message)
CayaPreferences::Item()->MarkUnreadWindow
= fMarkUnreadWindow->Value();
break;
case kDisablePrompt:
CayaPreferences::Item()->DisableQuitConfirm
= fDisableQuitConfirm->Value();
break;
default:
BView::MessageReceived(message);
}

View File

@ -28,6 +28,8 @@ private:
BCheckBox* fPlaySoundOnMessageReceived;
BCheckBox* fMarkUnreadWindow;
BCheckBox* fMarkUnreadReplicant;
BStringView* fGeneral;
BCheckBox* fDisableQuitConfirm;
BStringView* fNotifications;
BCheckBox* fNotifyProtocols;

View File

@ -21,7 +21,7 @@ const uint32 kApply = 'SAVE';
PreferencesDialog::PreferencesDialog()
: BWindow(BRect(0, 0, 500, 550), "Preferences", B_TITLED_WINDOW,
: BWindow(BRect(0, 0, 500, 615), "Preferences", B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE)
{
BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL);