Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .docker/desktop-apps.bake.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ FROM core-base AS desktop-linux
libasound2-dev \
libpulse-dev \
libnss3-dev \
libnspr4-dev && \
libnspr4-dev \
mdbtools-dev && \
python3 -m venv /opt/venv && \
/opt/venv/bin/pip install --no-cache-dir aqtinstall

Expand Down Expand Up @@ -102,7 +103,7 @@ FROM core-base AS desktop-linux
-DVCPKG_MANIFEST_FEATURES="desktop-editors" \
-DABOUT_PAGE_APP_NAME="${ABOUT_PAGE_APP_NAME}" \
/desktop-apps/win-linux/ && \
cmake --build . && \
cmake --build . -- -j4 && \
cmake --install . && \
ccache --show-stats && \
cp -a desktopeditors /desktopeditors
Expand Down
496 changes: 496 additions & 0 deletions package/common/license/3dparty/3DPARTYLICENSE

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions win-linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,15 @@ install(TARGETS
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# mdbtools is only linked by x2t (via BinDocument), not by DesktopEditors
# itself, so it needs to land next to x2t in converter/ -- x2t's
# INSTALL_RPATH (set by set_default_options()) only searches $ORIGIN and
# $ORIGIN/system, not the app root where the other targets above install to.
install(TARGETS mdbtools
LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}/converter
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/converter
)

