30#include <osl/diagnose.h>
41#define STATE_SELECT_ABTYPE 0
42#define STATE_INVOKE_ADMIN_DIALOG 1
43#define STATE_TABLE_SELECTION 2
44#define STATE_MANUAL_FIELD_MAPPING 3
45#define STATE_FINAL_CONFIRM 4
47#define PATH_COMPLETE 1
48#define PATH_NO_SETTINGS 2
49#define PATH_NO_FIELDS 3
50#define PATH_NO_SETTINGS_NO_FIELDS 4
58 ,m_aNewDataSource(_rxORB)
131 DBG_ASSERT( pResId,
"OAddressBookSourcePilot::getStateDisplayName: don't know this state!" );
242 if ( aTables.empty() )
245 VclMessageType::Question, VclButtonsType::YesNo,
258 if ( aTables.size() == 1 )
272 if ( rTableNames.end() != rTableNames.find(
getSettings().sSelectedTable ) )
276 const char* pGuess =
nullptr;
284 OSL_FAIL(
"OAddressBookSourcePilot::implDefaultTableName: unhandled case!" );
287 const OUString sGuess = OUString::createFromAscii( pGuess );
288 if ( rTableNames.end() != rTableNames.find( sGuess ) )
345 OSL_FAIL(
"OAddressBookSourcePilot::implCreateDataSource: illegal data source type!" );
364 OUString sIdent(OUString::number(_nState));
367 std::unique_ptr<vcl::OWizardPage> xRet;
372 xRet = std::make_unique<TypeSelectionPage>(pPageContainer,
this);
375 xRet = std::make_unique<AdminDialogInvokationPage>(pPageContainer,
this);
378 xRet = std::make_unique<TableSelectionPage>(pPageContainer,
this);
381 xRet = std::make_unique<FieldMappingPage>(pPageContainer,
this);
384 xRet = std::make_unique<FinalPage>(pPageContainer,
this);
387 assert(
false &&
"OAddressBookSourcePilot::createPage: invalid state!");
403 bool bCanSkipTables =
411 bTablesPage && ( bConnected ? !bCanSkipTables : !bSettingsPage )
420 bConnected && bCanSkipTables
429 if ( !bSettingsPage )
#define STATE_MANUAL_FIELD_MAPPING
#define STATE_FINAL_CONFIRM
#define PATH_NO_SETTINGS_NO_FIELDS
#define STATE_TABLE_SELECTION
#define STATE_SELECT_ABTYPE
#define STATE_INVOKE_ADMIN_DIALOG
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
virtual OUString getStateDisplayName(WizardState _nState) const override
AddressSettings m_aSettings
virtual bool onFinish() override
void implDefaultTableName()
guesses a default for the table name, if no valid table is selected
ODataSource m_aNewDataSource
void implDoAutoFieldMapping()
does an automatic field mapping (possible for all types except AST_OTHER)
bool needManualFieldMapping() const
checks if we need a manual (user-guided) field mapping
static bool needTableSelection(AddressSourceType _eType)
determines whether the given address book type does provide one table only
virtual std::unique_ptr< BuilderPage > createPage(WizardState _nState) override
const css::uno::Reference< css::uno::XComponentContext > & getORB() const
get the service factory which was used to create the dialog
bool needAdminInvokationPage() const
check if with the current settings, we would need to invoke he administration dialog for more details...
OAddressBookSourcePilot(weld::Window *_pParent, const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
ctor
const ODataSource & getDataSource() const
AddressSourceType m_eNewDataSourceType
virtual short run() override
void impl_updateRoadmap(AddressSourceType _eType)
bool connectToDataSource(bool _bForceReConnect)
virtual bool prepareLeaveCurrentState(CommitPageReason _eReason) override
void implCreateDataSource()
creates a new data source of the type indicated by m_aSettings
AddressSettings & getSettings()
virtual void enterState(WizardState _nState) override
void typeSelectionChanged(AddressSourceType _eType)
to be called when the selected type changed
a non-UNO wrapper for the data source context
ODataSource createNewEvolutionGroupwise(const OUString &_rName)
creates a new Evolution GROUPWISE data source
ODataSource createNewEvolutionLdap(const OUString &_rName)
creates a new Evolution LDAP data source
ODataSource createNewKab(const OUString &_rName)
creates a new KDE address book data source
ODataSource createNewMacab(const OUString &_rName)
creates a new macOS address book data source
void disambiguate(OUString &_rDataSourceName)
disambiguates the given name by appending successive numbers
ODataSource createNewOther(const OUString &_rName)
creates a new Other data source; tdf117101: Spreadsheet by default
ODataSource createNewEvolution(const OUString &_rName)
creates a new Evolution local data source
ODataSource createNewThunderbird(const OUString &_rName)
creates a new Thunderbird data source
void store(const AddressSettings &rSettings)
stores the database file
bool connect(weld::Window *_pMessageParent)
connects to the data source represented by this object
void remove()
removes the data source represented by the object from the data source context
bool isValid() const
checks whether or not the object represents a valid data source
void disconnect()
disconnects from the data source (i.e. disposes the UNO connection hold internally)
bool rename(const OUString &_rName)
renames the data source
const StringBag & getTableNames() const
retrieves the tables names from the connection
bool hasTable(const OUString &_rTableName) const
determines whether a given table exists
void registerDataSource(const OUString &_sRegisteredDataSourceName)
register the data source under the given name in the configuration
OUString getName() const
returns the name of the data source
bool isConnected() const
returns <TRUE> if the object has a valid connection, obtained from its data source
void declarePath(RoadmapWizardTypes::PathId _nPathId, const RoadmapWizardTypes::WizardPath &_lWizardStates)
void activatePath(RoadmapWizardTypes::PathId _nPathId, bool _bDecideForIt=false)
virtual void enterState(WizardTypes::WizardState nState) override
void enableState(WizardTypes::WizardState nState, bool _bEnable=true)
std::unique_ptr< weld::Button > m_xNextPage
std::unique_ptr< weld::Button > m_xCancel
void defaultButton(WizardButtonFlags _nWizardButtonFlags)
std::unique_ptr< weld::Button > m_xPrevPage
virtual void ActivatePage()
void enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable)
std::unique_ptr< weld::Button > m_xHelp
virtual bool prepareLeaveCurrentState(WizardTypes::CommitPageReason eReason)
std::unique_ptr< weld::Button > m_xFinish
WizardTypes::WizardState getCurrentState() const
void setTitleBase(const OUString &_rTitleBase)
BuilderPage * GetPage(WizardTypes::WizardState eState) const
std::unique_ptr< weld::Assistant > m_xAssistant
#define DBG_ASSERT(sCon, aError)
constexpr OUStringLiteral HID_ABSPILOT_PREVIOUS
constexpr OUStringLiteral HID_ABSPILOT_NEXT
constexpr OUStringLiteral HID_ABSPILOT_CANCEL
constexpr OUStringLiteral UID_ABSPILOT_HELP
constexpr OUStringLiteral HID_ABSPILOT_FINISH
constexpr OUStringLiteral HID_ABSPILOT
void markPilotSuccess(const Reference< XComponentContext > &_rxContext)
void writeTemplateAddressSource(const Reference< XComponentContext > &_rxContext, const OUString &_rDataSourceName, const OUString &_rTableName)
void defaultMapping(const Reference< XComponentContext > &_rxContext, MapString2String &_rFieldAssignment)
void writeTemplateAddressFieldMapping(const Reference< XComponentContext > &_rxContext, MapString2String &&aFieldAssignment)
std::set< OUString > StringBag
@ AST_EVOLUTION_GROUPWISE
OUString ModuleRes(TranslateId pId)
MapString2String aFieldMapping
OUString sRegisteredDataSourceName