mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-02-10 18:05:16 +08:00
@ -44,6 +44,7 @@
|
||||
--text-contrast-background: #fff;
|
||||
|
||||
--icon-normal: fade(#000, 80%);
|
||||
--icon-success: #090;
|
||||
|
||||
--disabled-element-opacity: .4;
|
||||
--theme-inverted-image-filter: none;
|
||||
@ -93,6 +94,7 @@
|
||||
@text-contrast-background: var(--text-contrast-background);
|
||||
|
||||
@icon-normal: var(--icon-normal);
|
||||
@icon-success: var(--icon-success);
|
||||
|
||||
@disabled-element-opacity: var(--disabled-element-opacity);
|
||||
@theme-inverted-image-filter: var(--theme-inverted-image-filter);
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
|
||||
/*--icon-normal: fade(#000, 80%);*/
|
||||
/*--icon-notification-badge: #000;*/
|
||||
--icon-success: #5b9f27;
|
||||
|
||||
/*--disabled-element-opacity: .4;*/
|
||||
/*--theme-inverted-image-filter: none;*/
|
||||
|
||||
@ -38,12 +38,12 @@ button {
|
||||
background-color: @highlight-button-hover;
|
||||
}
|
||||
|
||||
&:active {
|
||||
&:active:not(:disabled) {
|
||||
border-color: @highlight-button-pressed;
|
||||
background-color: @highlight-button-pressed;
|
||||
}
|
||||
|
||||
&.btn--landing {
|
||||
&.btn--landing:not(:disabled) {
|
||||
&:hover {
|
||||
background-color: @highlight-accent-button-hover;
|
||||
}
|
||||
|
||||
@ -124,6 +124,7 @@
|
||||
<img class="inline-svg" src="../res/img/welcome.svg">
|
||||
<img class="inline-svg" src="../res/img/welcome_dark.svg">
|
||||
<img class="inline-svg" src="../res/img/logo.svg">
|
||||
<img class="inline-svg" src="../res/img/update_status.svg">
|
||||
<script>
|
||||
var svgpoints = document.querySelectorAll('img.inline-svg');
|
||||
SVGInjector(svgpoints, {evalScripts:'never'});
|
||||
|
||||
@ -109,6 +109,7 @@
|
||||
<inline src="../res/img/welcome.svg" />
|
||||
<inline src="../res/img/welcome_dark.svg" />
|
||||
<inline src="../res/img/logo.svg" />
|
||||
<inline src="../res/img/update_status.svg" />
|
||||
</div>
|
||||
|
||||
<script>var l10n = l10n || {}</script>
|
||||
|
||||
@ -70,6 +70,17 @@
|
||||
if ( !!_ext_ver ) _opts.version += ` (${_ext_ver.trim()})`;
|
||||
|
||||
var _lang = utils.Lang;
|
||||
const _updates_status = `<section id="idx-update-cnt">
|
||||
<div class="status-field hbox">
|
||||
<svg class="icon" id="idx-update-status-icon">
|
||||
<use href=""></use>
|
||||
</svg>
|
||||
<label id="idx-update-status-text"></label>
|
||||
</div>
|
||||
<div class="status-field">
|
||||
<button id="idx-update-btnaction" class="btn btn--landing"></button>
|
||||
</div>
|
||||
</section>`;
|
||||
let _html = `<div class="flexbox">
|
||||
<div class="box-ver">
|
||||
<div class="${_opts.logocls}">
|
||||
@ -82,6 +93,7 @@
|
||||
<div id='id-features-available' l10n>${_lang.aboutProFeaturesAvailable}</div>
|
||||
${_opts.edition}<p></p>
|
||||
<a class="ver-checkupdate link" draggable='false' data-state='check' href="#" l10n>${_lang.checkUpdates}</a><p />
|
||||
${_updates_status}
|
||||
<a class="ver-changelog link" draggable='false' target="popup" href=${_opts.changelog} l10n>${_lang.aboutChangelog}</a><p />
|
||||
<div class="ver-copyright">${_opts.rights}</div>
|
||||
<a class="ver-site link" target="popup" href="${_opts.link}">${_opts.site}</a>
|
||||
@ -159,7 +171,15 @@
|
||||
this.updates = param == 'on';
|
||||
|
||||
if ( this.view ) {
|
||||
this.view.$panel.find('.ver-checkupdate')[this.updates?'show':'hide']();
|
||||
// this.view.$panel.find('.ver-checkupdate')[this.updates?'show':'hide']();
|
||||
this.view.$panel.find('.idx-update-cnt')[this.updates?'show':'hide']();
|
||||
|
||||
if ( this.updates ) {
|
||||
const $btn = $('#idx-update-btnaction')
|
||||
$btn.click(e => {
|
||||
sdk.execCommand('updates:action', $btn.data('action'));
|
||||
});
|
||||
}
|
||||
}
|
||||
} else
|
||||
if (/^updates:checking/.test(cmd)) {
|
||||
@ -198,9 +218,53 @@
|
||||
if ( opts.disabled != undefined ) {
|
||||
$label.attr('disabled', opts.disabled ? 'disabled' : false);
|
||||
}
|
||||
} else
|
||||
if (/updates:status/.test(cmd)) {
|
||||
on_updates_info.call(this, JSON.parse(param))
|
||||
}
|
||||
};
|
||||
|
||||
const on_updates_info = function(info) {
|
||||
if ( info.text ) {
|
||||
$('#idx-update-status-text', this.view.$panel).text(info.text);
|
||||
}
|
||||
|
||||
if ( info.icon ) {
|
||||
const $icon = $('#idx-update-status-icon', this.view.$panel);
|
||||
|
||||
let icon_id;
|
||||
switch (info.icon) {
|
||||
case 'error': icon_id = 'error'; break;
|
||||
case 'load': icon_id = 'load'; break;
|
||||
case 'lastcheck': icon_id = 'lastcheck'; break;
|
||||
default: icon_id = 'success'; break;
|
||||
}
|
||||
|
||||
$icon.attr('data-icon', icon_id);
|
||||
$('use', $icon).attr('href', `#${icon_id}`)
|
||||
}
|
||||
|
||||
if ( info.button ) {
|
||||
const $button = $('#idx-update-btnaction', this.view.$panel);
|
||||
if ( info.button.text ) {
|
||||
$button.text(info.button.text);
|
||||
$button.data("action", info.button.action);
|
||||
}
|
||||
|
||||
if ( info.button.lock ) {
|
||||
$button.disable(info.button.lock=='true');
|
||||
}
|
||||
|
||||
if ( info.button == 'lock' ) {
|
||||
$button.disable(true);
|
||||
} else
|
||||
if ( info.button == 'unlock' ) {
|
||||
$button.disable(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: function() {
|
||||
baseController.prototype.init.apply(this, arguments);
|
||||
|
||||
@ -84,7 +84,8 @@
|
||||
init: function() {
|
||||
baseController.prototype.init.apply(this, arguments);
|
||||
|
||||
const is_dark_theme = localStorage.getItem('ui-theme') == 'theme-dark';
|
||||
const ui_theme = localStorage.getItem('ui-theme');
|
||||
const is_dark_theme = ui_theme == 'theme-dark' || ui_theme == 'theme-contrast-dark';
|
||||
let img = `<svg class='img-welcome'><use href=${!is_dark_theme ? '#welcome-light' : '#welcome-dark'}></svg>`;
|
||||
|
||||
if (window.utils.inParams.osver == 'winxp' || /windows nt 5/i.test(navigator.appVersion)) {
|
||||
|
||||
@ -1179,4 +1179,47 @@ li.menu-item {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#idx-update-cnt {
|
||||
background-color: @background-tabbar;
|
||||
border-radius: 5px;
|
||||
padding: 20px 30px;
|
||||
margin: 10px 0;
|
||||
max-width: 800px;
|
||||
|
||||
.status-field {
|
||||
height: 40px;
|
||||
|
||||
&:first-child {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
#idx-update-status-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
/* display: block;*/
|
||||
margin-right: 8px;
|
||||
|
||||
&[data-icon=success] {
|
||||
fill: @icon-success;
|
||||
}
|
||||
&[data-icon=error] {
|
||||
fill: @border-error;
|
||||
}
|
||||
&[data-icon=load], &[data-icon=lastcheck] {
|
||||
fill: @highlight-text-select;
|
||||
}
|
||||
|
||||
&[data-icon=load] {
|
||||
animation: rotate 1.5s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
#import "ASCThemesController.h"
|
||||
#import "ASCEditorJSVariables.h"
|
||||
#import "ASCPresentationReporter.h"
|
||||
#import "ASCDocumentType.h"
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
#define rootTabId @"1CEF624D-9FF3-432B-9967-61361B5BFE8B"
|
||||
@ -735,8 +736,30 @@
|
||||
|
||||
- (void)onCEFCreateTab:(NSNotification *)notification {
|
||||
if (notification && notification.userInfo) {
|
||||
NSDictionary * params = (NSDictionary *)notification.userInfo;
|
||||
|
||||
NSMutableDictionary * params = [notification.userInfo mutableCopy];
|
||||
|
||||
if ([params[@"action"] isEqualToNumber:@(ASCTabActionCreateLocalFileFromTemplate)]) {
|
||||
NSOpenPanel * openPanel = [NSOpenPanel openPanel];
|
||||
NSMutableArray * filter = [NSMutableArray array];
|
||||
|
||||
if ( [params[@"type"] isEqualToNumber:@(ASCDocumentTypePresentation)] ) {
|
||||
[filter addObjectsFromArray:@[@"potx", @"otp"]];
|
||||
} else if ( [params[@"type"] isEqualToNumber:@(ASCDocumentTypeSpreadsheet)] ) {
|
||||
[filter addObjectsFromArray:@[@"xltx", @"xltm", @"ots"]];
|
||||
} else {
|
||||
[filter addObjectsFromArray:@[@"dotx", @"ott"]];
|
||||
}
|
||||
|
||||
openPanel.canChooseDirectories = NO;
|
||||
openPanel.allowsMultipleSelection = NO;
|
||||
openPanel.canChooseFiles = YES;
|
||||
openPanel.allowedFileTypes = filter;
|
||||
|
||||
if ([openPanel runModal] == NSModalResponseOK) {
|
||||
[params setValue:[[openPanel URL] path] forKey:@"template"];
|
||||
} else return;
|
||||
}
|
||||
|
||||
ASCTabView *tab = [[ASCTabView alloc] initWithFrame:CGRectZero];
|
||||
tab.title = [NSString stringWithFormat:@"%@...", NSLocalizedString(@"Opening", nil)];
|
||||
tab.type = ASCTabViewTypeOpening;
|
||||
@ -1787,6 +1810,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
case ASCTabActionCreateLocalFileFromTemplate:
|
||||
case ASCTabActionCreateLocalFile: {
|
||||
int docType = CEFDocumentDocument;
|
||||
if ( [tab.params[@"type"] isKindOfClass:[NSString class]] ) {
|
||||
@ -1814,7 +1838,12 @@
|
||||
break;
|
||||
}
|
||||
|
||||
[cefView createFileWithName:docName type:docType];
|
||||
if (action == ASCTabActionCreateLocalFile ) {
|
||||
[cefView createFileWithName:docName type:docType];
|
||||
} else {
|
||||
[cefView createFileWithNameFromTemplate:docName tplpath:tab.params[@"template"]];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -683,24 +683,44 @@ public:
|
||||
NSString * nsParam = (NSString *)[NSString stringWithstdwstring:param];
|
||||
ASCDocumentType docType = ASCDocumentTypeUnknown;
|
||||
|
||||
if ([nsParam isEqualToString:@"word"]) {
|
||||
docType = ASCDocumentTypeDocument;
|
||||
} else if ([nsParam isEqualToString:@"cell"]) {
|
||||
docType = ASCDocumentTypeSpreadsheet;
|
||||
} else if ([nsParam isEqualToString:@"slide"]) {
|
||||
docType = ASCDocumentTypePresentation;
|
||||
} else if ([nsParam isEqualToString:@"form"]) {
|
||||
docType = ASCDocumentTypeForm;
|
||||
}
|
||||
if ([nsParam hasPrefix:@"template:"]) {
|
||||
if ([nsParam hasSuffix:@"word"]) {
|
||||
docType = ASCDocumentTypeDocument;
|
||||
} else
|
||||
if ([nsParam hasSuffix:@"slide"]) {
|
||||
docType = ASCDocumentTypePresentation;
|
||||
} else
|
||||
if ([nsParam hasSuffix:@"cell"]) {
|
||||
docType = ASCDocumentTypeSpreadsheet;
|
||||
}
|
||||
|
||||
if (docType != ASCDocumentTypeUnknown) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:CEFEventNameCreateTab
|
||||
object:nil
|
||||
userInfo:@{
|
||||
@"action" : @(ASCTabActionCreateLocalFile),
|
||||
@"action" : @(ASCTabActionCreateLocalFileFromTemplate),
|
||||
@"type" : @(docType),
|
||||
@"active" : @(YES)
|
||||
}];
|
||||
} else {
|
||||
if ([nsParam isEqualToString:@"word"]) {
|
||||
docType = ASCDocumentTypeDocument;
|
||||
} else if ([nsParam isEqualToString:@"cell"]) {
|
||||
docType = ASCDocumentTypeSpreadsheet;
|
||||
} else if ([nsParam isEqualToString:@"slide"]) {
|
||||
docType = ASCDocumentTypePresentation;
|
||||
} else if ([nsParam isEqualToString:@"form"]) {
|
||||
docType = ASCDocumentTypeForm;
|
||||
}
|
||||
|
||||
if (docType != ASCDocumentTypeUnknown) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:CEFEventNameCreateTab
|
||||
object:nil
|
||||
userInfo:@{
|
||||
@"action" : @(ASCTabActionCreateLocalFile),
|
||||
@"type" : @(docType),
|
||||
@"active" : @(YES)
|
||||
}];
|
||||
}
|
||||
}
|
||||
} else if (cmd.find(L"open:folder") != std::wstring::npos) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:CEFEventNameOpenLocalFile
|
||||
|
||||
@ -51,6 +51,7 @@ typedef NS_ENUM(int, ASCTabActionType) {
|
||||
ASCTabActionOpenPortal,
|
||||
ASCTabActionOpenUrl,
|
||||
ASCTabActionCreateLocalFile,
|
||||
ASCTabActionCreateLocalFileFromTemplate,
|
||||
ASCTabActionOpenLocalFile,
|
||||
ASCTabActionOpenLocalRecentFile,
|
||||
ASCTabActionOpenLocalRecoverFile,
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
}
|
||||
|
||||
+ (NSArray *)images {
|
||||
return @[@"jpg", @"jpeg", @"png", @"gif", @"bmp", @"tif", @"tiff", @"ico"];
|
||||
return @[@"jpg", @"jpeg", @"png", @"gif", @"bmp", @"tif", @"tiff", @"ico", @"svg"];
|
||||
}
|
||||
|
||||
+ (NSArray *)videos {
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
|
||||
- (void)loadWithUrl:(NSString *)url;
|
||||
- (void)createFileWithName:(NSString *)name type:(NSInteger)type;
|
||||
- (void)createFileWithNameFromTemplate:(NSString *)name tplpath:(NSString *)path;
|
||||
- (void)openFileWithName:(NSString *)name type:(NSInteger)type;
|
||||
- (void)openRecentFileWithId:(NSInteger)index;
|
||||
- (void)openRecoverFileWithId:(NSInteger)index;
|
||||
|
||||
@ -158,6 +158,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createFileWithNameFromTemplate:(NSString *)name tplpath:(NSString *)path {
|
||||
if (m_pCefView) {
|
||||
CCefViewEditor * editorView = dynamic_cast<CCefViewEditor *>(m_pCefView->GetCefView());
|
||||
|
||||
if (editorView) {
|
||||
editorView->CreateLocalFile(0, [name stdwstring], [path stdwstring]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)openFileWithName:(NSString *)name type:(NSInteger)type {
|
||||
if (m_pCefView) {
|
||||
CCefViewEditor * editorView = dynamic_cast<CCefViewEditor *>(m_pCefView->GetCefView());
|
||||
|
||||
@ -186,7 +186,8 @@ PLATFORM_BUILD=$$CORE_BUILDS_PLATFORM_PREFIX
|
||||
|
||||
core_linux:LIBS += -Wl,-unresolved-symbols=ignore-in-shared-libs
|
||||
|
||||
ADD_DEPENDENCY(PdfFile, DjVuFile, XpsFile, HtmlRenderer, UnicodeConverter, hunspell, ooxmlsignature, kernel, kernel_network, graphics, videoplayer, ascdocumentscore, qtascdocumentscore)
|
||||
ADD_DEPENDENCY(PdfFile, DjVuFile, XpsFile, HtmlRenderer, UnicodeConverter, hunspell, ooxmlsignature, kernel, kernel_network, graphics, ascdocumentscore, qtascdocumentscore)
|
||||
include($$CORE_ROOT_DIR/../desktop-sdk/ChromiumBasedEditors/videoplayerlib/videoplayerlib_deps.pri)
|
||||
|
||||
core_linux {
|
||||
QT += network x11extras
|
||||
|
||||
@ -8,6 +8,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="Nový dokument"
|
||||
NEW_XLSX_NAME="Nový sešit"
|
||||
NEW_PPTX_NAME="Nová prezentace"
|
||||
NEW_DOCXF_NAME="Nová šablona formuláře"
|
||||
;;
|
||||
de*)
|
||||
SOURCE_DOC_DIR="$SOURCE_DOC_DIR/de-DE"
|
||||
@ -15,6 +16,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="Neues Dokument"
|
||||
NEW_XLSX_NAME="Neues Tabellendokument"
|
||||
NEW_PPTX_NAME="Neue Präsentation"
|
||||
NEW_DOCXF_NAME="Neue Formularvorlage"
|
||||
;;
|
||||
es*)
|
||||
SOURCE_DOC_DIR="$SOURCE_DOC_DIR/es-ES"
|
||||
@ -22,6 +24,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="Documento nuevo"
|
||||
NEW_XLSX_NAME="Hoja de cálculo nueva"
|
||||
NEW_PPTX_NAME="Presentación nueva"
|
||||
NEW_DOCXF_NAME="Nueva plantilla de formulario"
|
||||
;;
|
||||
fr*)
|
||||
SOURCE_DOC_DIR="$SOURCE_DOC_DIR/fr-FR"
|
||||
@ -29,6 +32,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="Nouveau document"
|
||||
NEW_XLSX_NAME="Nouveau classeur"
|
||||
NEW_PPTX_NAME="Nouvelle présentation"
|
||||
NEW_DOCXF_NAME="Nouveau modèle de formulaire"
|
||||
;;
|
||||
it*)
|
||||
SOURCE_DOC_DIR="$SOURCE_DOC_DIR/it-IT"
|
||||
@ -36,6 +40,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="Nuovo documento"
|
||||
NEW_XLSX_NAME="Nuovo foglio di calcolo"
|
||||
NEW_PPTX_NAME="Nuova presentazione"
|
||||
NEW_DOCXF_NAME="Nuovo modello di modulo"
|
||||
;;
|
||||
pt*)
|
||||
SOURCE_DOC_DIR="$SOURCE_DOC_DIR/pt-BR"
|
||||
@ -43,6 +48,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="Novo Documento"
|
||||
NEW_XLSX_NAME="Nova planilha"
|
||||
NEW_PPTX_NAME="Nova apresentação"
|
||||
NEW_DOCXF_NAME="Novo Formulário Mestre"
|
||||
;;
|
||||
ru*)
|
||||
SOURCE_DOC_DIR="$SOURCE_DOC_DIR/ru-RU"
|
||||
@ -50,6 +56,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="Новый документ"
|
||||
NEW_XLSX_NAME="Новая эл.таблица"
|
||||
NEW_PPTX_NAME="Новая презентация"
|
||||
NEW_DOCXF_NAME="Новый шаблон формы"
|
||||
;;
|
||||
*)
|
||||
SOURCE_DOC_DIR="$SOURCE_DOC_DIR/en-US"
|
||||
@ -57,6 +64,7 @@ set_names() {
|
||||
NEW_DOCX_NAME="New Document"
|
||||
NEW_XLSX_NAME="New Spreadsheet"
|
||||
NEW_PPTX_NAME="New Presentation"
|
||||
NEW_DOCXF_NAME="New form template"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@ -66,6 +74,7 @@ set_names_ru() {
|
||||
NEW_DOCX_NAME="Новый документ"
|
||||
NEW_XLSX_NAME="Новая эл.таблица"
|
||||
NEW_PPTX_NAME="Новая презентация"
|
||||
NEW_DOCXF_NAME="Новый шаблон формы"
|
||||
}
|
||||
|
||||
check_templates() {
|
||||
@ -88,6 +97,7 @@ check_templates() {
|
||||
TEMPLATE_DOCX="$TEMPLATE_DIR/$NEW_DOCX_NAME.docx"
|
||||
TEMPLATE_XLSX="$TEMPLATE_DIR/$NEW_XLSX_NAME.xlsx"
|
||||
TEMPLATE_PPTX="$TEMPLATE_DIR/$NEW_PPTX_NAME.pptx"
|
||||
TEMPLATE_DOCXF="$TEMPLATE_DIR/$NEW_DOCXF_NAME.docxf"
|
||||
|
||||
mkdir -p $TEMPLATE_DIR
|
||||
|
||||
@ -105,6 +115,11 @@ check_templates() {
|
||||
then
|
||||
cp $SOURCE_DOC_DIR/$SOURCE_DOC_NAME.pptx "$TEMPLATE_PPTX"
|
||||
fi
|
||||
|
||||
if [ $(ls -A $TEMPLATE_DIR/*.docxf 2>/dev/null | wc -l) -eq 0 ]
|
||||
then
|
||||
cp $SOURCE_DOC_DIR/$SOURCE_DOC_NAME.docxf "$TEMPLATE_DOCXF"
|
||||
fi
|
||||
}
|
||||
|
||||
check_templates "$@"
|
||||
|
||||
@ -375,6 +375,9 @@ bool CAscApplicationManagerWrapper::processCommonEvent(NSEditorApi::CAscCefMenuE
|
||||
}
|
||||
|
||||
return true;
|
||||
} else
|
||||
if ( !(cmd.find(L"updates:action") == std::wstring::npos) ) {
|
||||
// qDebug() << "updates action" << pData->get_Param();
|
||||
}
|
||||
|
||||
break; }
|
||||
@ -1926,6 +1929,16 @@ QString CAscApplicationManagerWrapper::newFileName(int format)
|
||||
}
|
||||
}
|
||||
|
||||
QString CAscApplicationManagerWrapper::newFileName(const std::wstring& format)
|
||||
{
|
||||
int _f = format == L"word" ? AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX :
|
||||
format == L"cell" ? AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX :
|
||||
format == L"form" ? AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCXF :
|
||||
format == L"slide" ? AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX : AVS_OFFICESTUDIO_FILE_UNKNOWN;
|
||||
|
||||
return newFileName(_f);
|
||||
}
|
||||
|
||||
/*void CAscApplicationManagerWrapper::checkUpdates()
|
||||
{
|
||||
//APP_CAST(_app);
|
||||
|
||||
@ -189,6 +189,7 @@ public:
|
||||
static bool canAppClose();
|
||||
static QCefView * createViewer(QWidget * parent);
|
||||
static QString newFileName(int format);
|
||||
static QString newFileName(const std::wstring& format);
|
||||
static CThemes & themes();
|
||||
static CPrintData& printData();
|
||||
|
||||
|
||||
@ -242,16 +242,31 @@ public:
|
||||
} else
|
||||
if ( cmd.compare(L"create:new") == 0 ) {
|
||||
const std::wstring & format = data.get_Param();
|
||||
int _f = format == L"word" ? AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX :
|
||||
format == L"cell" ? AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX :
|
||||
format == L"form" ? AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCXF :
|
||||
format == L"slide" ? AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX : AVS_OFFICESTUDIO_FILE_UNKNOWN;
|
||||
|
||||
COpenOptions opts{m_appmanager.newFileName(_f), etNewFile};
|
||||
opts.format = _f;
|
||||
opts.parent_id = event.m_nSenderId;
|
||||
if ( format.rfind(L"template:", 0) == 0 ) {
|
||||
std::wstring type = format.substr(format.size() - 4);
|
||||
std::wstring file_path = CEditorTools::getlocaltemplate(type, event.m_nSenderId).toStdWString();
|
||||
|
||||
if ( !file_path.empty() ) {
|
||||
COpenOptions opts{file_path, etTemplateFile};
|
||||
opts.name = m_appmanager.newFileName(type);
|
||||
opts.parent_id = event.m_nSenderId;
|
||||
|
||||
openDocument(opts);
|
||||
}
|
||||
} else {
|
||||
int _f = format == L"word" ? AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX :
|
||||
format == L"cell" ? AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX :
|
||||
format == L"form" ? AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCXF :
|
||||
format == L"slide" ? AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX : AVS_OFFICESTUDIO_FILE_UNKNOWN;
|
||||
|
||||
COpenOptions opts{m_appmanager.newFileName(_f), etNewFile};
|
||||
opts.format = _f;
|
||||
opts.parent_id = event.m_nSenderId;
|
||||
|
||||
openDocument(opts);
|
||||
}
|
||||
|
||||
openDocument(opts);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -199,6 +199,33 @@ namespace CEditorTools
|
||||
return _path;
|
||||
}
|
||||
|
||||
QString getlocaltemplate(const std::wstring& editor, int parentid)
|
||||
{
|
||||
ParentHandle parent;
|
||||
if ( !(parentid < 0) )
|
||||
parent = AscAppManager::windowHandleFromId(parentid);
|
||||
else parent = qApp->activeWindow();
|
||||
|
||||
QString _filter;
|
||||
if ( editor.compare(L"cell") == 0 ) {
|
||||
_filter = CFileDialogWrapper::tr("Spreadsheet template") + " (*.xltx *.xltm *.ots)";
|
||||
} else
|
||||
if ( editor.compare(L"slide") == 0 ) {
|
||||
_filter = CFileDialogWrapper::tr("Presentation template") + " (*.potx *.otp)";
|
||||
} else {
|
||||
_filter = CFileDialogWrapper::tr("Document template") + " (*.dotx *.ott)";
|
||||
}
|
||||
|
||||
CFileDialogWrapper dlg(parent);
|
||||
|
||||
QString _path = Utils::lastPath(LOCAL_PATH_OPEN);
|
||||
if ( !(_path = dlg.modalOpenSingle(_path, _filter)).isEmpty() ) {
|
||||
Utils::keepLastPath(LOCAL_PATH_OPEN, QFileInfo(_path).absolutePath());
|
||||
}
|
||||
|
||||
return _path;
|
||||
}
|
||||
|
||||
std::wstring getFolder(const std::wstring& path, int parentid)
|
||||
{
|
||||
ParentHandle parent;
|
||||
@ -252,6 +279,9 @@ namespace CEditorTools
|
||||
} else
|
||||
if (opts.srctype == etNewFile) {
|
||||
panel->createLocalFile(editorTypeFromFormat(opts.format), opts.name.toStdWString());
|
||||
} else
|
||||
if (opts.srctype == etTemplateFile) {
|
||||
panel->createLocalFile(L"", opts.name.toStdWString());
|
||||
} else {
|
||||
panel->cef()->load(opts.wurl);
|
||||
}
|
||||
@ -259,7 +289,7 @@ namespace CEditorTools
|
||||
if ( result ) {
|
||||
CAscTabData * data = new CAscTabData(opts.name);
|
||||
data->setUrl(opts.wurl);
|
||||
data->setIsLocal( opts.srctype == etLocalFile || opts.srctype == etNewFile ||
|
||||
data->setIsLocal( opts.srctype == etLocalFile || opts.srctype == etNewFile || opts.srctype == etTemplateFile ||
|
||||
(opts.srctype == etRecentFile && !CExistanceController::isFileRemote(opts.url)) );
|
||||
|
||||
if ( opts.srctype == etNewFile )
|
||||
|
||||
@ -57,6 +57,7 @@ namespace CEditorTools
|
||||
void print(const sPrintConf&);
|
||||
void getlocalfile(void * data);
|
||||
QString getlocalfile(const std::wstring& path, int parentid = -1);
|
||||
QString getlocaltemplate(const std::wstring& editor, int parentid);
|
||||
std::wstring getFolder(const std::wstring&, int parentid = -1);
|
||||
|
||||
auto createEditorPanel(const COpenOptions& opts, const QRect& rect = QRect()) -> CTabPanel *;
|
||||
|
||||
@ -142,6 +142,11 @@ CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar)
|
||||
static int _dropedindex = -1;
|
||||
QObject::connect(this, &CAscTabWidget::currentChanged, this, [=](int index) {
|
||||
QTimer::singleShot(0, this, [=]() {
|
||||
if (index != -1 && index != m_pBar->currentIndex()) {
|
||||
m_pBar->blockSignals(true);
|
||||
m_pBar->setCurrentIndex(index);
|
||||
m_pBar->blockSignals(false);
|
||||
}
|
||||
updateIcons();
|
||||
});
|
||||
setFocusedView();
|
||||
@ -171,7 +176,9 @@ CAscTabWidget::CAscTabWidget(QWidget *parent, CTabBar *_pBar)
|
||||
}
|
||||
});
|
||||
auto turnOffAltHints = [=](int old_index, int index) {
|
||||
this->setCurrentIndex(index);
|
||||
QTimer::singleShot(0, this, [=]() {
|
||||
setCurrentIndex(index);
|
||||
});
|
||||
if (old_index > -1)
|
||||
AscAppManager::sendCommandTo(panel(old_index)->cef(), L"althints:show", L"false");
|
||||
};
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
#include "cscalingwrapper.h"
|
||||
#include "ctabpanel.h"
|
||||
|
||||
#define etTemplateFile AscEditorType(255)
|
||||
#define etLocalFile AscEditorType(254)
|
||||
#define etRecoveryFile AscEditorType(253)
|
||||
#define etRecentFile AscEditorType(252)
|
||||
|
||||
@ -63,11 +63,11 @@ CFileDialogWrapper::CFileDialogWrapper(QWidget * parent) : QObject(parent)
|
||||
{
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_UNKNOWN] = tr("All files (*.*)");
|
||||
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX] = tr("DOCX Document (*.docx)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX] = tr("Document template (*.dotx)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX] = tr("DOCX Document") + " (*.docx)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX] = tr("Document template") + " (*.dotx)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC] = tr("DOC Document (*.doc)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT] = tr("ODT Document (*.odt)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT] = tr("OpenDocument Document template (*.ott)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT] = tr("OpenDocument Document template") + " (*.ott)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF] = tr("RTF File (*.rtf)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT] = tr("TXT File (*.txt)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML] = tr("HTML File (*.html)");
|
||||
@ -80,24 +80,25 @@ CFileDialogWrapper::CFileDialogWrapper(QWidget * parent) : QObject(parent)
|
||||
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX] = tr("PPTX File (*.pptx)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT] = tr("PPT File (*.ppt)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX] = tr("Presentation template (*.potx)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX] = tr("Presentation template") + " (*.potx)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP] = tr("ODP File (*.odp)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP] = tr("OpenDocument Presentation Template (*.otp)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP] = tr("OpenDocument Presentation Template") + " (*.otp)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX] = tr("PPSX File (*.ppsx)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM] = tr("Macro-enabled Presentation File (*.pptm)");
|
||||
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX] = tr("XLSX File (*.xlsx)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX] = tr("Spreadsheet template (*.xltx)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM] = tr("Macro-enabled spreadsheet template (*.xltm)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX] = tr("Spreadsheet template") + " (*.xltx)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM] = tr("Macro-enabled spreadsheet template") + " (*.xltm)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS] = tr("XLS File (*.xls)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS] = tr("ODS File (*.ods)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS] = tr("OpenDocument Spreadsheet Template (*.ots)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS] = tr("OpenDocument Spreadsheet Template") + " (*.ots)";
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV] = tr("CSV File (*.csv)");
|
||||
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF] = tr("PDF File (*.pdf)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDFA] = tr("PDFA File (*.pdf)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU] = tr("DJVU File (*.djvu)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_XPS] = tr("XPS File (*.xps)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG] = tr("SVG Image (*.svg)");
|
||||
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_IMAGE_JPG] = tr("JPG Image (*.jpg *.jpeg)");
|
||||
m_mapFilters[AVS_OFFICESTUDIO_FILE_IMAGE_PNG] = tr("PNG Image (*.png)");
|
||||
@ -293,18 +294,20 @@ QString CFileDialogWrapper::modalOpenSingle(const QString& path, const QString&
|
||||
|
||||
QStringList CFileDialogWrapper::modalOpenImage(const QString& path)
|
||||
{
|
||||
QString selected = tr("All Images") + " (*.jpeg *.jpg *.png *.gif *.bmp)";
|
||||
QString selected = tr("All Images") + " (*.jpeg *.jpg *.png *.gif *.bmp *.svg)";
|
||||
QString filter = m_mapFilters[AVS_OFFICESTUDIO_FILE_UNKNOWN];
|
||||
filter.append(";;" + selected + ";;" + tr("Jpeg (*.jpeg *.jpg);;Png (*.png);;Gif (*.gif);;Bmp (*.bmp)"));
|
||||
filter.append(";;" + m_mapFilters[AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG]);
|
||||
|
||||
return modalOpen(path, filter, &selected, false);
|
||||
}
|
||||
|
||||
QStringList CFileDialogWrapper::modalOpenImages(const QString& path)
|
||||
{
|
||||
QString selected = tr("All Images") + " (*.jpeg *.jpg *.png *.gif *.bmp)";
|
||||
QString selected = tr("All Images") + " (*.jpeg *.jpg *.png *.gif *.bmp *.svg)";
|
||||
QString filter = m_mapFilters[AVS_OFFICESTUDIO_FILE_UNKNOWN];
|
||||
filter.append(";;" + selected + ";;" + tr("Jpeg (*.jpeg *.jpg);;Png (*.png);;Gif (*.gif);;Bmp (*.bmp)"));
|
||||
filter.append(";;" + m_mapFilters[AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SVG]);
|
||||
|
||||
return modalOpen(path, filter, &selected, true);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
#include "components/ctabpanel.h"
|
||||
#include "ctabpanel.h"
|
||||
#include "cascapplicationmanagerwrapper.h"
|
||||
#include "defines.h"
|
||||
#include "cefview.h"
|
||||
@ -124,6 +124,11 @@ void CTabPanel::createLocalFile(int format, const std::wstring& name)
|
||||
static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->CreateLocalFile(format, name);
|
||||
}
|
||||
|
||||
void CTabPanel::createLocalFile(const std::wstring& templatepath, const std::wstring& name)
|
||||
{
|
||||
static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->CreateLocalFile(0, name, templatepath);
|
||||
}
|
||||
|
||||
bool CTabPanel::openRecoverFile(int id)
|
||||
{
|
||||
return static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->OpenRecoverFile(id);
|
||||
|
||||
@ -30,6 +30,7 @@ public:
|
||||
void openLocalFile(const std::wstring& sFilePath, int nFileFormat, const std::wstring& params);
|
||||
bool openLocalFile(const std::wstring& sFilePath, const std::wstring& params);
|
||||
void createLocalFile(int nFileFormat, const std::wstring& sName = L"");
|
||||
void createLocalFile(const std::wstring& templatepath, const std::wstring& name);
|
||||
bool openRecoverFile(int id);
|
||||
bool openRecentFile(int id);
|
||||
bool isReady();
|
||||
|
||||
@ -64,7 +64,7 @@ void CMainWindowImpl::refreshAboutVersion()
|
||||
_json_obj["appname"] = WINDOW_NAME;
|
||||
_json_obj["rights"] = "© " ABOUT_COPYRIGHT_STR;
|
||||
_json_obj["link"] = URL_SITE;
|
||||
_json_obj["changelog"] = "https://github.com/ONLYOFFICE/DesktopEditors/blob/master/CHANGELOG.md";
|
||||
// _json_obj["changelog"] = "https://github.com/ONLYOFFICE/DesktopEditors/blob/master/CHANGELOG.md";
|
||||
|
||||
QString _package = QSettings(qApp->applicationDirPath() + "/converter/package.config", QSettings::IniFormat).value("package").toString();
|
||||
if ( !_package.isEmpty() )
|
||||
|
||||
@ -521,11 +521,11 @@ void CMainWindow::onEditorAllowedClose(int uid)
|
||||
} else {
|
||||
int _index = m_pTabs->tabIndexByView(uid);
|
||||
if ( !(_index < 0) ) {
|
||||
m_pTabs->tabBar()->removeTab(_index);
|
||||
QWidget * _view = m_pTabs->widget(_index);
|
||||
m_pTabs->removeWidget(_view);
|
||||
_view->deleteLater();
|
||||
|
||||
m_pTabs->tabBar()->removeTab(_index);
|
||||
//m_pTabs->adjustTabsSize();
|
||||
|
||||
onTabChanged(m_pTabs->currentIndex());
|
||||
|
||||
Reference in New Issue
Block a user