diff --git a/common/loginpage/src/menu.js b/common/loginpage/src/menu.js index 5ea4a959c..37689f340 100644 --- a/common/loginpage/src/menu.js +++ b/common/loginpage/src/menu.js @@ -115,6 +115,15 @@ Menu.prototype.disableItem = function(action, disable) { } }; +Menu.prototype.hideItem = function(action, hide) { + for (let item of this.items) { + if (item.action == action) { + $('#' + item.id).parent() + [hide?'hide':'show'](); + } + } +}; + Menu.opened = false; Menu.closeAll = function() { diff --git a/common/loginpage/src/model.js b/common/loginpage/src/model.js index bb12c0683..67e1d8aa6 100644 --- a/common/loginpage/src/model.js +++ b/common/loginpage/src/model.js @@ -160,6 +160,7 @@ function FileModel(attributes) { this.name = attributes.name || ''; this.descr = attributes.descr || ''; + this.path = attributes.path; this.date = attributes.date; this.type = attributes.type; this.fileid = attributes.id; diff --git a/common/loginpage/src/panelrecent.js b/common/loginpage/src/panelrecent.js index ce7fbde15..6c9a606ef 100644 --- a/common/loginpage/src/panelrecent.js +++ b/common/loginpage/src/panelrecent.js @@ -197,6 +197,7 @@ collectionRecents.events.contextmenu.attach(function(collection, model, e){ ppmenu.actionlist = 'recent'; + ppmenu.hideItem('files:explore', false); ppmenu.show({left: e.clientX, top: e.clientY}, model); }); @@ -221,6 +222,7 @@ }); collectionRecovers.events.contextmenu.attach((collection, model, e)=>{ ppmenu.actionlist = 'recovery'; + ppmenu.hideItem('files:explore', true); ppmenu.show({left: e.clientX, top: e.clientY}, model); }); }; @@ -231,6 +233,9 @@ items: [{ caption: utils.Lang.menuFileOpen, action: 'files:open' + },{ + caption: 'Show in folder', + action: 'files:explore' },{ caption: utils.Lang.menuRemoveModel, action: 'files:forget' @@ -259,6 +264,11 @@ menu.actionlist == 'recent' ? window.sdk.LocalFileRemoveRecent(parseInt(data.fileid)) : window.sdk.LocalFileRemoveRecover(parseInt(data.fileid)); + } else + if (/\:explore/.test(action)) { + if (menu.actionlist == 'recent') { + sdk.execCommand('files:explore', data.path); + } } }; diff --git a/win-linux/src/ccefeventstransformer.cpp b/win-linux/src/ccefeventstransformer.cpp index 20b3d22b2..ad835e8ff 100644 --- a/win-linux/src/ccefeventstransformer.cpp +++ b/win-linux/src/ccefeventstransformer.cpp @@ -206,6 +206,10 @@ void CCefEventsTransformer::OnEvent(NSEditorApi::CAscMenuEvent *pEvent) if ( !(cmd.find(L"files:check") == std::wstring::npos) ) { QMetaObject::invokeMethod( pObjParent, "onLocalFilesCheck", Qt::QueuedConnection, Q_ARG(QString, QString::fromStdWString(pData->get_Param())) ); + } else + if ( !(cmd.find(L"files:explore") == std::wstring::npos) ) { + QMetaObject::invokeMethod( pObjParent, "onLocalFileLocation", Qt::QueuedConnection, + Q_ARG(QString, QString::fromStdWString(pData->get_Param())) ); } else { // std::wregex _re_appcmd(L"^app\\:(\\w+)", std::tr1::wregex::icase); // auto _iter_cmd = std::wsregex_iterator(cmd.begin(), cmd.end(), _re_appcmd); diff --git a/win-linux/src/cmainpanel.cpp b/win-linux/src/cmainpanel.cpp index 3dd716683..9e2bfd65e 100644 --- a/win-linux/src/cmainpanel.cpp +++ b/win-linux/src/cmainpanel.cpp @@ -797,6 +797,11 @@ void CMainPanel::onLocalFilesCheck(QString json) } } +void CMainPanel::onLocalFileLocation(QString path) +{ + Utils::openFileLocation(path); +} + void CMainPanel::doOpenLocalFiles(const vector * vec) { if (qApp->activeModalWidget()) return; diff --git a/win-linux/src/cmainpanel.h b/win-linux/src/cmainpanel.h index 17025c652..ca632d6b4 100644 --- a/win-linux/src/cmainpanel.h +++ b/win-linux/src/cmainpanel.h @@ -129,6 +129,7 @@ public slots: void onLocalFileRecent(void *); void onLocalFileSaveAs(void *); void onLocalFilesCheck(QString); + void onLocalFileLocation(QString); void onLocalGetImage(void *); void onPortalOpen(QString); void onPortalLogin(QString); diff --git a/win-linux/src/utils.cpp b/win-linux/src/utils.cpp index bb22839e6..c699f6d0c 100644 --- a/win-linux/src/utils.cpp +++ b/win-linux/src/utils.cpp @@ -166,6 +166,28 @@ void Utils::openUrl(const QString& url) #endif } +#include +void Utils::openFileLocation(const QString& path) +{ +#if defined(Q_OS_WIN) + QStringList args{"/select,", QDir::toNativeSeparators(path)}; + QProcess::startDetached("explorer", args); +#else + // we cannot select a file here, because no file browser really supports it... +// const QFileInfo fileInfo(pathIn); +// const QString folder = fileInfo.absoluteFilePath(); +// const QString app = Utils::UnixUtils::fileBrowser(Core::ICore::instance()->settings()); +// QProcess browserProc; +// const QString browserArgs = Utils::UnixUtils::substituteFileBrowserParameters(app, folder); +// qDebug() << browserArgs; +// bool success = browserProc.startDetached(browserArgs); +// const QString error = QString::fromLocal8Bit(browserProc.readAllStandardError()); +// success = success && error.isEmpty(); +// if (!success) +// showGraphicalShellError(parent, app, error); +#endif +} + QString Utils::getPortalName(const QString& url) { if ( !url.isEmpty() ) { diff --git a/win-linux/src/utils.h b/win-linux/src/utils.h index f7c80a32b..bb9d3385f 100644 --- a/win-linux/src/utils.h +++ b/win-linux/src/utils.h @@ -46,6 +46,7 @@ public: static QString getUserPath(); static QRect getScreenGeometry(const QPoint&); static void openUrl(const QString&); + static void openFileLocation(const QString&); static QString getPortalName(const QString&); static bool makepath(const QString&); diff --git a/win-linux/src/version.h b/win-linux/src/version.h index ceb576dcd..9af7571ad 100644 --- a/win-linux/src/version.h +++ b/win-linux/src/version.h @@ -33,8 +33,8 @@ #ifndef VERSION_H #define VERSION_H -#define VER_FILEVERSION 4,1,2,270 -#define VER_FILEVERSION_STR "4.1.2.270\0" +#define VER_FILEVERSION 4,1,3,274 +#define VER_FILEVERSION_STR "4.1.3.274\0" #define VER_PRODUCTVERSION VER_FILEVERSION #define VER_PRODUCTVERSION_STR "4.1\0"