Kaydet (Commit) 111fd6d0 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Make about dialog display clickable hyperlink for credits

Added a svt::FixedHyperlink to the about dialog, so people can
click on something to get to the credits page.
üst 3973845d
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <svtools/svmedit.hxx> #include <svtools/svmedit.hxx>
#include <tools/list.hxx> #include <tools/list.hxx>
#include <svtools/stdctrl.hxx> #include <svtools/stdctrl.hxx>
#include "svtools/fixedhyper.hxx"
#include <sfx2/basedlgs.hxx> // SfxModalDialog #include <sfx2/basedlgs.hxx> // SfxModalDialog
DECLARE_LIST( AccelList, Accelerator* ) DECLARE_LIST( AccelList, Accelerator* )
...@@ -48,8 +49,8 @@ private: ...@@ -48,8 +49,8 @@ private:
Image aAppLogo; Image aAppLogo;
MultiLineEdit aVersionText; MultiLineEdit aVersionText;
MultiLineEdit aCopyrightText; MultiLineEdit aCopyrightText;
FixedInfo aBuildData; svt::FixedHyperlink aInfoLink;
ResStringArray aDeveloperAry; ResStringArray aDeveloperAry;
String aDevVersionStr; String aDevVersionStr;
...@@ -57,6 +58,7 @@ private: ...@@ -57,6 +58,7 @@ private:
String aVersionData; String aVersionData;
String aVersionTextStr; String aVersionTextStr;
String aCopyrightTextStr; String aCopyrightTextStr;
String aLinkStr;
AccelList aAccelList; AccelList aAccelList;
...@@ -77,6 +79,7 @@ public: ...@@ -77,6 +79,7 @@ public:
DECL_LINK( TimerHdl, Timer * ); DECL_LINK( TimerHdl, Timer * );
DECL_LINK( AccelSelectHdl, Accelerator * ); DECL_LINK( AccelSelectHdl, Accelerator * );
DECL_LINK( HandleHyperlink, svt::FixedHyperlink * );
}; };
#endif // #ifndef _ABOUT_HXX #endif // #ifndef _ABOUT_HXX
......
...@@ -212,12 +212,14 @@ ...@@ -212,12 +212,14 @@
#define ABOUT_FTXT_VERSION 1 #define ABOUT_FTXT_VERSION 1
#define ABOUT_FTXT_COPYRIGHT 2 #define ABOUT_FTXT_COPYRIGHT 2
#define ABOUT_FTXT_LINK 3
#define ABOUT_STR_DEVELOPER_ARY 1 #define ABOUT_STR_DEVELOPER_ARY 1
#define ABOUT_STR_FRENCH_COPYRIGHT 2 #define ABOUT_STR_FRENCH_COPYRIGHT 2
#define ABOUT_STR_ACCEL 3 #define ABOUT_STR_ACCEL 3
#define ABOUT_STR_VERSION 4 #define ABOUT_STR_VERSION 4
#define ABOUT_STR_COPYRIGHT 5 #define ABOUT_STR_COPYRIGHT 5
#define ABOUT_STR_LINK 6
#define RID_APPTITLE (RID_SFX_START+4) #define RID_APPTITLE (RID_SFX_START+4)
#define RID_BUILDVERSION (RID_SFX_START+5) #define RID_BUILDVERSION (RID_SFX_START+5)
......
...@@ -45,6 +45,13 @@ ...@@ -45,6 +45,13 @@
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
#include <svtools/filter.hxx> #include <svtools/filter.hxx>
#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
#include "com/sun/star/system/XSystemShellExecute.hpp"
#include <comphelper/processfactory.hxx>
#include "comphelper/anytostring.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "cppuhelper/bootstrap.hxx"
#include <sfx2/sfxuno.hxx> #include <sfx2/sfxuno.hxx>
#include "about.hxx" #include "about.hxx"
#include "sfxresid.hxx" #include "sfxresid.hxx"
...@@ -53,6 +60,8 @@ ...@@ -53,6 +60,8 @@
#include "dialog.hrc" #include "dialog.hrc"
using namespace ::com::sun::star;
// defines --------------------------------------------------------------- // defines ---------------------------------------------------------------
#define SCROLL_OFFSET 1 #define SCROLL_OFFSET 1
...@@ -76,13 +85,13 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS ...@@ -76,13 +85,13 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS
aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ), aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ),
aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ),
aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ),
// FIXME: What is the purpose of the aBuildData when it is not connected to any widget? aInfoLink ( this, ResId( ABOUT_FTXT_LINK, *rId.GetResMgr() ) ),
aBuildData ( this ),
aDeveloperAry ( ResId( ABOUT_STR_DEVELOPER_ARY, *rId.GetResMgr() ) ), aDeveloperAry ( ResId( ABOUT_STR_DEVELOPER_ARY, *rId.GetResMgr() ) ),
aDevVersionStr ( rVerStr ), aDevVersionStr ( rVerStr ),
aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ), aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ),
aVersionTextStr( ResId( ABOUT_STR_VERSION, *rId.GetResMgr() ) ), aVersionTextStr( ResId( ABOUT_STR_VERSION, *rId.GetResMgr() ) ),
aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ), aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ),
aLinkStr ( ResId( ABOUT_STR_LINK, *rId.GetResMgr() ) ),
aTimer (), aTimer (),
nOff ( 0 ), nOff ( 0 ),
m_nDeltaWidth ( 0 ), m_nDeltaWidth ( 0 ),
...@@ -147,24 +156,13 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS ...@@ -147,24 +156,13 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS
aVersionText.SetBackground(); aVersionText.SetBackground();
aCopyrightText.SetBackground(); aCopyrightText.SetBackground();
aInfoLink.SetURL( aLinkStr );
aInfoLink.SetBackground();
aInfoLink.SetClickHdl( LINK( this, AboutDialog, HandleHyperlink ) );
Color aTextColor( rSettings.GetWindowTextColor() ); Color aTextColor( rSettings.GetWindowTextColor() );
aVersionText.SetControlForeground( aTextColor ); aVersionText.SetControlForeground( aTextColor );
aCopyrightText.SetControlForeground( aTextColor ); aCopyrightText.SetControlForeground( aTextColor );
aBuildData.SetBackground( aWall );
Font aSmallFont = rSettings.GetInfoFont();
Size aSmaller = aNewFont.GetSize();
aSmaller.Width() = (long) (aSmaller.Width() * 0.75);
aSmaller.Height() = (long) (aSmaller.Height() * 0.75);
aNewFont.SetSize( aSmaller );
aBuildData.SetFont( aNewFont );
aBuildData.SetBackground( aWall );
// FIXME: What is the purpose of the build data?
// they are not showed even when set, so???
String aBuildDataString;
aBuildData.SetText( aBuildDataString );
aBuildData.Show();
aCopyrightText.SetText( aCopyrightTextStr ); aCopyrightText.SetText( aCopyrightTextStr );
...@@ -197,17 +195,29 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS ...@@ -197,17 +195,29 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS
Size aOKSiz = aOKButton.GetSizePixel(); Size aOKSiz = aOKButton.GetSizePixel();
Point aOKPnt = aOKButton.GetPosPixel(); Point aOKPnt = aOKButton.GetPosPixel();
// FixedHyperlink with more info link
Point aLinkPnt = aInfoLink.GetPosPixel();
Size aLinkSize = aInfoLink.GetSizePixel();
// Multiline edit with Copyright-Text // Multiline edit with Copyright-Text
Point aCopyPnt = aCopyrightText.GetPosPixel(); Point aCopyPnt = aCopyrightText.GetPosPixel();
Size aCopySize = aCopyrightText.GetSizePixel(); Size aCopySize = aCopyrightText.GetSizePixel();
aCopySize.Width() = nTextWidth; aCopySize.Width() = nTextWidth;
aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - nCtrlMargin; aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - 3*aLinkSize.Height() - nCtrlMargin;
aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2;
aCopyPnt.Y() = nY; aCopyPnt.Y() = nY;
aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize );
nY += aCopySize.Height() + nCtrlMargin; nY += aCopySize.Height() + aLinkSize.Height();
aLinkSize.Width() = aInfoLink.CalcMinimumSize().Width();
aLinkPnt.X() = ( aOutSiz.Width() - aLinkSize.Width() ) / 2;
aLinkPnt.Y() = nY;
aInfoLink.SetPosSizePixel( aLinkPnt, aLinkSize );
nY += aLinkSize.Height() + nCtrlMargin;
aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2;
aOKPnt.Y() = nY; aOKPnt.Y() = nY;
aOKButton.SetPosPixel( aOKPnt ); aOKButton.SetPosPixel( aOKPnt );
...@@ -276,6 +286,35 @@ IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator ) ...@@ -276,6 +286,35 @@ IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
{
rtl::OUString sURL=pHyperlink->GetURL();
rtl::OUString sTitle=GetText();
if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty
return 1;
try
{
uno::Reference< system::XSystemShellExecute > xSystemShellExecute(
::comphelper::getProcessServiceFactory()->createInstance(
DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW );
xSystemShellExecute->execute( sURL, rtl::OUString(), system::SystemShellExecuteFlags::DEFAULTS );
}
catch ( uno::Exception& )
{
uno::Any exc( ::cppu::getCaughtException() );
rtl::OUString msg( ::comphelper::anyToString( exc ) );
const ::vos::OGuard guard( Application::GetSolarMutex() );
ErrorBox aErrorBox( NULL, WB_OK, msg );
aErrorBox.SetText( sTitle );
aErrorBox.Execute();
}
return 1;
}
// -----------------------------------------------------------------------
BOOL AboutDialog::Close() BOOL AboutDialog::Close()
{ {
// stop Timer and finish the dialog // stop Timer and finish the dialog
......
...@@ -37,6 +37,7 @@ TARGET=dialog ...@@ -37,6 +37,7 @@ TARGET=dialog
# --- Files -------------------------------------------------------------- # --- Files --------------------------------------------------------------
EXCEPTIONSFILES=\ EXCEPTIONSFILES=\
$(SLO)$/about.obj \
$(SLO)$/filedlghelper.obj \ $(SLO)$/filedlghelper.obj \
$(SLO)$/filtergrouping.obj \ $(SLO)$/filtergrouping.obj \
$(SLO)$/itemconnect.obj \ $(SLO)$/itemconnect.obj \
...@@ -50,7 +51,6 @@ EXCEPTIONSFILES=\ ...@@ -50,7 +51,6 @@ EXCEPTIONSFILES=\
SLOFILES =\ SLOFILES =\
$(EXCEPTIONSFILES) \ $(EXCEPTIONSFILES) \
$(SLO)$/about.obj \
$(SLO)$/alienwarn.obj \ $(SLO)$/alienwarn.obj \
$(SLO)$/basedlgs.obj \ $(SLO)$/basedlgs.obj \
$(SLO)$/dinfedt.obj \ $(SLO)$/dinfedt.obj \
......
...@@ -93,13 +93,25 @@ ModalDialog RID_DEFAULTABOUT ...@@ -93,13 +93,25 @@ ModalDialog RID_DEFAULTABOUT
ReadOnly = TRUE ; ReadOnly = TRUE ;
AutoVScroll = TRUE ; AutoVScroll = TRUE ;
}; };
FixedText ABOUT_FTXT_LINK
{
NoLabel = TRUE;
TabStop = TRUE;
Text [ en-US ] = "Contributor credits";
Pos = MAP_APPFONT ( 54 , 80 ) ;
Size = MAP_APPFONT ( 168 , 10 ) ;
};
String ABOUT_STR_VERSION String ABOUT_STR_VERSION
{ {
Text[ en-US ] = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION"; Text[ en-US ] = "%PRODUCTNAME %ABOUTBOXPRODUCTVERSION %PRODUCTEXTENSION";
}; };
String ABOUT_STR_COPYRIGHT String ABOUT_STR_COPYRIGHT
{ {
Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by %OOOVENDOR, based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, especially those mentioned at\n http://www.openoffice.org/welcome/credits.html."; Text[ en-US ] = "Copyright © 2000, 2010 Oracle and/or its affiliates. All rights reserved.\nThis product was created by %OOOVENDOR, based on OpenOffice.org.\nOpenOffice.org acknowledges all community members, please find more info at the link below.";
};
String ABOUT_STR_LINK
{
Text[ en-US ] = "http://www.openoffice.org/welcome/credits.html";
}; };
StringArray ABOUT_STR_DEVELOPER_ARY StringArray ABOUT_STR_DEVELOPER_ARY
{ {
......
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