Task #12
* 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:
parent
fb5f1c38cf
commit
b4d9d575a9
|
@ -124,10 +124,15 @@ MainWindow::Start()
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MainWindow::QuitRequested()
|
MainWindow::QuitRequested()
|
||||||
|
{
|
||||||
|
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);
|
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);
|
alert->SetShortcut(0, B_ESCAPE);
|
||||||
int32 button_index = alert->Go();
|
button_index = alert->Go();
|
||||||
|
}
|
||||||
|
|
||||||
if(button_index == 0) {
|
if(button_index == 0) {
|
||||||
fListView->MakeEmpty();
|
fListView->MakeEmpty();
|
||||||
fServer->Quit();
|
fServer->Quit();
|
||||||
|
|
|
@ -35,7 +35,8 @@ CayaPreferencesData::CayaPreferencesData()
|
||||||
NotifyProtocolStatus(true),
|
NotifyProtocolStatus(true),
|
||||||
NotifyContactStatus(false),
|
NotifyContactStatus(false),
|
||||||
NotifyNewMessage(true),
|
NotifyNewMessage(true),
|
||||||
HideOffline(true)
|
HideOffline(true),
|
||||||
|
DisableQuitConfirm(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ CayaPreferencesData::Flatten(BPositionIO* flatData) const
|
||||||
_AddBool(flatData, NotifyProtocolStatus);
|
_AddBool(flatData, NotifyProtocolStatus);
|
||||||
_AddBool(flatData, NotifyContactStatus);
|
_AddBool(flatData, NotifyContactStatus);
|
||||||
_AddBool(flatData, NotifyNewMessage);
|
_AddBool(flatData, NotifyNewMessage);
|
||||||
|
_AddBool(flatData, DisableQuitConfirm);
|
||||||
|
|
||||||
// Replicant
|
// Replicant
|
||||||
_AddBool(flatData, HideCayaDeskbar);
|
_AddBool(flatData, HideCayaDeskbar);
|
||||||
|
@ -167,6 +169,7 @@ CayaPreferencesData::Unflatten(type_code code, BPositionIO* flatData)
|
||||||
NotifyProtocolStatus = _ReadBool(flatData);
|
NotifyProtocolStatus = _ReadBool(flatData);
|
||||||
NotifyContactStatus = _ReadBool(flatData);
|
NotifyContactStatus = _ReadBool(flatData);
|
||||||
NotifyNewMessage = _ReadBool(flatData);
|
NotifyNewMessage = _ReadBool(flatData);
|
||||||
|
DisableQuitConfirm = _ReadBool(flatData);
|
||||||
|
|
||||||
// Replicant
|
// Replicant
|
||||||
HideCayaDeskbar = _ReadBool(flatData);
|
HideCayaDeskbar = _ReadBool(flatData);
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
|
|
||||||
bool HideCayaDeskbar;
|
bool HideCayaDeskbar;
|
||||||
bool DisableReplicant;
|
bool DisableReplicant;
|
||||||
|
bool DisableQuitConfirm;
|
||||||
|
|
||||||
bool IgnoreEmoticons;
|
bool IgnoreEmoticons;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ const uint32 kNotifyContactStatus = 'NTcl';
|
||||||
const uint32 kNotifyNewMessage = 'NTms';
|
const uint32 kNotifyNewMessage = 'NTms';
|
||||||
const uint32 kMarkUnreadWindow = 'MKuw';
|
const uint32 kMarkUnreadWindow = 'MKuw';
|
||||||
const uint32 kHideOffline = 'HiOf';
|
const uint32 kHideOffline = 'HiOf';
|
||||||
|
const uint32 kDisablePrompt = 'DiPr';
|
||||||
|
|
||||||
|
|
||||||
PreferencesBehavior::PreferencesBehavior()
|
PreferencesBehavior::PreferencesBehavior()
|
||||||
|
@ -85,6 +86,12 @@ PreferencesBehavior::PreferencesBehavior()
|
||||||
fNotifyNewMessage = new BCheckBox("EnableMessageNotify",
|
fNotifyNewMessage = new BCheckBox("EnableMessageNotify",
|
||||||
"Enable message notifications", new BMessage(kNotifyNewMessage));
|
"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();
|
const float spacing = be_control_look->DefaultItemSpacing();
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_HORIZONTAL, spacing));
|
SetLayout(new BGroupLayout(B_HORIZONTAL, spacing));
|
||||||
|
@ -100,6 +107,11 @@ PreferencesBehavior::PreferencesBehavior()
|
||||||
.Add(fPlaySoundOnMessageReceived)
|
.Add(fPlaySoundOnMessageReceived)
|
||||||
. SetInsets(spacing * 2, spacing, spacing, spacing)
|
. SetInsets(spacing * 2, spacing, spacing, spacing)
|
||||||
.End()
|
.End()
|
||||||
|
.Add(fGeneral)
|
||||||
|
.AddGroup(B_VERTICAL, spacing)
|
||||||
|
.Add(fDisableQuitConfirm)
|
||||||
|
. SetInsets(spacing * 2, spacing, spacing, spacing)
|
||||||
|
.End()
|
||||||
.Add(fNotifications)
|
.Add(fNotifications)
|
||||||
.AddGroup(B_VERTICAL, spacing)
|
.AddGroup(B_VERTICAL, spacing)
|
||||||
.Add(fNotifyProtocols)
|
.Add(fNotifyProtocols)
|
||||||
|
@ -124,6 +136,7 @@ PreferencesBehavior::AttachedToWindow()
|
||||||
fNotifyProtocols->SetTarget(this);
|
fNotifyProtocols->SetTarget(this);
|
||||||
fNotifyContactStatus->SetTarget(this);
|
fNotifyContactStatus->SetTarget(this);
|
||||||
fNotifyNewMessage->SetTarget(this);
|
fNotifyNewMessage->SetTarget(this);
|
||||||
|
fDisableQuitConfirm->SetTarget(this);
|
||||||
|
|
||||||
fHideOffline->SetValue(
|
fHideOffline->SetValue(
|
||||||
CayaPreferences::Item()->HideOffline);
|
CayaPreferences::Item()->HideOffline);
|
||||||
|
@ -141,6 +154,8 @@ PreferencesBehavior::AttachedToWindow()
|
||||||
CayaPreferences::Item()->NotifyContactStatus);
|
CayaPreferences::Item()->NotifyContactStatus);
|
||||||
fNotifyNewMessage->SetValue(
|
fNotifyNewMessage->SetValue(
|
||||||
CayaPreferences::Item()->NotifyNewMessage);
|
CayaPreferences::Item()->NotifyNewMessage);
|
||||||
|
fDisableQuitConfirm->SetValue(
|
||||||
|
CayaPreferences::Item()->DisableQuitConfirm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,6 +195,10 @@ PreferencesBehavior::MessageReceived(BMessage* message)
|
||||||
CayaPreferences::Item()->MarkUnreadWindow
|
CayaPreferences::Item()->MarkUnreadWindow
|
||||||
= fMarkUnreadWindow->Value();
|
= fMarkUnreadWindow->Value();
|
||||||
break;
|
break;
|
||||||
|
case kDisablePrompt:
|
||||||
|
CayaPreferences::Item()->DisableQuitConfirm
|
||||||
|
= fDisableQuitConfirm->Value();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ private:
|
||||||
BCheckBox* fPlaySoundOnMessageReceived;
|
BCheckBox* fPlaySoundOnMessageReceived;
|
||||||
BCheckBox* fMarkUnreadWindow;
|
BCheckBox* fMarkUnreadWindow;
|
||||||
BCheckBox* fMarkUnreadReplicant;
|
BCheckBox* fMarkUnreadReplicant;
|
||||||
|
BStringView* fGeneral;
|
||||||
|
BCheckBox* fDisableQuitConfirm;
|
||||||
|
|
||||||
BStringView* fNotifications;
|
BStringView* fNotifications;
|
||||||
BCheckBox* fNotifyProtocols;
|
BCheckBox* fNotifyProtocols;
|
||||||
|
|
|
@ -21,7 +21,7 @@ const uint32 kApply = 'SAVE';
|
||||||
|
|
||||||
|
|
||||||
PreferencesDialog::PreferencesDialog()
|
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)
|
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE)
|
||||||
{
|
{
|
||||||
BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL);
|
BTabView* tabView = new BTabView("tabView", B_WIDTH_AS_USUAL);
|
||||||
|
|
Ŝarĝante…
Reference in New Issue