# CEF binaries
if(WIN32)
install(DIRECTORY "${CEF_LIB_PATH}/"
Expand Down
9 changes: 9 additions & 0 deletions win-linux/src/components/asctabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,15 @@ void CAscTabWidget::applyPageLoadingStatus(int id, int state)
m_pBar->setTabLoading(tabIndex, false);
panel(tabIndex)->applyLoader("hide");
panel(tabIndex)->setReady();

// Shown here (once the tab has actually finished loading) rather
// than synchronously during any particular open path, so it's
// uniform across File > Open, Recent Files, and drag-and-drop --
// and so a modal dialog never pops while an OS-level operation
// (e.g. a Wayland drag-and-drop grab) triggering the open is
// still in progress. Utils::warnIfDatabaseFile no-ops for
// non-database files.
Utils::warnIfDatabaseFile(this, QString::fromStdWString(panel(tabIndex)->data()->url()));
} else
if ( state == DOCUMENT_CHANGED_PAGE_LOAD_FINISH ) {
if ( !panel(tabIndex)->data()->eventLoadSupported() ) {
Expand Down
33 changes: 26 additions & 7 deletions win-linux/src/components/cfiledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@ bool CFileDialogWrapper::modalSaveAs(QString& fileName, int selected)
_filters.append(";;" + _sel_filter);
}

// The document's current extension may not match any of the offered
// Save As filters (e.g. a database-origin document, which is
// deliberately excluded as a save target). In that case _sel_filter is
// still empty here -- default it to the first available filter instead
// of leaving it blank, since native/portal file dialogs reject a
// filter with an empty name.
if ( _sel_filter.isEmpty() ) {
const QString _first = _filters.split(";;").value(0);
if ( !_first.isEmpty() )
_sel_filter = _first;
}

#ifdef _WIN32
// TODO: win 10 home doesn't crop file name by self. refactor for ver 7.5 with linux ver
// QString _croped_name = fileName;
Expand Down Expand Up @@ -257,6 +269,7 @@ QStringList CFileDialogWrapper::modalOpen(const QString& path, const QString& fi
" (*.docx *.doc *.odt *.ott *.rtf *.docm *.dot *.dotx *.dotm *.fb2 *.fodt *.hml *.wps *.wpt *.xml *.pdf *.djv *.djvu *.md *.sxw *.stw *.xps *.oxps);;" +
#endif
tr("Spreadsheets") + " (*.xlsx *.xls *.xlsm *.xlsb *.ods *.ots *.xltx *.xltm *.xml *.fods *.et *.ett *.sxc *.numbers);;" +
tr("Databases") + " (*.sqlite *.sqlite3 *.db *.db3 *.duckdb *.parquet *.pq *.mdb *.accdb);;" +
tr("Presentations") + " (*.pptx *.ppt *.odp *.odg *.otp *.ppsm *.pptm *.ppsx *.pps *.potx *.pot *.potm *.fodp *.dps *.dpt *.sxi *.key);;" +
tr("Visio diagram") + " (*.vsdx *.vssx *.vstx *.vsdm *.vssm *.vstm);;" +
tr("Web Page") + " (*.html *.htm *.mht *.mhtml *.epub);;" +
Expand Down Expand Up @@ -361,7 +374,7 @@ QStringList CFileDialogWrapper::modalOpenDocuments(const QString& path, bool mul
QStringList CFileDialogWrapper::modalOpenSpreadsheets(const QString& path, bool multi)
{
QString filter = m_mapFilters[AVS_OFFICESTUDIO_FILE_UNKNOWN];
filter.prepend(tr("Spreadsheets") + " (*.xlsx *.xls *.ods *.ots *.csv *.tsv *.xltx *.xltm *.fods *.et *.ett);;");
filter.prepend(tr("Spreadsheets") + " (*.xlsx *.xls *.ods *.ots *.csv *.tsv *.xltx *.xltm *.fods *.et *.ett);;" + tr("Databases") + " (*.sqlite *.sqlite3 *.db *.db3 *.duckdb *.parquet *.pq *.mdb *.accdb);;");

return modalOpen(path, filter, nullptr, multi);
}
Expand Down Expand Up @@ -459,12 +472,18 @@ void CFileDialogWrapper::setFormats(std::vector<int>& vf)
{
m_filters.clear();

if ( vf.size() ) {
std::vector<int>::iterator i = vf.begin();
m_filters = m_mapFilters.value(*(i++));
while (i != vf.end()) {
m_filters += ";;" + m_mapFilters.value(*(i++));
}
// m_mapFilters.value() returns an empty string for any format id it
// doesn't have an entry for (e.g. a database-origin format that isn't a
// valid Save As target). Skip those instead of appending an empty
// filter, which the XDG portal / native file dialogs reject outright.
for (int id : vf) {
const QString filter = m_mapFilters.value(id);
if (filter.isEmpty())
continue;
if (m_filters.isEmpty())
m_filters = filter;
else
m_filters += ";;" + filter;
}
}

Expand Down
24 changes: 22 additions & 2 deletions win-linux/src/components/ctabpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include "cascapplicationmanagerwrapper.h"
#include "defines.h"
#include "cefview.h"
#include "utils.h"
#include <QHBoxLayout>
#include "cmessage.h"


using namespace NSEditorApi;
Expand Down Expand Up @@ -112,7 +114,19 @@ void CTabPanel::initAsSimple()

void CTabPanel::openLocalFile(const std::wstring& path, int format, const std::wstring& params)
{
static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->OpenLocalFile(path, format, params);
QString qPath = QString::fromStdWString(path);
std::wstring _params = params;
if (Utils::isDatabaseFile(qPath)) {
// Database engines are read-only; open in view mode so the document
// can't be edited/saved in place (only exported via Save As). The
// warning itself is shown later, once the tab finishes loading (see
// CAscTabWidget::applyPageLoadingStatus) -- showing it synchronously
// here broke drag-and-drop opens under Wayland (a modal surface
// popped while the compositor's DnD grab was still active corrupted
// the new tab's rendering).
_params.append(L"&mode=view");
}
static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->OpenLocalFile(path, format, _params);
}

bool CTabPanel::openLocalFile(const std::wstring& path, const std::wstring& params)
Expand All @@ -121,7 +135,13 @@ bool CTabPanel::openLocalFile(const std::wstring& path, const std::wstring& para
if ( _format == 0 )
return false;

static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->OpenLocalFile(path, _format, params);
QString qPath = QString::fromStdWString(path);
std::wstring _params = params;
if (Utils::isDatabaseFile(qPath)) {
_params.append(L"&mode=view");
}

static_cast<CCefViewEditor *>(m_pViewer->GetCefView())->OpenLocalFile(path, _format, _params);
return true;
}

Expand Down
29 changes: 29 additions & 0 deletions win-linux/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#endif
#include "utils.h"
#include "defines.h"
#include "components/cmessage.h"
#include <QSettings>
#include <QStandardPaths>
#include <QDir>
Expand Down Expand Up @@ -747,6 +748,34 @@ void Utils::processMoreEvents(uint timeout)
loop.exec();
}

bool Utils::isDatabaseFile(const QString& path)
{
return path.endsWith(".sqlite", Qt::CaseInsensitive) || path.endsWith(".sqlite3", Qt::CaseInsensitive) ||
path.endsWith(".db", Qt::CaseInsensitive) || path.endsWith(".db3", Qt::CaseInsensitive) ||
path.endsWith(".duckdb", Qt::CaseInsensitive) || path.endsWith(".parquet", Qt::CaseInsensitive) ||
path.endsWith(".pq", Qt::CaseInsensitive) || path.endsWith(".mdb", Qt::CaseInsensitive) ||
path.endsWith(".accdb", Qt::CaseInsensitive);
}

void Utils::warnIfDatabaseFile(QWidget* parent, const QString& path)
{
if (!isDatabaseFile(path))
return;

GET_REGISTRY_USER(reg_user);
if (reg_user.value("ignoreMsgAboutDatabaseFile", false).toBool())
return;

bool dontAskAgain = false;
CMessageOpts opts;
opts.checkBoxState = &dontAskAgain;
opts.chekBoxText = QObject::tr("Don't ask again.");
CMessage::showMessage(parent, QObject::tr("Warning: Cannot recover constraints, procedures, etc. from database files. You will need to save it as a spreadsheet."),
MsgType::MSG_WARN, MsgBtns::mbOk, opts);
if (dontAskAgain)
reg_user.setValue("ignoreMsgAboutDatabaseFile", true);
}

#ifdef _WIN32
Utils::WinVer Utils::getWinVersion()
{
Expand Down
7 changes: 7 additions & 0 deletions win-linux/src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ class Utils {
static void addToRecent(const std::wstring&);
static void processMoreEvents(uint timeout = 60);

static bool isDatabaseFile(const QString& path);
// Shows the "can't recover constraints/procedures" warning for database
// files, honoring the "don't ask again" checkbox (mirrors the
// ignoreMsgAboutOpenTabs pattern in CMainWindow::close). No-op if path
// isn't a recognized database file.
static void warnIfDatabaseFile(QWidget* parent, const QString& path);

#ifdef _WIN32
enum class WinVer : uchar {
Undef, WinXP, WinVista, Win7, Win8, Win8_1, Win10, Win11
Expand Down
1 change: 1 addition & 0 deletions win-linux/src/windows/cmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ void CMainWindow::dragEnterEvent(QDragEnterEvent *event)
_exts << "xlsx" << "xls" << "ods" << "csv" << "xlst" << "xltx" << "ots";
_exts << "pdf" << "djvu" << "xps";
_exts << "plugin";
_exts << "sqlite" << "sqlite3" << "db" << "db3" << "duckdb" << "parquet" << "pq" << "mdb" << "accdb";

QFileInfo oInfo(urls[0].toString());

Expand Down