Kaydet (Commit) 1413d6bc authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst e5cc4e24
...@@ -1008,7 +1008,6 @@ ...@@ -1008,7 +1008,6 @@
#define RID_SVX_TABDLG_DOCRECOVERY ( RID_SVX_START + 0 ) #define RID_SVX_TABDLG_DOCRECOVERY ( RID_SVX_START + 0 )
#define RID_SVXPAGE_DOCRECOVERY_SAVE ( RID_SVX_START + 8 )
#define RID_SVXPAGE_DOCRECOVERY_RECOVER ( RID_SVX_START + 9 ) #define RID_SVXPAGE_DOCRECOVERY_RECOVER ( RID_SVX_START + 9 )
// !!!! double defined ID's (see below) !!! // !!!! double defined ID's (see below) !!!
......
...@@ -23,6 +23,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ ...@@ -23,6 +23,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/compressgraphicdialog \ svx/uiconfig/ui/compressgraphicdialog \
svx/uiconfig/ui/deleteheaderdialog \ svx/uiconfig/ui/deleteheaderdialog \
svx/uiconfig/ui/deletefooterdialog \ svx/uiconfig/ui/deletefooterdialog \
svx/uiconfig/ui/docrecoverysavedialog \
svx/uiconfig/ui/extrustiondepthdialog \ svx/uiconfig/ui/extrustiondepthdialog \
svx/uiconfig/ui/findreplacedialog \ svx/uiconfig/ui/findreplacedialog \
svx/uiconfig/ui/fontworkgallerydialog \ svx/uiconfig/ui/fontworkgallerydialog \
......
...@@ -136,8 +136,6 @@ ...@@ -136,8 +136,6 @@
#define HID_SVX_MDLG_DOCRECOVERY_PROGR "SVX_HID_SVX_MDLG_DOCRECOVERY_PROGR" #define HID_SVX_MDLG_DOCRECOVERY_PROGR "SVX_HID_SVX_MDLG_DOCRECOVERY_PROGR"
#define HID_SVX_TABDLG_DOCRECOVERY "SVX_HID_SVX_TABDLG_DOCRECOVERY" #define HID_SVX_TABDLG_DOCRECOVERY "SVX_HID_SVX_TABDLG_DOCRECOVERY"
#define HID_SVX_TP_DOCRECOVERY_RECOVER "SVX_HID_SVX_TP_DOCRECOVERY_RECOVER" #define HID_SVX_TP_DOCRECOVERY_RECOVER "SVX_HID_SVX_TP_DOCRECOVERY_RECOVER"
#define HID_SVX_TP_DOCRECOVERY_SAVE "SVX_HID_SVX_TP_DOCRECOVERY_SAVE"
#define HID_VALUESET_EXTRUSION_DIRECTION "SVX_HID_VALUESET_EXTRUSION_DIRECTION" #define HID_VALUESET_EXTRUSION_DIRECTION "SVX_HID_VALUESET_EXTRUSION_DIRECTION"
#define HID_VALUESET_EXTRUSION_LIGHTING "SVX_HID_VALUESET_EXTRUSION_LIGHTING" #define HID_VALUESET_EXTRUSION_LIGHTING "SVX_HID_VALUESET_EXTRUSION_LIGHTING"
#define HID_XMLSEC_CALL "SVX_HID_XMLSEC_CALL" #define HID_XMLSEC_CALL "SVX_HID_XMLSEC_CALL"
......
...@@ -678,20 +678,15 @@ void SAL_CALL PluginProgress::reset() ...@@ -678,20 +678,15 @@ void SAL_CALL PluginProgress::reset()
} }
SaveDialog::SaveDialog(Window* pParent, SaveDialog::SaveDialog(Window* pParent, RecoveryCore* pCore)
RecoveryCore* pCore ) : Dialog(pParent, "DocRecoverySaveDialog", "svx/ui/docrecoverysavedialog.ui")
: IExtendedTabPage( pParent, SVX_RES( RID_SVXPAGE_DOCRECOVERY_SAVE ) ) , m_pCore(pCore)
, 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 )
{ {
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. // Prepare the office for the following crash save step.
// E.g. hide all open widows so the user can't influence our // E.g. hide all open widows so the user can't influence our
...@@ -699,19 +694,14 @@ SaveDialog::SaveDialog(Window* pParent, ...@@ -699,19 +694,14 @@ SaveDialog::SaveDialog(Window* pParent,
m_pCore->doEmergencySavePrepare(); m_pCore->doEmergencySavePrepare();
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Wallpaper aBackground(rStyleSettings.GetWindowColor()); m_pTitleFT->SetBackground(rStyleSettings.GetWindowColor());
m_aTitleWin.SetBackground(aBackground); m_pTitleFT->set_height_request(m_pTitleFT->get_preferred_size().Height() + 48);
m_aTitleFT.SetBackground (aBackground);
Font aFont(m_aTitleFT.GetFont());
aFont.SetWeight(WEIGHT_BOLD);
m_aTitleFT.SetFont(aFont);
m_aOkBtn.SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) ); m_pOkBtn->SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) );
m_aFileListLB.SetControlBackground( rStyleSettings.GetDialogColor() ); m_pFileListLB->SetControlBackground( rStyleSettings.GetDialogColor() );
// fill listbox with current open documents // fill listbox with current open documents
m_aFileListLB.Clear(); m_pFileListLB->Clear();
TURLList* pURLs = m_pCore->getURLListAccess(); TURLList* pURLs = m_pCore->getURLListAccess();
TURLList::const_iterator pIt; TURLList::const_iterator pIt;
...@@ -721,54 +711,26 @@ SaveDialog::SaveDialog(Window* pParent, ...@@ -721,54 +711,26 @@ SaveDialog::SaveDialog(Window* pParent,
++pIt ) ++pIt )
{ {
const TURLInfo& rInfo = *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) 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 // start crash-save with progress
if (m_nResult == DLG_RET_OK) SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore);
{ short nResult = pProgress->Execute();
SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore); delete pProgress;
m_nResult = pProgress->Execute();
delete pProgress;
}
// if "CANCEL" => return "CANCEL" // if "CANCEL" => return "CANCEL"
// if "OK" => "AUTOLUNCH" always ! // if "OK" => "AUTOLUNCH" always !
if (m_nResult == DLG_RET_OK) if (nResult == DLG_RET_OK)
m_nResult = DLG_RET_OK_AUTOLUNCH; nResult = DLG_RET_OK_AUTOLUNCH;
return m_nResult; EndDialog(nResult);
} return 0;
void SaveDialog::setDefButton()
{
m_aOkBtn.GrabFocus();
} }
SaveProgressDialog::SaveProgressDialog(Window* pParent, SaveProgressDialog::SaveProgressDialog(Window* pParent,
RecoveryCore* pCore ) RecoveryCore* pCore )
: ModalDialog ( pParent , SVX_RES( RID_SVX_MDLG_DOCRECOVERY_PROGR ) ) : ModalDialog ( pParent , SVX_RES( RID_SVX_MDLG_DOCRECOVERY_PROGR ) )
......
...@@ -30,17 +30,6 @@ ...@@ -30,17 +30,6 @@
#define TABDLG_WIDTH 290 #define TABDLG_WIDTH 290
#define TABDLG_HEIGHT 238 #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_WIDTH 290
#define SAVE_HEIGHT 238 #define SAVE_HEIGHT 238
#define SAVE_TITLEWINHEIGHT 36 #define SAVE_TITLEWINHEIGHT 36
......
...@@ -33,63 +33,6 @@ TabDialog RID_SVX_TABDLG_DOCRECOVERY ...@@ -33,63 +33,6 @@ TabDialog RID_SVX_TABDLG_DOCRECOVERY
Text = "%PRODUCTNAME %PRODUCTVERSION"; 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 ModalDialog RID_SVX_MDLG_DOCRECOVERY_PROGR
{ {
Size = MAP_APPFONT( SAVEPROGR_WIDTH, SAVEPROGR_HEIGHT ); Size = MAP_APPFONT( SAVEPROGR_WIDTH, SAVEPROGR_HEIGHT );
......
...@@ -428,28 +428,17 @@ class TabDialog4Recovery : public TabDialog ...@@ -428,28 +428,17 @@ class TabDialog4Recovery : public TabDialog
}; };
class SaveDialog : public IExtendedTabPage class SaveDialog : public Dialog
{ {
// member // member
private: private:
FixedText* m_pTitleFT;
FixedText m_aTitleFT; ListBox* m_pFileListLB;
Window m_aTitleWin; OKButton* m_pOkBtn;
FixedLine m_aTitleFL;
FixedText m_aDescrFT;
FixedText m_aFileListFT;
ListBox m_aFileListLB;
FixedLine m_aBottomFL;
OKButton m_aOkBtn;
RecoveryCore* m_pCore; RecoveryCore* m_pCore;
// interface // interface
public: public:
/** @short create all child controls of this dialog. /** @short create all child controls of this dialog.
@descr The dialog isn't shown nor it starts any @descr The dialog isn't shown nor it starts any
...@@ -465,25 +454,11 @@ class SaveDialog : public IExtendedTabPage ...@@ -465,25 +454,11 @@ class SaveDialog : public IExtendedTabPage
and the current list of open documents, and the current list of open documents,
which should be shown inside this dialog. which should be shown inside this dialog.
*/ */
SaveDialog(Window* pParent, SaveDialog(Window* pParent, RecoveryCore* pCore);
RecoveryCore* pCore );
/** @short free all controls and used memory. */
virtual ~SaveDialog();
/** @short TODO*/
virtual short execute() SAL_OVERRIDE;
/** @short TODO*/
virtual void setDefButton() SAL_OVERRIDE;
DECL_LINK(OKButtonHdl, void*); DECL_LINK(OKButtonHdl, void*);
}; };
class SaveProgressDialog : public ModalDialog class SaveProgressDialog : public ModalDialog
, public IRecoveryUpdateListener , public IRecoveryUpdateListener
{ {
......
...@@ -274,29 +274,21 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL) ...@@ -274,29 +274,21 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL)
return m_eJob; return m_eJob;
} }
bool RecoveryUI::impl_doEmergencySave() bool RecoveryUI::impl_doEmergencySave()
{ {
// create core service, which implements the real "emergency save" algorithm. // create core service, which implements the real "emergency save" algorithm.
svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xContext, true); svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xContext, true);
css::uno::Reference< css::frame::XStatusListener > xCore(pCore); css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
// create all needed dialogs for this operation // create dialog for this operation and bind it to the used core service
// and bind it to the used core service Dialog* pDialog = new svxdr::SaveDialog(m_pParentWindow, pCore);
svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery(m_pParentWindow);
svxdr::IExtendedTabPage* pPage1 = new svxdr::SaveDialog (pWizard, pCore );
pWizard->addTabPage(pPage1);
// start the wizard
short nRet = pWizard->Execute();
delete pPage1 ;
delete pWizard;
// start the dialog
short nRet = pDialog->Execute();
delete pDialog;
return (nRet==DLG_RET_OK_AUTOLUNCH); return (nRet==DLG_RET_OK_AUTOLUNCH);
} }
void RecoveryUI::impl_doRecovery() void RecoveryUI::impl_doRecovery()
{ {
// create core service, which implements the real "emergency save" algorithm. // create core service, which implements the real "emergency save" algorithm.
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="DocRecoverySaveDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">%PRODUCTNAME %PRODUCTVERSION</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="bgrid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">24</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">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.</property>
<property name="wrap">True</property>
<property name="max_width_chars">87</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">The following files will be recovered:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">filelist:border</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="filelist:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="title">
<property name="name">12</property>
<property name="height_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">%PRODUCTNAME Document Recovery</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">ok</action-widget>
</action-widgets>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment