diff --git a/common/confirm.cpp b/common/confirm.cpp
index e8ca3e25de..eb6670d9eb 100644
--- a/common/confirm.cpp
+++ b/common/confirm.cpp
@@ -156,18 +156,20 @@ long KIDIALOG::getStyle( KD_TYPE aType )
class DIALOG_EXIT: public DIALOG_EXIT_BASE
{
public:
- DIALOG_EXIT( wxWindow *aParent, const wxString& aMessage ) :
+ DIALOG_EXIT( wxWindow *aParent, const wxString& aWarning, const wxString& aMessage,
+ const wxString& aOKLabel, const wxString& aCancelLabel ) :
DIALOG_EXIT_BASE( aParent )
{
m_bitmap->SetBitmap( KiBitmap( dialog_warning_xpm ) );
+ m_TextInfo->SetLabel( aWarning );
+ m_staticText2->SetLabel( aMessage );
- if( !aMessage.IsEmpty() )
- m_TextInfo->SetLabel( aMessage );
+ // Caller must eanble these if desired
+ m_ApplyToAllOpt->Show( false );
+ m_DiscardButton->Show( false );
- m_ApplyToAllOpt->Show( false ); // Caller must enable this
-
- m_sdbSizer1OK->SetLabel( _( "Save and Exit" ) );
- m_sdbSizer1Apply->SetLabel( _( "Discard Changes" ) );
+ m_sdbSizer1OK->SetLabel( aOKLabel );
+ m_sdbSizer1Cancel->SetLabel( aCancelLabel );
m_sdbSizer1OK->SetDefault();
m_sdbSizer1->Layout();
@@ -177,14 +179,36 @@ public:
};
private:
- void OnSaveAndExit( wxCommandEvent& event ) override { EndModal( wxID_YES ); }
- void OnExitNoSave( wxCommandEvent& event ) override { EndModal( wxID_NO ); }
+ void OnSave( wxCommandEvent& event ) override { EndModal( wxID_YES ); }
+ void OnDiscard( wxCommandEvent& event ) override { EndModal( wxID_NO ); }
};
-int DisplayExitDialog( wxWindow* parent, const wxString& aMessage, bool* aApplyToAll )
+int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage, bool* aApplyToAll )
{
- DIALOG_EXIT dlg( parent, aMessage );
+ DIALOG_EXIT dlg( parent, aMessage,
+ _( "If you don't save, all your changes will be permanently lost." ),
+ _( "Save" ), _( "Cancel" ) );
+
+ if( aApplyToAll )
+ dlg.m_ApplyToAllOpt->Show( true );
+
+ dlg.m_DiscardButton->Show( true );
+
+ int ret = dlg.ShowModal();
+
+ if( aApplyToAll )
+ *aApplyToAll = dlg.m_ApplyToAllOpt->GetValue();
+
+ // Returns wxID_YES, wxID_NO, or wxID_CANCEL
+ return ret;
+}
+
+
+int YesOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage,
+ const wxString& aOKLabel, const wxString& aCancelLabel, bool* aApplyToAll )
+{
+ DIALOG_EXIT dlg( aParent, aWarning, aMessage, aOKLabel, aCancelLabel );
if( aApplyToAll )
dlg.m_ApplyToAllOpt->Show( true );
@@ -257,48 +281,6 @@ bool IsOK( wxWindow* aParent, const wxString& aMessage )
}
-class DIALOG_YES_NO_CANCEL : public DIALOG_EXIT
-{
-public:
- DIALOG_YES_NO_CANCEL( wxWindow *aParent,
- const wxString& aPrimaryMessage,
- const wxString& aSecondaryMessage = wxEmptyString,
- const wxString& aYesButtonText = wxEmptyString,
- const wxString& aNoButtonText = wxEmptyString,
- const wxString& aCancelButtonText = wxEmptyString ) :
- DIALOG_EXIT( aParent, aPrimaryMessage )
- {
- if( aSecondaryMessage.IsEmpty() )
- m_staticText2->Hide();
- else
- m_staticText2->SetLabel( aSecondaryMessage );
-
- m_sdbSizer1OK->SetLabel( aYesButtonText.IsEmpty() ? wxGetStockLabel( wxID_YES ) :
- aYesButtonText );
- m_sdbSizer1Apply->SetLabel( aNoButtonText.IsEmpty() ? wxGetStockLabel( wxID_NO ) :
- aNoButtonText );
- m_sdbSizer1Cancel->SetLabel( aCancelButtonText.IsEmpty() ? wxGetStockLabel( wxID_CANCEL ) :
- aCancelButtonText );
- GetSizer()->Fit( this );
- GetSizer()->SetSizeHints( this );
- };
-};
-
-
-int YesNoCancelDialog( wxWindow* aParent,
- const wxString& aPrimaryMessage,
- const wxString& aSecondaryMessage,
- const wxString& aYesButtonText,
- const wxString& aNoButtonText,
- const wxString& aCancelButtonText )
-{
- DIALOG_YES_NO_CANCEL dlg( aParent, aPrimaryMessage, aSecondaryMessage,
- aYesButtonText, aNoButtonText, aCancelButtonText );
-
- return dlg.ShowModal();
-}
-
-
int SelectSingleOption( wxWindow* aParent, const wxString& aTitle, const wxString& aMessage, const wxArrayString& aOptions )
{
wxSingleChoiceDialog dlg( aParent, aMessage, aTitle, aOptions );
diff --git a/common/dialogs/dialog_exit_base.cpp b/common/dialogs/dialog_exit_base.cpp
index 6db15f4d31..92d0e15427 100644
--- a/common/dialogs/dialog_exit_base.cpp
+++ b/common/dialogs/dialog_exit_base.cpp
@@ -19,19 +19,13 @@ DIALOG_EXIT_BASE::DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id, const wxStr
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
- wxBoxSizer* bSizerBitmap;
- bSizerBitmap = new wxBoxSizer( wxVERTICAL );
-
m_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
- bSizerBitmap->Add( m_bitmap, 0, wxALL, 5 );
-
-
- bSizerUpper->Add( bSizerBitmap, 0, 0, 5 );
+ bSizerUpper->Add( m_bitmap, 0, wxALL, 5 );
wxBoxSizer* bSizerMessages;
bSizerMessages = new wxBoxSizer( wxVERTICAL );
- m_TextInfo = new wxStaticText( this, wxID_ANY, _("Save the changes before closing?"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_TextInfo = new wxStaticText( this, wxID_ANY, _("Save changes?"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextInfo->Wrap( -1 );
m_TextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
@@ -54,18 +48,25 @@ DIALOG_EXIT_BASE::DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_buttonSizer->SetMinSize( wxSize( 475,-1 ) );
m_ApplyToAllOpt = new wxCheckBox( this, wxID_ANY, _("Apply to all"), wxDefaultPosition, wxDefaultSize, 0 );
- m_buttonSizer->Add( m_ApplyToAllOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 20 );
+ m_buttonSizer->Add( m_ApplyToAllOpt, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
+
+
+ m_buttonSizer->Add( 0, 0, 1, wxRIGHT|wxLEFT, 10 );
+
+ m_DiscardButton = new wxButton( this, wxID_ANY, _("Discard Changes"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_buttonSizer->Add( m_DiscardButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+
+ m_buttonSizer->Add( 0, 0, 0, wxRIGHT|wxLEFT, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
- m_sdbSizer1Apply = new wxButton( this, wxID_APPLY );
- m_sdbSizer1->AddButton( m_sdbSizer1Apply );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
- m_buttonSizer->Add( m_sdbSizer1, 1, wxEXPAND|wxALL, 5 );
+ m_buttonSizer->Add( m_sdbSizer1, 0, wxALL, 5 );
bSizerMain->Add( m_buttonSizer, 0, wxEXPAND|wxLEFT, 10 );
@@ -78,14 +79,14 @@ DIALOG_EXIT_BASE::DIALOG_EXIT_BASE( wxWindow* parent, wxWindowID id, const wxStr
this->Centre( wxBOTH );
// Connect Events
- m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this );
- m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this );
+ m_DiscardButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnDiscard ), NULL, this );
+ m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSave ), NULL, this );
}
DIALOG_EXIT_BASE::~DIALOG_EXIT_BASE()
{
// Disconnect Events
- m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnExitNoSave ), NULL, this );
- m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSaveAndExit ), NULL, this );
+ m_DiscardButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnDiscard ), NULL, this );
+ m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXIT_BASE::OnSave ), NULL, this );
}
diff --git a/common/dialogs/dialog_exit_base.fbp b/common/dialogs/dialog_exit_base.fbp
index 65dfb776bd..72a2e4d808 100644
--- a/common/dialogs/dialog_exit_base.fbp
+++ b/common/dialogs/dialog_exit_base.fbp
@@ -104,94 +104,83 @@
none