LibreOffice Module sfx2 (master) 1
bluthsnd.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#include <com/sun/star/frame/XFrame.hpp>
11
12#include <stdio.h>
13
14#include <bluthsndapi.hxx>
15
16SfxBluetoothModel::SendMailResult SfxBluetoothModel::SaveAndSend( const css::uno::Reference< css::frame::XFrame >& xFrame )
17{
18 SaveResult eSaveResult;
20 OUString aFileName;
21
22 eSaveResult = SaveDocumentAsFormat( OUString(), xFrame, OUString(), aFileName );
23 if( eSaveResult == SAVE_SUCCESSFUL )
24 {
25 maAttachedDocuments.push_back( aFileName );
26 return Send();
27 }
28 else if( eSaveResult == SAVE_CANCELLED )
29 eResult = SEND_MAIL_CANCELLED;
30
31 return eResult;
32}
33
35{
36#ifndef LINUX
37 (void) this; // avoid loplugin:staticmethods
38 return SEND_MAIL_ERROR;
39#else
40 char bthsend[300];
42 OUString aFileName = maAttachedDocuments[0];
43 snprintf(bthsend,300,"bluetooth-sendto %s",OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8).getStr() );
44 if( !system( bthsend ) )
45 eResult = SEND_MAIL_ERROR;
46 return eResult;
47#endif
48}
49
50/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SendMailResult Send()
Definition: bluthsnd.cxx:34
SendMailResult SaveAndSend(const css::uno::Reference< css::frame::XFrame > &xFrame)
Definition: bluthsnd.cxx:16
::std::vector< OUString > maAttachedDocuments
static SaveResult SaveDocumentAsFormat(const OUString &aSaveFileName, const css::uno::Reference< css::uno::XInterface > &xFrameOrModel, const OUString &rType, OUString &rFileNamePath)
Definition: mailmodel.cxx:236
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Reference< XFrame > xFrame