Kaydet (Commit) dbba8490 authored tarafından Michael Stahl's avatar Michael Stahl

remove that silly SfxInternetPage already

LibreOffice is not a web browser.

This reloading stuff apparently never even worked for editable documents
anyway, see i#50881.

Change-Id: I720fbb72fd93232ad3e6fdfc65a05748bdf78108
üst d2605c0b
......@@ -15,7 +15,6 @@ $(eval $(call gb_UI_add_uifiles,sfx,\
sfx2/uiconfig/ui/descriptioninfopage \
sfx2/uiconfig/ui/documentinfopage \
sfx2/uiconfig/ui/documentpropertiesdialog \
sfx2/uiconfig/ui/internetinfopage \
sfx2/uiconfig/ui/managestylepage \
sfx2/uiconfig/ui/optprintpage \
sfx2/uiconfig/ui/password \
......
......@@ -235,70 +235,6 @@ public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
};
// class SfxInternetPage -------------------------------------------------
namespace sfx2
{
class FileDialogHelper;
}
class SfxInternetPage : public SfxTabPage
{
private:
VclContainer* m_pContainer;
RadioButton* m_pRBNoAutoUpdate;
RadioButton* m_pRBReloadUpdate;
RadioButton* m_pRBForwardUpdate;
FixedText* m_pFTEvery;
NumericField* m_pNFReload;
FixedText* m_pFTReloadSeconds;
FixedText* m_pFTAfter;
NumericField* m_pNFAfter;
FixedText* m_pFTAfterSeconds;
FixedText* m_pFTURL;
Edit* m_pEDForwardURL;
PushButton* m_pPBBrowseURL;
FixedText* m_pFTFrame;
ComboBox* m_pCBFrame;
String aForwardErrorMessg;
String aBaseURL;
SfxDocumentInfoItem* pInfoItem;
sfx2::FileDialogHelper* pFileDlg;
enum STATE { S_Init, S_NoUpdate, S_Reload, S_Forward };
// S_Init is only valid as initial value
STATE eState;
void ChangeState( STATE eNewState ); // S_Init is not a valid value here
// also checks corresponding radiobutton
void EnableNoUpdate( sal_Bool bEnable );
void EnableReload( sal_Bool bEnable );
void EnableForward( sal_Bool bEnable );
DECL_LINK( ClickHdlNoUpdate, Control* );
DECL_LINK( ClickHdlReload, Control* );
DECL_LINK( ClickHdlForward, Control* );
DECL_LINK(ClickHdlBrowseURL, void *);
DECL_LINK(DialogClosedHdl, void *);
using TabPage::DeactivatePage;
protected:
SfxInternetPage( Window* pParent, const SfxItemSet& );
~SfxInternetPage();
virtual sal_Bool FillItemSet( SfxItemSet& );
virtual void Reset( const SfxItemSet& );
virtual int DeactivatePage( SfxItemSet* pSet = 0 );
public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& );
};
// class SfxDocumentInfoDialog -------------------------------------------
class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialog
......
......@@ -1105,330 +1105,6 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
m_pDeleteBtn->Enable( bEnableUseUserData );
}
//------------------------------------------------------------------------
SfxInternetPage::SfxInternetPage( Window* pParent, const SfxItemSet& rItemSet )
: SfxTabPage(pParent, "InternetInfoPage", "sfx/ui/internetinfopage.ui", rItemSet)
, aForwardErrorMessg(SFX2_RESSTR(RID_SVXSTR_FORWARD_ERRMSSG))
, pInfoItem(NULL)
, pFileDlg(NULL)
, eState(S_Init)
{
get(m_pContainer, "InternetInfoPage");
get(m_pRBNoAutoUpdate, "noautoupdate");
get(m_pRBReloadUpdate, "reloadupdate");
get(m_pRBForwardUpdate, "forwardupdate");
get(m_pFTEvery, "everyft");
get(m_pNFReload, "reloadnf");
get(m_pFTReloadSeconds, "seconds1ft");
get(m_pFTAfter, "afterft");
get(m_pNFAfter, "afternf");
get(m_pFTAfterSeconds, "seconds1ft");
get(m_pFTURL, "urlft");
get(m_pEDForwardURL, "forwarded");
get(m_pPBBrowseURL, "browse");
get(m_pFTFrame, "frameft");
get(m_pCBFrame, "framecb");
pInfoItem = &( SfxDocumentInfoItem& ) rItemSet.Get( SID_DOCINFO );
TargetList aList;
SfxViewFrame* pFrame = SfxViewFrame::Current();
if ( pFrame )
{
pFrame = pFrame->GetTopViewFrame();
if ( pFrame )
{
pFrame->GetTargetList( aList );
String* pObj;
for ( size_t nPos = aList.size() ; nPos ; )
{
pObj = aList[ --nPos ];
m_pCBFrame->InsertEntry( *pObj );
delete pObj;
}
}
}
m_pRBNoAutoUpdate->SetClickHdl( LINK( this, SfxInternetPage, ClickHdlNoUpdate ) );
m_pRBReloadUpdate->SetClickHdl( LINK( this, SfxInternetPage, ClickHdlReload ) );
m_pRBForwardUpdate->SetClickHdl( LINK( this, SfxInternetPage, ClickHdlForward ) );
m_pPBBrowseURL->SetClickHdl( LINK( this, SfxInternetPage, ClickHdlBrowseURL ) );
aForwardErrorMessg.SearchAndReplaceAscii("%PLACEHOLDER%", m_pRBForwardUpdate->GetText());
ChangeState( S_NoUpdate );
}
//------------------------------------------------------------------------
SfxInternetPage::~SfxInternetPage()
{
delete pFileDlg;
}
//------------------------------------------------------------------------
void SfxInternetPage::ChangeState( STATE eNewState )
{
DBG_ASSERT( eNewState != S_Init, "*SfxInternetPage::ChangeState(): new state init is supposed to not work here!" );
if ( eState == eNewState )
return;
switch ( eState )
{
case S_Init:
EnableNoUpdate( sal_True );
EnableReload( sal_False );
EnableForward( sal_False );
break;
case S_NoUpdate:
EnableNoUpdate( sal_False );
if( eNewState == S_Reload )
EnableReload( sal_True );
else
EnableForward( sal_True );
break;
case S_Reload:
EnableReload( sal_False );
if( eNewState == S_NoUpdate )
EnableNoUpdate( sal_True );
else
EnableForward( sal_True );
break;
case S_Forward:
EnableForward( sal_False );
if( eNewState == S_NoUpdate )
EnableNoUpdate( sal_True );
else
EnableReload( sal_True );
break;
default:
OSL_FAIL( "*SfxInternetPage::SetState(): unhandled state!" );
}
eState = eNewState;
}
//------------------------------------------------------------------------
void SfxInternetPage::EnableNoUpdate( sal_Bool bEnable )
{
if ( bEnable )
m_pRBNoAutoUpdate->Check();
}
//------------------------------------------------------------------------
void SfxInternetPage::EnableReload( sal_Bool bEnable )
{
m_pFTEvery->Enable( bEnable );
m_pNFReload->Enable( bEnable );
m_pFTReloadSeconds->Enable( bEnable );
if ( bEnable )
m_pRBReloadUpdate->Check();
}
//------------------------------------------------------------------------
void SfxInternetPage::EnableForward( sal_Bool bEnable )
{
m_pFTAfter->Enable( bEnable );
m_pNFAfter->Enable( bEnable );
m_pFTAfterSeconds->Enable( bEnable );
m_pFTURL->Enable( bEnable );
m_pEDForwardURL->Enable( bEnable );
m_pPBBrowseURL->Enable( bEnable );
m_pFTFrame->Enable( bEnable );
m_pCBFrame->Enable( bEnable );
if ( bEnable )
m_pRBForwardUpdate->Check();
}
//------------------------------------------------------------------------
IMPL_LINK( SfxInternetPage, ClickHdlNoUpdate, Control*, pCtrl )
{
(void)pCtrl; //unused
ChangeState( S_NoUpdate );
return 0;
}
//------------------------------------------------------------------------
IMPL_LINK( SfxInternetPage, ClickHdlReload, Control*, pCtrl )
{
(void)pCtrl; //unused
ChangeState( S_Reload );
return 0;
}
//------------------------------------------------------------------------
IMPL_LINK( SfxInternetPage, ClickHdlForward, Control*, pCtrl )
{
(void)pCtrl; //unused
ChangeState( S_Forward );
return 0;
}
//------------------------------------------------------------------------
IMPL_LINK_NOARG(SfxInternetPage, ClickHdlBrowseURL)
{
if ( !pFileDlg )
pFileDlg = new sfx2::FileDialogHelper(
TemplateDescription::FILEOPEN_SIMPLE, 0 );
pFileDlg->SetDisplayDirectory( m_pEDForwardURL->GetText() );
pFileDlg->StartExecuteModal( LINK( this, SfxInternetPage, DialogClosedHdl ) );
return 0;
}
//------------------------------------------------------------------------
IMPL_LINK_NOARG(SfxInternetPage, DialogClosedHdl)
{
DBG_ASSERT( pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" );
if ( ERRCODE_NONE == pFileDlg->GetError() )
m_pEDForwardURL->SetText( pFileDlg->GetPath() );
return 0;
}
//------------------------------------------------------------------------
sal_Bool SfxInternetPage::FillItemSet( SfxItemSet& rSet )
{
const SfxPoolItem* pItem = NULL;
SfxDocumentInfoItem* pInfo = NULL;
SfxTabDialog* pDlg = GetTabDialog();
const SfxItemSet* pExSet = NULL;
if ( pDlg )
pExSet = pDlg->GetExampleSet();
if ( pExSet && SFX_ITEM_SET != pExSet->GetItemState( SID_DOCINFO, sal_True, &pItem ) )
pInfo = pInfoItem;
else if ( pItem )
pInfo = new SfxDocumentInfoItem( *(const SfxDocumentInfoItem*)pItem );
if ( !pInfo )
{
SAL_WARN( "sfx2.dialog", "SfxInternetPage::FillItemSet(): no item found" );
return sal_False;
}
DBG_ASSERT( eState != S_Init, "*SfxInternetPage::FillItemSet(): state init is not acceptable at this point!" );
sal_Bool bEnableReload = sal_False;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< String > aURL( NULL );
::std::auto_ptr< String > aFrame( NULL );
SAL_WNODEPRECATED_DECLARATIONS_POP
sal_uIntPtr nDelay = 0;
switch ( eState )
{
case S_NoUpdate:
break;
case S_Reload:
bEnableReload = sal_True;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
aURL = ::std::auto_ptr< String >( new String() );
aFrame = ::std::auto_ptr< String >( new String() );
SAL_WNODEPRECATED_DECLARATIONS_POP
nDelay = static_cast<sal_uIntPtr>(m_pNFReload->GetValue());
break;
case S_Forward:
SAL_WARN_IF(m_pEDForwardURL->GetText().isEmpty(), "sfx2.dialog",
"+SfxInternetPage::FillItemSet(): empty URL should be not possible for forward option!");
bEnableReload = sal_True;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
aURL = ::std::auto_ptr< String >( new String( URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), m_pEDForwardURL->GetText(), URIHelper::GetMaybeFileHdl(), true ) ) );
aFrame = ::std::auto_ptr< String >( new String( m_pCBFrame->GetText() ) );
SAL_WNODEPRECATED_DECLARATIONS_POP
nDelay = static_cast<sal_uIntPtr>(m_pNFAfter->GetValue());
break;
default:
break;
}
pInfo->setAutoloadEnabled( bEnableReload );
if ( bEnableReload )
{
pInfo->setAutoloadURL( *aURL.get() );
pInfo->setDefaultTarget( *aFrame.get() );
pInfo->setAutoloadDelay( nDelay );
}
rSet.Put( *pInfo );
if ( pInfo != pInfoItem )
delete pInfo;
return sal_True;
}
//------------------------------------------------------------------------
SfxTabPage *SfxInternetPage::Create( Window* pParent, const SfxItemSet& rItemSet )
{
return new SfxInternetPage(pParent, rItemSet);
}
//------------------------------------------------------------------------
void SfxInternetPage::Reset( const SfxItemSet& rSet )
{
pInfoItem = &( SfxDocumentInfoItem& ) rSet.Get( SID_DOCINFO );
SFX_ITEMSET_ARG( &rSet, pURLItem, SfxStringItem, SID_BASEURL, sal_False );
DBG_ASSERT( pURLItem, "No BaseURL provided for InternetTabPage!" );
if ( pURLItem )
aBaseURL = pURLItem->GetValue();
STATE eNewState = S_NoUpdate;
if ( pInfoItem->isAutoloadEnabled() )
{
const String& rURL = pInfoItem->getAutoloadURL();
if( rURL.Len() )
{
m_pNFAfter->SetValue( pInfoItem->getAutoloadDelay() );
m_pEDForwardURL->SetText( rURL );
m_pCBFrame->SetText( pInfoItem->getDefaultTarget() );
eNewState = S_Forward;
}
else
{
m_pNFReload->SetValue( pInfoItem->getAutoloadDelay() );
eNewState = S_Reload;
}
}
ChangeState( eNewState );
SFX_ITEMSET_ARG( &rSet, pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False );
if ( pROItem && pROItem->GetValue() )
m_pContainer->Disable();
}
//------------------------------------------------------------------------
int SfxInternetPage::DeactivatePage( SfxItemSet* /*pSet*/ )
{
int nRet = LEAVE_PAGE;
if ( eState == S_Forward && m_pEDForwardURL->GetText().isEmpty() )
{
ErrorBox aErrBox( this, WB_OK, aForwardErrorMessg );
aErrBox.Execute();
nRet = KEEP_PAGE;
}
return nRet;
}
//------------------------------------------------------------------------
SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent,
const SfxItemSet& rItemSet )
......@@ -1479,7 +1155,6 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent,
m_nDocInfoId = AddTabPage("general", SfxDocumentPage::Create, 0);
AddTabPage("description", SfxDocumentDescPage::Create, 0);
AddTabPage("customprops", SfxCustomPropertiesPage::Create, 0);
AddTabPage("internet", SfxInternetPage::Create, 0);
AddTabPage("security", SfxSecurityPage::Create, 0);
}
......
......@@ -129,20 +129,6 @@
<child>
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="internet">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Internet </property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<object class="GtkLabel" id="security">
<property name="visible">True</property>
......@@ -150,7 +136,7 @@
<property name="label" translatable="yes">Security</property>
</object>
<packing>
<property name="position">4</property>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
......
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