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

weld OAddTableDlg

Change-Id: Id0c94d3ab1a19a1bb47ba1d47caa95110dab3836
Reviewed-on: https://gerrit.libreoffice.org/70353
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 93cc8d83
...@@ -78,13 +78,12 @@ TableTreeListBox::TableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView) ...@@ -78,13 +78,12 @@ TableTreeListBox::TableTreeListBox(std::unique_ptr<weld::TreeView> xTreeView)
: m_xImageProvider(new ImageProvider) : m_xImageProvider(new ImageProvider)
, m_bVirtualRoot(false) , m_bVirtualRoot(false)
, m_bNoEmptyFolders(false) , m_bNoEmptyFolders(false)
, m_bShowToggles(true)
, m_nTextColumn(1)
, m_xTreeView(std::move(xTreeView)) , m_xTreeView(std::move(xTreeView))
{ {
m_xTreeView->make_sorted();
} }
VCL_BUILDER_FACTORY_CONSTRUCTOR(OTableTreeListBox, 0)
void OTableTreeListBox::implSetDefaultImages() void OTableTreeListBox::implSetDefaultImages()
{ {
SetDefaultExpandedEntryBmp( ImageProvider::getFolderImage( DatabaseObject::TABLE ) ); SetDefaultExpandedEntryBmp( ImageProvider::getFolderImage( DatabaseObject::TABLE ) );
...@@ -383,12 +382,19 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn ...@@ -383,12 +382,19 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
} }
} }
void TableTreeListBox::DisableCheckButtons()
{
m_bShowToggles = false;
m_nTextColumn = 0;
}
void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection, const TNames& _rTables ) void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConnection, const TNames& _rTables )
{ {
implOnNewConnection( _rxConnection ); implOnNewConnection( _rxConnection );
// throw away all the old stuff // throw away all the old stuff
m_xTreeView->clear(); m_xTreeView->clear();
m_xTreeView->make_unsorted();
try try
{ {
...@@ -408,8 +414,9 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne ...@@ -408,8 +414,9 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
std::unique_ptr<weld::TreeIter> xRet(m_xTreeView->make_iterator()); std::unique_ptr<weld::TreeIter> xRet(m_xTreeView->make_iterator());
m_xTreeView->insert(nullptr, -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get()); m_xTreeView->insert(nullptr, -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get());
m_xTreeView->set_image(*xRet, sImageId, -1); m_xTreeView->set_image(*xRet, sImageId, -1);
m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0); if (m_bShowToggles)
m_xTreeView->set_text(*xRet, sRootEntryText, 1); m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0);
m_xTreeView->set_text(*xRet, sRootEntryText, m_nTextColumn);
} }
if ( _rTables.empty() ) if ( _rTables.empty() )
...@@ -456,8 +463,9 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne ...@@ -456,8 +463,9 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
OUString sId(OUString::number(nFolderType)); OUString sId(OUString::number(nFolderType));
m_xTreeView->insert(xRootEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get()); m_xTreeView->insert(xRootEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xRet.get());
m_xTreeView->set_image(*xRet, sImageId, -1); m_xTreeView->set_image(*xRet, sImageId, -1);
m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0); if (m_bShowToggles)
m_xTreeView->set_text(*xRet, folderName, 1); m_xTreeView->set_toggle(*xRet, TRISTATE_FALSE, 0);
m_xTreeView->set_text(*xRet, folderName, m_nTextColumn);
} }
} }
} }
...@@ -467,6 +475,8 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne ...@@ -467,6 +475,8 @@ void TableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConne
{ {
DBG_UNHANDLED_EXCEPTION("dbaccess"); DBG_UNHANDLED_EXCEPTION("dbaccess");
} }
m_xTreeView->make_sorted();
} }
bool OTableTreeListBox::isWildcardChecked(SvTreeListEntry* _pEntry) bool OTableTreeListBox::isWildcardChecked(SvTreeListEntry* _pEntry)
...@@ -482,8 +492,7 @@ bool OTableTreeListBox::isWildcardChecked(SvTreeListEntry* _pEntry) ...@@ -482,8 +492,7 @@ bool OTableTreeListBox::isWildcardChecked(SvTreeListEntry* _pEntry)
bool TableTreeListBox::isWildcardChecked(weld::TreeIter& rEntry) bool TableTreeListBox::isWildcardChecked(weld::TreeIter& rEntry)
{ {
// return m_xTreeView->get_text_emphasis(rEntry, 2); return m_xTreeView->get_text_emphasis(rEntry, m_nTextColumn);
return m_xTreeView->get_text_emphasis(rEntry, 1);
} }
void OTableTreeListBox::checkWildcard(SvTreeListEntry* _pEntry) void OTableTreeListBox::checkWildcard(SvTreeListEntry* _pEntry)
...@@ -494,6 +503,8 @@ void OTableTreeListBox::checkWildcard(SvTreeListEntry* _pEntry) ...@@ -494,6 +503,8 @@ void OTableTreeListBox::checkWildcard(SvTreeListEntry* _pEntry)
void TableTreeListBox::checkWildcard(weld::TreeIter& rEntry) void TableTreeListBox::checkWildcard(weld::TreeIter& rEntry)
{ {
if (!m_bShowToggles)
return;
m_xTreeView->set_toggle(rEntry, TRISTATE_TRUE, 0); m_xTreeView->set_toggle(rEntry, TRISTATE_TRUE, 0);
checkedButton_noBroadcast(rEntry); checkedButton_noBroadcast(rEntry);
} }
...@@ -528,6 +539,8 @@ void OTableTreeListBox::checkedButton_noBroadcast(SvTreeListEntry* _pEntry) ...@@ -528,6 +539,8 @@ void OTableTreeListBox::checkedButton_noBroadcast(SvTreeListEntry* _pEntry)
void TableTreeListBox::checkedButton_noBroadcast(weld::TreeIter& rEntry) void TableTreeListBox::checkedButton_noBroadcast(weld::TreeIter& rEntry)
{ {
if (!m_bShowToggles)
return;
TriState eState = m_xTreeView->get_toggle(rEntry, 0); TriState eState = m_xTreeView->get_toggle(rEntry, 0);
OSL_ENSURE(TRISTATE_INDET != eState, "OTableTreeListBox::CheckButtonHdl: user action which lead to TRISTATE?"); OSL_ENSURE(TRISTATE_INDET != eState, "OTableTreeListBox::CheckButtonHdl: user action which lead to TRISTATE?");
...@@ -618,7 +631,7 @@ void TableTreeListBox::implEmphasize(weld::TreeIter& rEntry, bool _bChecked, boo ...@@ -618,7 +631,7 @@ void TableTreeListBox::implEmphasize(weld::TreeIter& rEntry, bool _bChecked, boo
|| bAllObjectsEntryAffected // or it is the "all objects" entry || bAllObjectsEntryAffected // or it is the "all objects" entry
) )
{ {
m_xTreeView->set_text_emphasis(rEntry, _bChecked, 1); m_xTreeView->set_text_emphasis(rEntry, _bChecked, m_nTextColumn);
} }
if (_bUpdateDescendants) if (_bUpdateDescendants)
...@@ -756,8 +769,9 @@ void TableTreeListBox::implAddEntry( ...@@ -756,8 +769,9 @@ void TableTreeListBox::implAddEntry(
OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE);
m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get()); m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get());
m_xTreeView->set_image(*xFolder, sImageId, -1); m_xTreeView->set_image(*xFolder, sImageId, -1);
m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0); if (m_bShowToggles)
m_xTreeView->set_text(*xFolder, rFirstName, 1); m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0);
m_xTreeView->set_text(*xFolder, rFirstName, m_nTextColumn);
} }
xParentEntry = std::move(xFolder); xParentEntry = std::move(xFolder);
} }
...@@ -772,8 +786,9 @@ void TableTreeListBox::implAddEntry( ...@@ -772,8 +786,9 @@ void TableTreeListBox::implAddEntry(
OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE); OUString sImageId = ImageProvider::getFolderImageId(DatabaseObject::TABLE);
m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get()); m_xTreeView->insert(xParentEntry.get(), -1, nullptr, &sId, nullptr, nullptr, nullptr, false, xFolder.get());
m_xTreeView->set_image(*xFolder, sImageId, -1); m_xTreeView->set_image(*xFolder, sImageId, -1);
m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0); if (m_bShowToggles)
m_xTreeView->set_text(*xFolder, rSecondName, 1); m_xTreeView->set_toggle(*xFolder, TRISTATE_FALSE, 0);
m_xTreeView->set_text(*xFolder, rSecondName, m_nTextColumn);
} }
xParentEntry = std::move(xFolder); xParentEntry = std::move(xFolder);
} }
...@@ -791,8 +806,9 @@ void TableTreeListBox::implAddEntry( ...@@ -791,8 +806,9 @@ void TableTreeListBox::implAddEntry(
OUString sImageId(m_xImageProvider->getImageId(_rTableName, DatabaseObject::TABLE)); OUString sImageId(m_xImageProvider->getImageId(_rTableName, DatabaseObject::TABLE));
m_xTreeView->set_image(*xEntry, sImageId, -1); m_xTreeView->set_image(*xEntry, sImageId, -1);
} }
m_xTreeView->set_toggle(*xEntry, TRISTATE_FALSE, 0); if (m_bShowToggles)
m_xTreeView->set_text(*xEntry, sName, 1); m_xTreeView->set_toggle(*xEntry, TRISTATE_FALSE, 0);
m_xTreeView->set_text(*xEntry, sName, m_nTextColumn);
} }
} }
...@@ -964,6 +980,9 @@ std::unique_ptr<weld::TreeIter> TableTreeListBox::GetEntryPosByName(const OUStri ...@@ -964,6 +980,9 @@ std::unique_ptr<weld::TreeIter> TableTreeListBox::GetEntryPosByName(const OUStri
void TableTreeListBox::CheckButtons() void TableTreeListBox::CheckButtons()
{ {
if (!m_bShowToggles)
return;
auto xEntry(m_xTreeView->make_iterator()); auto xEntry(m_xTreeView->make_iterator());
if (!m_xTreeView->get_iter_first(*xEntry)) if (!m_xTreeView->get_iter_first(*xEntry))
return; return;
...@@ -976,6 +995,9 @@ void TableTreeListBox::CheckButtons() ...@@ -976,6 +995,9 @@ void TableTreeListBox::CheckButtons()
TriState TableTreeListBox::implDetermineState(weld::TreeIter& rEntry) TriState TableTreeListBox::implDetermineState(weld::TreeIter& rEntry)
{ {
if (!m_bShowToggles)
return TRISTATE_FALSE;
TriState eState = m_xTreeView->get_toggle(rEntry, 0); TriState eState = m_xTreeView->get_toggle(rEntry, 0);
if (!m_xTreeView->iter_has_child(rEntry)) if (!m_xTreeView->iter_has_child(rEntry))
// nothing to do in this bottom-up routine if there are no children ... // nothing to do in this bottom-up routine if there are no children ...
......
...@@ -210,20 +210,6 @@ namespace dbaui ...@@ -210,20 +210,6 @@ namespace dbaui
} }
} }
if (!m_xCollator.is())
{
// the collator for the string compares
try
{
m_xCollator = Collator::create(m_xORB);
m_xCollator->loadDefaultCollator(Application::GetSettings().GetLanguageTag().getLocale(), 0);
}
catch(const Exception&)
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
// fill the table list with this connection information // fill the table list with this connection information
SQLExceptionInfo aErrorInfo; SQLExceptionInfo aErrorInfo;
// the current DSN // the current DSN
...@@ -234,7 +220,6 @@ namespace dbaui ...@@ -234,7 +220,6 @@ namespace dbaui
try try
{ {
weld::WaitObject aWaitCursor(GetDialogFrameWeld()); weld::WaitObject aWaitCursor(GetDialogFrameWeld());
m_xTablesList->GetWidget().set_sort_order(false);
Reference<XPropertySet> xProp = m_pTablesDlg->getCurrentDataSource(); Reference<XPropertySet> xProp = m_pTablesDlg->getCurrentDataSource();
OSL_ENSURE(xProp.is(),"No data source set!"); OSL_ENSURE(xProp.is(),"No data source set!");
......
...@@ -40,8 +40,6 @@ namespace dbaui ...@@ -40,8 +40,6 @@ namespace dbaui
css::uno::Reference< css::sdbc::XConnection > css::uno::Reference< css::sdbc::XConnection >
m_xCurrentConnection; /// valid as long as the page is active m_xCurrentConnection; /// valid as long as the page is active
css::uno::Reference< css::i18n::XCollator >
m_xCollator;
OTableSubscriptionDialog* m_pTablesDlg; OTableSubscriptionDialog* m_pTablesDlg;
std::unique_ptr<weld::Widget> m_xTables; std::unique_ptr<weld::Widget> m_xTables;
......
...@@ -48,7 +48,7 @@ namespace dbaui ...@@ -48,7 +48,7 @@ namespace dbaui
::dbtools::SQLExceptionInfo m_aExceptionInfo; ::dbtools::SQLExceptionInfo m_aExceptionInfo;
VclPtr<OAddTableDlg> m_pAddTableDialog; std::shared_ptr<OAddTableDlg> m_xAddTableDialog;
std::unique_ptr< AddTableDialogContext > m_pDialogContext; std::unique_ptr< AddTableDialogContext > m_pDialogContext;
Point m_aMinimumTableViewSize; Point m_aMinimumTableViewSize;
...@@ -82,7 +82,7 @@ namespace dbaui ...@@ -82,7 +82,7 @@ namespace dbaui
// attribute access // attribute access
TTableWindowData& getTableWindowData() { return m_vTableData; } TTableWindowData& getTableWindowData() { return m_vTableData; }
TTableConnectionData& getTableConnectionData() { return m_vTableConnectionData;} TTableConnectionData& getTableConnectionData() { return m_vTableConnectionData;}
OAddTableDlg* getAddTableDialog()const { return m_pAddTableDialog; } OAddTableDlg* getAddTableDialog()const { return m_xAddTableDialog.get(); }
// OSingleDocumentController overridables // OSingleDocumentController overridables
virtual void reconnect( bool _bUI ) override; virtual void reconnect( bool _bUI ) override;
...@@ -139,6 +139,9 @@ namespace dbaui ...@@ -139,6 +139,9 @@ namespace dbaui
return aInfo; return aInfo;
} }
// show the dialog
void runDialogAsync();
protected: protected:
TTableWindowData::value_type createTableWindowData(const OUString& _sComposedName,const OUString& _sTableName,const OUString& _sWindowName); TTableWindowData::value_type createTableWindowData(const OUString& _sComposedName,const OUString& _sTableName,const OUString& _sWindowName);
// ask the user if the design should be saved when it is modified // ask the user if the design should be saved when it is modified
......
...@@ -49,47 +49,44 @@ namespace dbaui ...@@ -49,47 +49,44 @@ namespace dbaui
virtual bool allowQueries() const = 0; virtual bool allowQueries() const = 0;
virtual bool allowAddition() const = 0; virtual bool allowAddition() const = 0;
virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) = 0; virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) = 0;
virtual void onWindowClosing( const vcl::Window* _pWindow ) = 0; virtual void onWindowClosing() = 0;
protected: protected:
~IAddTableDialogContext() {} ~IAddTableDialogContext() {}
}; };
class OAddTableDlg : public ModelessDialog class OAddTableDlg : public weld::GenericDialogController
{ {
VclPtr<RadioButton> m_pCaseTables; IAddTableDialogContext& m_rContext;
VclPtr<RadioButton> m_pCaseQueries;
VclPtr<OTableTreeListBox> m_pTableList;
VclPtr<SvTreeListBox> m_pQueryList;
std::unique_ptr< TableObjectListFacade > m_xCurrentList; std::unique_ptr< TableObjectListFacade > m_xCurrentList;
VclPtr<PushButton> m_pAddButton; std::unique_ptr<weld::RadioButton> m_xCaseTables;
VclPtr<PushButton> m_pCloseButton; std::unique_ptr<weld::RadioButton> m_xCaseQueries;
IAddTableDialogContext& m_rContext; std::unique_ptr<TableTreeListBox> m_xTableList;
std::unique_ptr<weld::TreeView> m_xQueryList;
DECL_LINK( AddClickHdl, Button*, void ); std::unique_ptr<weld::Button> m_xAddButton;
DECL_LINK( CloseClickHdl, Button*, void); std::unique_ptr<weld::Button> m_xCloseButton;
DECL_LINK( TableListDoubleClickHdl, SvTreeListBox*, bool );
DECL_LINK( TableListSelectHdl, SvTreeListBox*, void ); DECL_LINK( AddClickHdl, weld::Button&, void );
DECL_LINK( OnTypeSelected, Button*, void ); DECL_LINK( CloseClickHdl, weld::Button&, void);
DECL_LINK( TableListDoubleClickHdl, weld::TreeView&, void );
DECL_LINK( TableListSelectHdl, weld::TreeView&, void );
DECL_LINK( OnTypeSelected, weld::Button&, void );
public: public:
OAddTableDlg( OAddTableDlg(weld::Window* _pParent,
vcl::Window* _pParent, IAddTableDialogContext& _rContext);
IAddTableDialogContext& _rContext );
virtual ~OAddTableDlg() override; virtual ~OAddTableDlg() override;
virtual void dispose() override;
void Update(); void Update();
void OnClose();
static OUString getDialogTitleForContext( static OUString getDialogTitleForContext(
IAddTableDialogContext const & _rContext ); IAddTableDialogContext const & _rContext );
private: private:
virtual bool Close() override;
bool impl_isAddAllowed(); bool impl_isAddAllowed();
enum ObjectList enum ObjectList
......
...@@ -167,6 +167,8 @@ class TableTreeListBox ...@@ -167,6 +167,8 @@ class TableTreeListBox
m_xImageProvider; // provider for our images m_xImageProvider; // provider for our images
bool m_bVirtualRoot; // should the first entry be visible bool m_bVirtualRoot; // should the first entry be visible
bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed? bool m_bNoEmptyFolders; // should empty catalogs/schematas be prevented from being displayed?
bool m_bShowToggles; // show toggle buttons
int m_nTextColumn; // column text is in, depends on if toggles are shown
std::unique_ptr<weld::TreeView> m_xTreeView; std::unique_ptr<weld::TreeView> m_xTreeView;
public: public:
...@@ -179,7 +181,8 @@ public: ...@@ -179,7 +181,8 @@ public:
typedef std::pair< OUString, bool > TTableViewName; typedef std::pair< OUString, bool > TTableViewName;
typedef std::vector< TTableViewName > TNames; typedef std::vector< TTableViewName > TNames;
void suppressEmptyFolders() { m_bNoEmptyFolders = true; } void SuppressEmptyFolders() { m_bNoEmptyFolders = true; }
void DisableCheckButtons();
/** determines whether the given entry denotes a tables folder /** determines whether the given entry denotes a tables folder
*/ */
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
virtual bool allowQueries() const override; virtual bool allowQueries() const override;
virtual bool allowAddition() const override; virtual bool allowAddition() const override;
virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) override; virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) override;
virtual void onWindowClosing( const vcl::Window* _pWindow ) override; virtual void onWindowClosing() override;
private: private:
OJoinTableView* getTableView() const; OJoinTableView* getTableView() const;
...@@ -117,14 +117,10 @@ void AddTableDialogContext::addTableWindow( const OUString& _rQualifiedTableName ...@@ -117,14 +117,10 @@ void AddTableDialogContext::addTableWindow( const OUString& _rQualifiedTableName
getTableView()->AddTabWin( _rQualifiedTableName, _rAliasName, true ); getTableView()->AddTabWin( _rQualifiedTableName, _rAliasName, true );
} }
void AddTableDialogContext::onWindowClosing( const vcl::Window* _pWindow ) void AddTableDialogContext::onWindowClosing()
{ {
if ( !m_rController.getView() ) if (!m_rController.getView())
return; return;
::dbaui::notifySystemWindow(
m_rController.getView(), const_cast< vcl::Window* >( _pWindow ), ::comphelper::mem_fun( &TaskPaneList::RemoveWindow ) );
m_rController.InvalidateFeature( ID_BROWSER_ADDTABLE ); m_rController.InvalidateFeature( ID_BROWSER_ADDTABLE );
m_rController.getView()->GrabFocus(); m_rController.getView()->GrabFocus();
} }
...@@ -139,8 +135,7 @@ OJoinTableView* AddTableDialogContext::getTableView() const ...@@ -139,8 +135,7 @@ OJoinTableView* AddTableDialogContext::getTableView() const
// OJoinController // OJoinController
OJoinController::OJoinController(const Reference< XComponentContext >& _rM) OJoinController::OJoinController(const Reference< XComponentContext >& _rM)
:OJoinController_BASE(_rM) : OJoinController_BASE(_rM)
,m_pAddTableDialog(nullptr)
{ {
} }
...@@ -155,7 +150,11 @@ OJoinDesignView* OJoinController::getJoinView() ...@@ -155,7 +150,11 @@ OJoinDesignView* OJoinController::getJoinView()
void OJoinController::disposing() void OJoinController::disposing()
{ {
m_pAddTableDialog.disposeAndClear(); if (m_xAddTableDialog)
{
m_xAddTableDialog->response(RET_CLOSE);
m_xAddTableDialog.reset();
}
OJoinController_BASE::disposing(); OJoinController_BASE::disposing();
...@@ -168,8 +167,8 @@ void OJoinController::disposing() ...@@ -168,8 +167,8 @@ void OJoinController::disposing()
void OJoinController::reconnect( bool _bUI ) void OJoinController::reconnect( bool _bUI )
{ {
OJoinController_BASE::reconnect( _bUI ); OJoinController_BASE::reconnect( _bUI );
if ( isConnected() && m_pAddTableDialog ) if ( isConnected() && m_xAddTableDialog )
m_pAddTableDialog->Update(); m_xAddTableDialog->Update();
} }
void OJoinController::impl_onModifyChanged() void OJoinController::impl_onModifyChanged()
...@@ -207,7 +206,7 @@ FeatureState OJoinController::GetState(sal_uInt16 _nId) const ...@@ -207,7 +206,7 @@ FeatureState OJoinController::GetState(sal_uInt16 _nId) const
case ID_BROWSER_ADDTABLE: case ID_BROWSER_ADDTABLE:
aReturn.bEnabled = ( getView() != nullptr ) aReturn.bEnabled = ( getView() != nullptr )
&& const_cast< OJoinController* >( this )->getJoinView()->getTableView()->IsAddAllowed(); && const_cast< OJoinController* >( this )->getJoinView()->getTableView()->IsAddAllowed();
aReturn.bChecked = aReturn.bEnabled && m_pAddTableDialog != nullptr && m_pAddTableDialog->IsVisible() ; aReturn.bChecked = aReturn.bEnabled && m_xAddTableDialog;
if ( aReturn.bEnabled ) if ( aReturn.bEnabled )
aReturn.sTitle = OAddTableDlg::getDialogTitleForContext( impl_getDialogContext() ); aReturn.sTitle = OAddTableDlg::getDialogTitleForContext( impl_getDialogContext() );
break; break;
...@@ -253,22 +252,14 @@ void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& ...@@ -253,22 +252,14 @@ void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
InvalidateAll(); InvalidateAll();
return; return;
case ID_BROWSER_ADDTABLE: case ID_BROWSER_ADDTABLE:
if ( !m_pAddTableDialog ) if (m_xAddTableDialog)
m_pAddTableDialog = VclPtr<OAddTableDlg>::Create( getView(), impl_getDialogContext() );
if ( m_pAddTableDialog->IsVisible() )
{ {
m_pAddTableDialog->Show( false ); m_xAddTableDialog->response(RET_CLOSE);
getView()->GrabFocus(); getView()->GrabFocus();
} }
else else
{ {
{ runDialogAsync();
WaitObject aWaitCursor( getView() );
m_pAddTableDialog->Update();
}
m_pAddTableDialog->Show();
::dbaui::notifySystemWindow(getView(),m_pAddTableDialog,::comphelper::mem_fun(&TaskPaneList::AddWindow));
} }
break; break;
default: default:
...@@ -277,6 +268,20 @@ void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& ...@@ -277,6 +268,20 @@ void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
InvalidateFeature(_nId); InvalidateFeature(_nId);
} }
void OJoinController::runDialogAsync()
{
assert(!m_xAddTableDialog);
m_xAddTableDialog.reset(new OAddTableDlg(getFrameWeld(), impl_getDialogContext()));
{
weld::WaitObject aWaitCursor(getFrameWeld());
m_xAddTableDialog->Update();
}
weld::DialogController::runAsync(m_xAddTableDialog, [this](sal_Int32 /*nResult*/){
m_xAddTableDialog->OnClose();
m_xAddTableDialog.reset();
});
}
void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY ) void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY )
{ {
// Deletion and recreation of the old implementation with the current model is not correct anymore: // Deletion and recreation of the old implementation with the current model is not correct anymore:
......
...@@ -149,9 +149,9 @@ void OQueryViewSwitch::impl_forceSQLView() ...@@ -149,9 +149,9 @@ void OQueryViewSwitch::impl_forceSQLView()
OAddTableDlg* pAddTabDialog( getAddTableDialog() ); OAddTableDlg* pAddTabDialog( getAddTableDialog() );
// hide the "Add Table" dialog // hide the "Add Table" dialog
m_bAddTableDialogWasVisible = pAddTabDialog && pAddTabDialog->IsVisible(); m_bAddTableDialogWasVisible = pAddTabDialog != nullptr;
if ( m_bAddTableDialogWasVisible ) if (m_bAddTableDialogWasVisible)
pAddTabDialog->Hide(); pAddTabDialog->response(RET_CLOSE);
// tell the views they're in/active // tell the views they're in/active
m_pDesignView->stopTimer(); m_pDesignView->stopTimer();
...@@ -226,7 +226,7 @@ bool OQueryViewSwitch::impl_postViewSwitch( const bool i_bGraphicalDesign, const ...@@ -226,7 +226,7 @@ bool OQueryViewSwitch::impl_postViewSwitch( const bool i_bGraphicalDesign, const
OAddTableDlg* pAddTabDialog( getAddTableDialog() ); OAddTableDlg* pAddTabDialog( getAddTableDialog() );
if ( pAddTabDialog ) if ( pAddTabDialog )
if ( i_bGraphicalDesign && m_bAddTableDialogWasVisible ) if ( i_bGraphicalDesign && m_bAddTableDialogWasVisible )
pAddTabDialog->Show(); m_pDesignView->getController().runDialogAsync();
GrabFocus(); GrabFocus();
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="dba"> <interface domain="dba">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="TablesFilterDialog"> <object class="GtkDialog" id="TablesFilterDialog">
...@@ -7,7 +7,13 @@ ...@@ -7,7 +7,13 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="tablesfilterdialog|TablesFilterDialog">Tables Filter</property> <property name="title" translatable="yes" context="tablesfilterdialog|TablesFilterDialog">Tables Filter</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="dba"> <interface domain="dba">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/> <object class="GtkTreeStore" id="liststore1">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeStore" id="liststore2">
<columns>
<!-- column-name expander -->
<column type="GdkPixbuf"/>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="TablesJoinDialog"> <object class="GtkDialog" id="TablesJoinDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
...@@ -87,7 +111,6 @@ ...@@ -87,7 +111,6 @@
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">queries</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
...@@ -101,7 +124,7 @@ ...@@ -101,7 +124,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0.0099999997764825821</property> <property name="xalign">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">tables</property> <property name="group">tables</property>
</object> </object>
...@@ -111,13 +134,46 @@ ...@@ -111,13 +134,46 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="dbulo-OTableTreeListBox" id="tablelist:border"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<child internal-child="selection"> <property name="shadow_type">in</property>
<object class="GtkTreeSelection" id="OTableTreeListBox-selection3"/> <child>
<object class="GtkTreeView" id="tablelist">
<property name="width_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore2</property>
<property name="headers_visible">False</property>
<property name="search_column">1</property>
<property name="show_expanders">False</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection2"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn8">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext5"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child> </child>
</object> </object>
<packing> <packing>
...@@ -148,13 +204,46 @@ ...@@ -148,13 +204,46 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="vcllo-SvTreeListBox" id="querylist:border"> <object class="GtkScrolledWindow">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<child internal-child="selection"> <property name="shadow_type">in</property>
<object class="GtkTreeSelection" id="Tree List-selection3"/> <child>
<object class="GtkTreeView" id="querylist">
<property name="width_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">liststore1</property>
<property name="headers_visible">False</property>
<property name="search_column">1</property>
<property name="show_expanders">False</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="Macro Library List-selection3"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn18">
<property name="spacing">6</property>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext15"/>
<attributes>
<attribute name="pixbuf">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="cellrenderertext16"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child> </child>
</object> </object>
<packing> <packing>
......
...@@ -389,10 +389,6 @@ ...@@ -389,10 +389,6 @@
generic-name="CondFormatList" parent="GtkDrawingArea" generic-name="CondFormatList" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/> icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="OTableTreeListBox" name="dbulo-OTableTreeListBox"
generic-name="OTableTreeListBox" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="IndexFieldsControl" name="dbulo-DbaIndexFieldsControl" <glade-widget-class title="IndexFieldsControl" name="dbulo-DbaIndexFieldsControl"
generic-name="IndexFieldsControl" parent="GtkTreeView" generic-name="IndexFieldsControl" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/> icon-name="widget-gtk-treeview"/>
......
...@@ -111,11 +111,8 @@ dbaccess/uiconfig/ui/summarypage.ui://GtkLabel[@id='success'] orphan-label ...@@ -111,11 +111,8 @@ dbaccess/uiconfig/ui/summarypage.ui://GtkLabel[@id='success'] orphan-label
dbaccess/uiconfig/ui/summarypage.ui://GtkLabel[@id='failure'] orphan-label dbaccess/uiconfig/ui/summarypage.ui://GtkLabel[@id='failure'] orphan-label
dbaccess/uiconfig/ui/summarypage.ui://GtkTextView[@id='textview:border'] no-labelled-by dbaccess/uiconfig/ui/summarypage.ui://GtkTextView[@id='textview:border'] no-labelled-by
dbaccess/uiconfig/ui/tablesfilterpage.ui://GtkLabel[@id='label2'] orphan-label dbaccess/uiconfig/ui/tablesfilterpage.ui://GtkLabel[@id='label2'] orphan-label
dbaccess/uiconfig/ui/tablesfilterpage.ui://dbulo-OTableTreeListBox[@id='treeview:border'] no-labelled-by
dbaccess/uiconfig/ui/tablesjoindialog.ui://dbulo-OTableTreeListBox[@id='tablelist:border'] no-labelled-by
dbaccess/uiconfig/ui/tablesjoindialog.ui://GtkLabel[@id='title'] orphan-label dbaccess/uiconfig/ui/tablesjoindialog.ui://GtkLabel[@id='title'] orphan-label
dbaccess/uiconfig/ui/tablesjoindialog.ui://GtkLabel[@id='alttitle'] orphan-label dbaccess/uiconfig/ui/tablesjoindialog.ui://GtkLabel[@id='alttitle'] orphan-label
dbaccess/uiconfig/ui/tablesjoindialog.ui://vcllo-SvTreeListBox[@id='querylist:border'] no-labelled-by
dbaccess/uiconfig/ui/textpage.ui://GtkEntry[@id='extension'] no-labelled-by dbaccess/uiconfig/ui/textpage.ui://GtkEntry[@id='extension'] no-labelled-by
dbaccess/uiconfig/ui/textpage.ui://GtkLabel[@id='example'] orphan-label dbaccess/uiconfig/ui/textpage.ui://GtkLabel[@id='example'] orphan-label
dbaccess/uiconfig/ui/useradminpage.ui://GtkLabel[@id='label3'] orphan-label dbaccess/uiconfig/ui/useradminpage.ui://GtkLabel[@id='label3'] orphan-label
......
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