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

convert accept license dialog to .ui

Change-Id: Ib36f42d65ef73446320823775accc94016afb13a
üst 3535fa12
......@@ -12,6 +12,7 @@ $(eval $(call gb_UIConfig_UIConfig,desktop))
$(eval $(call gb_UIConfig_add_uifiles,desktop,\
desktop/uiconfig/ui/cmdlinehelp \
desktop/uiconfig/ui/extensionmanager \
desktop/uiconfig/ui/licensedialog \
desktop/uiconfig/ui/showlicensedialog \
))
......
......@@ -33,20 +33,6 @@
#define RID_EM_FT_PROGRESS 14
#define RID_EM_FT_MSG 15
// local RIDs:
#define PB_LICENSE_DOWN 50
#define ML_LICENSE 51
#define BTN_LICENSE_DECLINE 53
#define FT_LICENSE_HEADER 54
#define FT_LICENSE_BODY_1 55
#define FT_LICENSE_BODY_1_TXT 56
#define FT_LICENSE_BODY_2 57
#define FT_LICENSE_BODY_2_TXT 58
#define FL_LICENSE 69
#define FI_LICENSE_ARROW1 60
#define FI_LICENSE_ARROW2 61
#define BTN_LICENSE_ACCEPT 63
// local RIDs for "Download and Install" dialog
#define RID_DLG_UPDATE_INSTALL_ABORT 2
......@@ -154,8 +140,6 @@
#define RID_WARNINGBOX_ENABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+105)
#define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106)
#define RID_DLG_LICENSE RID_DEPLOYMENT_LICENSE_START
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -122,179 +122,6 @@ String RID_STR_SHOW_LICENSE_CMD
Text [ en-US ] = "Show license";
};
// Dialog layout
// ---------------------------------------------------
// row 1 | multi line edit
// ---------------------------------------------------
// row 2 | fixed text
// ---------------------------------------------------
// row 3 | img | fixed text | fixed text | button
// ----------------------------------------------------
// row 4 | img | fixed text | fixed text
// ---------------------------------------------------
// row 5 |fixed line
// ---------------------------------------------------
// row 6 | | |button | button
// ---------------------------------------------------
// | col 1 | col 2 | col3 | col4 | col5
//To change the overall size of the multi line edit change
//ROW1_HEIGHT and COL3_WIDTH
#define ROW1_Y RSC_SP_DLG_INNERBORDER_TOP
#define ROW1_HEIGHT 16*RSC_CD_FIXEDTEXT_HEIGHT
#define ROW2_Y ROW1_Y+ROW1_HEIGHT+RSC_SP_CTRL_GROUP_Y
#define ROW2_HEIGHT 3*RSC_CD_FIXEDTEXT_HEIGHT
#define ROW3_Y ROW2_Y+ROW2_HEIGHT+RSC_SP_CTRL_GROUP_Y
#define ROW3_HEIGHT 3*RSC_CD_FIXEDTEXT_HEIGHT
#define ROW4_Y ROW3_Y+ROW3_HEIGHT+RSC_SP_CTRL_GROUP_Y
#define ROW4_HEIGHT 3*RSC_CD_FIXEDTEXT_HEIGHT
#define ROW5_Y ROW4_Y+ROW4_HEIGHT+RSC_SP_CTRL_GROUP_Y
#define ROW5_HEIGHT RSC_CD_FIXEDTEXT_HEIGHT
#define ROW6_Y ROW5_Y+ROW5_HEIGHT+RSC_SP_CTRL_GROUP_Y
#define ROW6_HEIGHT RSC_CD_PUSHBUTTON_HEIGHT
#define LIC_DLG_HEIGHT ROW6_Y+ROW6_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM
#define COL1_X RSC_SP_DLG_INNERBORDER_LEFT
#define IMG_ARROW_WIDTH 16
#define COL1_WIDTH IMG_ARROW_WIDTH
#define COL2_X COL1_X+COL1_WIDTH
#define COL2_WIDTH 10
#define COL3_X COL2_X+COL2_WIDTH+RSC_SP_CTRL_GROUP_X
#define COL3_WIDTH 150
#define COL4_X COL3_X+COL3_WIDTH
#define COL4_WIDTH RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_CTRL_GROUP_X
#define COL5_X COL4_X+COL4_WIDTH
#define LIC_DLG_WIDTH COL5_X+RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_DLG_INNERBORDER_RIGHT
#define BODYWIDTH LIC_DLG_WIDTH-RSC_SP_DLG_INNERBORDER_LEFT-RSC_SP_DLG_INNERBORDER_RIGHT
ModalDialog RID_DLG_LICENSE
{
HelpID = "desktop:ModalDialog:RID_DLG_LICENSE";
Text [ en-US ] = "Extension Software License Agreement";
Size = MAP_APPFONT(LIC_DLG_WIDTH, LIC_DLG_HEIGHT);
OutputSize = TRUE;
SVLook = TRUE;
Moveable = TRUE;
Closeable = TRUE;
Sizeable = FALSE;
MultiLineEdit ML_LICENSE
{
HelpID = "desktop:MultiLineEdit:RID_DLG_LICENSE:ML_LICENSE";
Pos = MAP_APPFONT(COL1_X, ROW1_Y);
Size = MAP_APPFONT(BODYWIDTH, ROW1_HEIGHT);
Border = TRUE;
VScroll = TRUE;
ReadOnly = TRUE;
};
FixedText FT_LICENSE_HEADER
{
Pos = MAP_APPFONT(COL1_X, ROW2_Y);
Size = MAP_APPFONT(COL1_WIDTH+COL2_WIDTH+COL3_WIDTH+COL4_WIDTH, ROW2_HEIGHT);
WordBreak = TRUE;
NoLabel = TRUE;
Text [ en-US ] = "Please follow these steps to proceed with the installation of the extension:";
};
FixedText FT_LICENSE_BODY_1
{
Pos = MAP_APPFONT(COL2_X, ROW3_Y);
Size = MAP_APPFONT( COL2_WIDTH, ROW3_HEIGHT );
NoLabel = TRUE;
Text [ en-US ] = "1.";
};
//spans col3 + col4
FixedText FT_LICENSE_BODY_1_TXT
{
Pos = MAP_APPFONT(COL3_X, ROW3_Y);
Size = MAP_APPFONT(COL3_WIDTH+COL4_WIDTH, ROW3_HEIGHT);
WordBreak = TRUE;
NoLabel = TRUE;
Text [ en-US ] = "Read the complete License Agreement. Use the scroll bar or the 'Scroll Down' button in this dialog to view the entire license text.";
};
FixedText FT_LICENSE_BODY_2
{
Pos = MAP_APPFONT(COL2_X, ROW4_Y);
Size = MAP_APPFONT(COL2_WIDTH, ROW4_HEIGHT);
NoLabel = TRUE;
Text [ en-US ] = "2.";
};
FixedText FT_LICENSE_BODY_2_TXT
{
Pos = MAP_APPFONT(COL3_X, ROW4_Y);
Size = MAP_APPFONT(COL3_WIDTH+COL4_WIDTH, ROW4_HEIGHT);
WordBreak = TRUE;
NoLabel = TRUE;
Text [ en-US ] = "Accept the License Agreement for the extension by pressing the 'Accept' button.";
};
PushButton PB_LICENSE_DOWN
{
HelpID = "desktop:PushButton:RID_DLG_LICENSE:PB_LICENSE_DOWN";
TabStop = TRUE ;
Pos = MAP_APPFONT(COL5_X , ROW3_Y) ;
Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT) ;
Text [ en-US ] = "~Scroll Down";
};
FixedLine FL_LICENSE
{
Pos = MAP_APPFONT ( 0, ROW5_Y) ;
Size = MAP_APPFONT ( LIC_DLG_WIDTH, ROW5_HEIGHT ) ;
};
FixedImage FI_LICENSE_ARROW1
{
Pos = MAP_APPFONT (COL1_X, ROW3_Y) ;
Size = (16, 16);
Fixed = Image
{
ImageBitmap = Bitmap { File = "sc06300.png"; };
MASKCOLOR
};
};
FixedImage FI_LICENSE_ARROW2
{
Pos = MAP_APPFONT (COL1_X, ROW4_Y) ;
Size = (16,16);
Fixed = Image
{
ImageBitmap = Bitmap { File = "sc06300.png"; };
MASKCOLOR
};
};
OKButton BTN_LICENSE_ACCEPT
{
Pos = MAP_APPFONT(COL4_X, ROW6_Y);
Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
TabStop = TRUE;
DefButton = TRUE;
Text [ en-US ] = "Accept";
};
CancelButton BTN_LICENSE_DECLINE
{
Pos = MAP_APPFONT(COL5_X, ROW6_Y);
Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
Text [ en-US ] = "Decline" ;
TabStop = TRUE;
};
};
WarningBox RID_WARNINGBOX_INSTALL_EXTENSION {
Buttons = WB_OK_CANCEL;
DefButton = WB_DEF_OK;
......
......@@ -56,7 +56,7 @@ class LicenseView : public MultiLineEdit, public SfxListener
Link maScrolledHdl;
public:
LicenseView( Window* pParent, const ResId& rResId );
LicenseView( Window* pParent, WinBits nStyle );
~LicenseView();
void ScrollDown( ScrollType eScroll );
......@@ -80,28 +80,23 @@ protected:
struct LicenseDialogImpl : public ModalDialog
{
cssu::Reference<cssu::XComponentContext> m_xComponentContext;
FixedText m_ftHead;
FixedText m_ftBody1;
FixedText m_ftBody1Txt;
FixedText m_ftBody2;
FixedText m_ftBody2Txt;
FixedImage m_fiArrow1;
FixedImage m_fiArrow2;
LicenseView m_mlLicense;
PushButton m_pbDown;
FixedLine m_flBottom;
OKButton m_acceptButton;
CancelButton m_declineButton;
FixedText* m_pFtHead;
FixedImage* m_pArrow1;
FixedImage* m_pArrow2;
LicenseView* m_pLicense;
PushButton* m_pDown;
PushButton* m_pAcceptButton;
PushButton* m_pDeclineButton;
DECL_LINK(PageDownHdl, void *);
DECL_LINK(ScrolledHdl, void *);
DECL_LINK(EndReachedHdl, void *);
DECL_LINK(CancelHdl, void *);
DECL_LINK(AcceptHdl, void *);
bool m_bLicenseRead;
virtual ~LicenseDialogImpl();
LicenseDialogImpl(
Window * pParent,
css::uno::Reference< css::uno::XComponentContext > const & xContext,
......@@ -112,14 +107,23 @@ struct LicenseDialogImpl : public ModalDialog
};
LicenseView::LicenseView( Window* pParent, const ResId& rResId )
: MultiLineEdit( pParent, rResId )
LicenseView::LicenseView( Window* pParent, WinBits nStyle )
: MultiLineEdit( pParent, nStyle )
{
SetLeftMargin( 5 );
mbEndReached = IsEndReached();
StartListening( *GetTextEngine() );
}
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeLicenseView(Window *pParent, VclBuilder::stringmap &rMap)
{
WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT;
OString sBorder = VclBuilder::extractCustomProperty(rMap);
if (!sBorder.isEmpty())
nWinStyle |= WB_BORDER;
return new LicenseView(pParent, nWinStyle | WB_VSCROLL);
}
LicenseView::~LicenseView()
{
maEndReachedHdl = Link();
......@@ -184,45 +188,51 @@ LicenseDialogImpl::LicenseDialogImpl(
Window * pParent,
cssu::Reference< cssu::XComponentContext > const & xContext,
const OUString & sExtensionName,
const OUString & sLicenseText):
ModalDialog(pParent, DpGuiResId(RID_DLG_LICENSE))
,m_xComponentContext(xContext)
,m_ftHead(this, DpGuiResId(FT_LICENSE_HEADER))
,m_ftBody1(this, DpGuiResId(FT_LICENSE_BODY_1))
,m_ftBody1Txt(this, DpGuiResId(FT_LICENSE_BODY_1_TXT))
,m_ftBody2(this, DpGuiResId(FT_LICENSE_BODY_2))
,m_ftBody2Txt(this, DpGuiResId(FT_LICENSE_BODY_2_TXT))
,m_fiArrow1(this, DpGuiResId(FI_LICENSE_ARROW1))
,m_fiArrow2(this, DpGuiResId(FI_LICENSE_ARROW2))
,m_mlLicense(this, DpGuiResId(ML_LICENSE))
,m_pbDown(this, DpGuiResId(PB_LICENSE_DOWN))
,m_flBottom(this, DpGuiResId(FL_LICENSE))
,m_acceptButton(this, DpGuiResId(BTN_LICENSE_ACCEPT))
,m_declineButton(this, DpGuiResId(BTN_LICENSE_DECLINE))
,m_bLicenseRead(false)
const OUString & sLicenseText)
: ModalDialog(pParent, "LicenseDialog", "desktop/ui/licensedialog.ui")
, m_xComponentContext(xContext)
, m_bLicenseRead(false)
{
FreeResource();
m_acceptButton.SetUniqueId(UID_BTN_LICENSE_ACCEPT);
m_fiArrow1.Show(true);
m_fiArrow2.Show(false);
m_mlLicense.SetText(sLicenseText);
m_ftHead.SetText(m_ftHead.GetText() + OUString('\n') + sExtensionName);
m_mlLicense.SetEndReachedHdl( LINK(this, LicenseDialogImpl, EndReachedHdl) );
m_mlLicense.SetScrolledHdl( LINK(this, LicenseDialogImpl, ScrolledHdl) );
m_pbDown.SetClickHdl( LINK(this, LicenseDialogImpl, PageDownHdl) );
get(m_pFtHead, "head");
get(m_pArrow1, "arrow1");
get(m_pArrow2, "arrow2");
get(m_pDown, "down");
get(m_pAcceptButton, "accept");
get(m_pDeclineButton, "decline");
m_pArrow1->Show(true);
m_pArrow2->Show(false);
get(m_pLicense, "textview");
Size aSize(m_pLicense->LogicToPixel(Size(290, 170), MAP_APPFONT));
m_pLicense->set_width_request(aSize.Width());
m_pLicense->set_height_request(aSize.Height());
m_pLicense->SetText(sLicenseText);
m_pFtHead->SetText(m_pFtHead->GetText() + "\n" + sExtensionName);
m_pAcceptButton->SetClickHdl( LINK(this, LicenseDialogImpl, AcceptHdl) );
m_pDeclineButton->SetClickHdl( LINK(this, LicenseDialogImpl, CancelHdl) );
m_pLicense->SetEndReachedHdl( LINK(this, LicenseDialogImpl, EndReachedHdl) );
m_pLicense->SetScrolledHdl( LINK(this, LicenseDialogImpl, ScrolledHdl) );
m_pDown->SetClickHdl( LINK(this, LicenseDialogImpl, PageDownHdl) );
// We want a automatic repeating page down button
WinBits aStyle = m_pbDown.GetStyle();
WinBits aStyle = m_pDown->GetStyle();
aStyle |= WB_REPEAT;
m_pbDown.SetStyle( aStyle );
m_pDown->SetStyle( aStyle );
}
LicenseDialogImpl::~LicenseDialogImpl()
IMPL_LINK_NOARG(LicenseDialogImpl, AcceptHdl)
{
EndDialog(true);
return 0;
}
IMPL_LINK_NOARG(LicenseDialogImpl, CancelHdl)
{
EndDialog(false);
return 0;
}
void LicenseDialogImpl::Activate()
......@@ -230,17 +240,17 @@ void LicenseDialogImpl::Activate()
if (!m_bLicenseRead)
{
//Only enable the scroll down button if the license text does not fit into the window
if (m_mlLicense.IsEndReached())
if (m_pLicense->IsEndReached())
{
m_pbDown.Disable();
m_acceptButton.Enable();
m_acceptButton.GrabFocus();
m_pDown->Disable();
m_pAcceptButton->Enable();
m_pAcceptButton->GrabFocus();
}
else
{
m_pbDown.Enable();
m_pbDown.GrabFocus();
m_acceptButton.Disable();
m_pDown->Enable();
m_pDown->GrabFocus();
m_pAcceptButton->Disable();
}
}
}
......@@ -248,26 +258,26 @@ void LicenseDialogImpl::Activate()
IMPL_LINK_NOARG(LicenseDialogImpl, ScrolledHdl)
{
if (m_mlLicense.IsEndReached())
m_pbDown.Disable();
if (m_pLicense->IsEndReached())
m_pDown->Disable();
else
m_pbDown.Enable();
m_pDown->Enable();
return 0;
}
IMPL_LINK_NOARG(LicenseDialogImpl, PageDownHdl)
{
m_mlLicense.ScrollDown( SCROLL_PAGEDOWN );
m_pLicense->ScrollDown( SCROLL_PAGEDOWN );
return 0;
}
IMPL_LINK_NOARG(LicenseDialogImpl, EndReachedHdl)
{
m_acceptButton.Enable();
m_acceptButton.GrabFocus();
m_fiArrow1.Show(false);
m_fiArrow2.Show(true);
m_pAcceptButton->Enable();
m_pAcceptButton->GrabFocus();
m_pArrow1->Show(false);
m_pArrow2->Show(true);
m_bLicenseRead = true;
return 0;
}
......
......@@ -25,7 +25,6 @@
#define HID_FIRSTSTART_CANCEL "DESKTOP_HID_FIRSTSTART_CANCEL"
#define HID_FIRSTSTART_FINISH "DESKTOP_HID_FIRSTSTART_FINISH"
#define UID_FIRSTSTART_HELP "DESKTOP_UID_FIRSTSTART_HELP"
#define UID_BTN_LICENSE_ACCEPT "DESKTOP_UID_BTN_LICENSE_ACCEPT"
#define HID_DEPLOYMENT_GUI_UPDATE "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE"
#define HID_DEPLOYMENT_GUI_UPDATEINSTALL "DESKTOP_HID_DEPLOYMENT_GUI_UPDATEINSTALL"
#define HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER"
......
This diff is collapsed.
......@@ -48,7 +48,7 @@
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="textview">
<object class="GtkTextView" id="textview:border">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
......
......@@ -275,6 +275,9 @@
<glade-widget-class title="Address MultiLine Edit" name="swuilo-AddressMultiLineEdit"
generic-name="AddressMultiLineEdit" parent="GtkTextView"
icon-name="widget-gtk-textview"/>
<glade-widget-class title="LicenseView" name="deploymentgui-LicenseView"
generic-name="LicenseView" parent="GtkTextView"
icon-name="widget-gtk-textview"/>
<glade-widget-class title="ValueSet" name="svtlo-ValueSet"
generic-name="Set of Value Options" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
......
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