diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 70cefc0..03a35d6 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -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(); diff --git a/application/preferences/CayaPreferences.cpp b/application/preferences/CayaPreferences.cpp index 374d10b..1ded33a 100644 --- a/application/preferences/CayaPreferences.cpp +++ b/application/preferences/CayaPreferences.cpp @@ -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); diff --git a/application/preferences/CayaPreferences.h b/application/preferences/CayaPreferences.h index 34d8448..0f0b1e5 100644 --- a/application/preferences/CayaPreferences.h +++ b/application/preferences/CayaPreferences.h @@ -35,6 +35,7 @@ public: bool HideCayaDeskbar; bool DisableReplicant; + bool DisableQuitConfirm; bool IgnoreEmoticons; diff --git a/application/preferences/PreferencesBehavior.cpp b/application/preferences/PreferencesBehavior.cpp index 2dd88c5..53c8957 100644 --- a/application/preferences/PreferencesBehavior.cpp +++ b/application/preferences/PreferencesBehavior.cpp @@ -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); } diff --git a/application/preferences/PreferencesBehavior.h b/application/preferences/PreferencesBehavior.h index af32e07..f2c7631 100644 --- a/application/preferences/PreferencesBehavior.h +++ b/application/preferences/PreferencesBehavior.h @@ -28,6 +28,8 @@ private: BCheckBox* fPlaySoundOnMessageReceived; BCheckBox* fMarkUnreadWindow; BCheckBox* fMarkUnreadReplicant; + BStringView* fGeneral; + BCheckBox* fDisableQuitConfirm; BStringView* fNotifications; BCheckBox* fNotifyProtocols; diff --git a/application/preferences/PreferencesDialog.cpp b/application/preferences/PreferencesDialog.cpp index 43077d5..4acf6a7 100644 --- a/application/preferences/PreferencesDialog.cpp +++ b/application/preferences/PreferencesDialog.cpp @@ -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);