diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-24 17:11:09 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-24 18:07:41 +0100 |
commit | 1413d6bc9902a536c0c67f42d2cb16ea45174fe4 (patch) | |
tree | e2ae3527959a294735a230f3934de4a4cc4d8bc6 /svx/source/dialog | |
parent | e5cc4e2422515a98e11071c7449ca231bd243874 (diff) |
convert doc recovery save page to .ui
and a wizard with one page is just a dialog, so make
that simplification and conversion too
Change-Id: I9f6335007609893308d57d693a18a313bcbb9244
Diffstat (limited to 'svx/source/dialog')
-rw-r--r-- | svx/source/dialog/docrecovery.cxx | 82 | ||||
-rw-r--r-- | svx/source/dialog/docrecovery.hrc | 11 | ||||
-rw-r--r-- | svx/source/dialog/docrecovery.src | 57 |
3 files changed, 22 insertions, 128 deletions
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 10ff3a72ef1d..e2c9b4079c52 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -678,20 +678,15 @@ void SAL_CALL PluginProgress::reset() } -SaveDialog::SaveDialog(Window* pParent, - RecoveryCore* pCore ) - : IExtendedTabPage( pParent, SVX_RES( RID_SVXPAGE_DOCRECOVERY_SAVE ) ) - , m_aTitleFT ( this , SVX_RES ( FT_SAVE_TITLE ) ) - , m_aTitleWin ( this , SVX_RES ( WIN_SAVE_TITLE ) ) - , m_aTitleFL ( this , SVX_RES ( FL_SAVE_TITLE ) ) - , m_aDescrFT ( this , SVX_RES ( FT_SAVE_DESCR ) ) - , m_aFileListFT ( this , SVX_RES ( FT_SAVE_FILELIST ) ) - , m_aFileListLB ( this , SVX_RES ( LB_SAVE_FILELIST ) ) - , m_aBottomFL ( this , SVX_RES ( FL_SAVE_BOTTOM ) ) - , m_aOkBtn ( this , SVX_RES ( BT_SAVE_OK ) ) - , m_pCore ( pCore ) +SaveDialog::SaveDialog(Window* pParent, RecoveryCore* pCore) + : Dialog(pParent, "DocRecoverySaveDialog", "svx/ui/docrecoverysavedialog.ui") + , m_pCore(pCore) { - FreeResource(); + get(m_pTitleFT, "title"); + get(m_pFileListLB, "filelist"); + m_pFileListLB->set_height_request(m_pFileListLB->GetTextHeight() * 10); + m_pFileListLB->set_width_request(m_pFileListLB->approximate_char_width() * 72); + get(m_pOkBtn, "ok"); // Prepare the office for the following crash save step. // E.g. hide all open widows so the user can't influence our @@ -699,19 +694,14 @@ SaveDialog::SaveDialog(Window* pParent, m_pCore->doEmergencySavePrepare(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - Wallpaper aBackground(rStyleSettings.GetWindowColor()); - m_aTitleWin.SetBackground(aBackground); - m_aTitleFT.SetBackground (aBackground); - - Font aFont(m_aTitleFT.GetFont()); - aFont.SetWeight(WEIGHT_BOLD); - m_aTitleFT.SetFont(aFont); + m_pTitleFT->SetBackground(rStyleSettings.GetWindowColor()); + m_pTitleFT->set_height_request(m_pTitleFT->get_preferred_size().Height() + 48); - m_aOkBtn.SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) ); - m_aFileListLB.SetControlBackground( rStyleSettings.GetDialogColor() ); + m_pOkBtn->SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) ); + m_pFileListLB->SetControlBackground( rStyleSettings.GetDialogColor() ); // fill listbox with current open documents - m_aFileListLB.Clear(); + m_pFileListLB->Clear(); TURLList* pURLs = m_pCore->getURLListAccess(); TURLList::const_iterator pIt; @@ -721,54 +711,26 @@ SaveDialog::SaveDialog(Window* pParent, ++pIt ) { const TURLInfo& rInfo = *pIt; - m_aFileListLB.InsertEntry( rInfo.DisplayName, rInfo.StandardImage ); + m_pFileListLB->InsertEntry( rInfo.DisplayName, rInfo.StandardImage ); } } - -SaveDialog::~SaveDialog() -{ -} - - IMPL_LINK_NOARG(SaveDialog, OKButtonHdl) { - m_nResult = DLG_RET_OK; - return 0; -} - - -short SaveDialog::execute() -{ - ::SolarMutexGuard aLock; - - // wait for user input "OK" - m_nResult = DLG_RET_UNKNOWN; - while(m_nResult == DLG_RET_UNKNOWN) - Application::Yield(); - // start crash-save with progress - if (m_nResult == DLG_RET_OK) - { - SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore); - m_nResult = pProgress->Execute(); - delete pProgress; - } + SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore); + short nResult = pProgress->Execute(); + delete pProgress; + // if "CANCEL" => return "CANCEL" // if "OK" => "AUTOLUNCH" always ! - if (m_nResult == DLG_RET_OK) - m_nResult = DLG_RET_OK_AUTOLUNCH; + if (nResult == DLG_RET_OK) + nResult = DLG_RET_OK_AUTOLUNCH; - return m_nResult; -} - - -void SaveDialog::setDefButton() -{ - m_aOkBtn.GrabFocus(); + EndDialog(nResult); + return 0; } - SaveProgressDialog::SaveProgressDialog(Window* pParent, RecoveryCore* pCore ) : ModalDialog ( pParent , SVX_RES( RID_SVX_MDLG_DOCRECOVERY_PROGR ) ) diff --git a/svx/source/dialog/docrecovery.hrc b/svx/source/dialog/docrecovery.hrc index 7ede1369699c..a74b30bf4f41 100644 --- a/svx/source/dialog/docrecovery.hrc +++ b/svx/source/dialog/docrecovery.hrc @@ -30,17 +30,6 @@ #define TABDLG_WIDTH 290 #define TABDLG_HEIGHT 238 -// TabPage CrashSave - -#define WIN_SAVE_TITLE 1 -#define FT_SAVE_TITLE 2 -#define FL_SAVE_TITLE 3 -#define FT_SAVE_DESCR 4 -#define FT_SAVE_FILELIST 5 -#define LB_SAVE_FILELIST 6 -#define FL_SAVE_BOTTOM 8 -#define BT_SAVE_OK 9 - #define SAVE_WIDTH 290 #define SAVE_HEIGHT 238 #define SAVE_TITLEWINHEIGHT 36 diff --git a/svx/source/dialog/docrecovery.src b/svx/source/dialog/docrecovery.src index 1900be6338f4..2b676d4ec3eb 100644 --- a/svx/source/dialog/docrecovery.src +++ b/svx/source/dialog/docrecovery.src @@ -33,63 +33,6 @@ TabDialog RID_SVX_TABDLG_DOCRECOVERY Text = "%PRODUCTNAME %PRODUCTVERSION"; }; -TabPage RID_SVXPAGE_DOCRECOVERY_SAVE -{ - Size = MAP_APPFONT( SAVE_WIDTH, SAVE_HEIGHT ); - HelpId = HID_SVX_TP_DOCRECOVERY_SAVE; - OutputSize = TRUE; - SVLook = TRUE; - Hide = TRUE; - Window WIN_SAVE_TITLE - { - Pos = MAP_APPFONT( 0 , 0 ); - Size = MAP_APPFONT( SAVE_WIDTH, SAVE_ROW1 ); - }; - FixedText FT_SAVE_TITLE - { - Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW0 ); - Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT ); - Text[ en-US ] = "%PRODUCTNAME Document Recovery"; - }; - FixedLine FL_SAVE_TITLE - { - Pos = MAP_APPFONT( 0 , SAVE_ROW1 ); - Size = MAP_APPFONT( SAVE_WIDTH, 2 ); - }; - FixedText FT_SAVE_DESCR - { - Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW2 ); - Size = MAP_APPFONT( SAVE_CONTROLWIDTH, (SAVE_ROW3-SAVE_ROW2-RSC_SP_CTRL_DESC_Y) ); - WordBreak = TRUE; - Text[ en-US ] = "Due to an unexpected error, %PRODUCTNAME crashed. All the files you were working on will now be saved. The next time %PRODUCTNAME is launched, your files will be recovered automatically."; - }; - FixedText FT_SAVE_FILELIST - { - Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW3 ); - Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT ); - Text[ en-US ] = "The following files will be recovered:"; - }; - ListBox LB_SAVE_FILELIST - { - HelpID = "svx:ListBox:RID_SVXPAGE_DOCRECOVERY_SAVE:LB_SAVE_FILELIST"; - Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW4 ); - Size = MAP_APPFONT( SAVE_CONTROLWIDTH, SAVE_FILELISTHEIGHT ); - Border = TRUE; - TabStop = TRUE; - }; - FixedLine FL_SAVE_BOTTOM - { - Pos = MAP_APPFONT( 0 , SAVE_ROW7 ); - Size = MAP_APPFONT( SAVE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - }; - OKButton BT_SAVE_OK - { - Pos = MAP_APPFONT( SAVE_COL1 , SAVE_ROW8 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - DefButton = TRUE; - }; -}; - ModalDialog RID_SVX_MDLG_DOCRECOVERY_PROGR { Size = MAP_APPFONT( SAVEPROGR_WIDTH, SAVEPROGR_HEIGHT ); |